From 3b2a78935fd6550521f719a10e5b0fceb1ddb350 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 15 Feb 2023 16:31:56 +0100 Subject: Not really but, First commit! --- bin/common/ask | 28 + bin/common/autofetch | 13 + bin/common/fzfdir | 2 + bin/common/fzfdirfile | 2 + bin/common/fzffile | 2 + bin/common/gign | 2 + bin/common/hextorgb | 7 + bin/common/wt | 10 + bin/dmscripts/dmapimg | 6 + bin/dmscripts/dmclip | 83 + bin/dmscripts/dmdsktp | 12 + bin/dmscripts/dmemoji | 1423 ++++++++++ bin/dmscripts/dmfm | 17 + bin/dmscripts/dmhelp | 26 + bin/dmscripts/dminw | 4 + bin/dmscripts/dmlang | 7 + bin/dmscripts/dmpass | 11 + bin/dmscripts/dmpassgen | 20 + bin/dmscripts/dmpdf | 21 + bin/dmscripts/dmpower | 3 + bin/dmscripts/dmpsbm | 2 + bin/dmscripts/dmpsclip | 3 + bin/dmscripts/dmvid | 17 + bin/dmscripts/dmyt-not | 6 + bin/extra/arr_hjkl | 17 + bin/extra/cht.sh | 796 ++++++ bin/extra/colorscript | 40 + bin/extra/cycleKB | 11 + bin/extra/ehbtodl | 9 + bin/extra/keyboards.txt | 2 + bin/extra/vimastp | 12 + config/X/alacritty/alacritty.yml | 939 +++++++ config/X/dunst/dunstrc | 456 +++ config/X/mpv/input.conf | 204 ++ config/X/mpv/mpv.conf | 28 + config/X/mpv/playfile.txt | 2 + config/X/mpv/scripts/script-opts/webm.conf | 78 + .../X/mpv/scripts/script-opts/youtube-quality.conf | 41 + config/X/mpv/scripts/webm.lua | 2914 ++++++++++++++++++++ config/X/mpv/scripts/youtube-quality.lua | 275 ++ .../watch_later/9EDC60703A9785FE514694A824A11563 | 2 + config/X/picom/picom.conf | 493 ++++ config/X/picom/picom.conf.bak | 410 +++ config/X/redshift/redshift.conf | 70 + config/X/x11/.Xauthority | Bin 0 -> 52 bytes config/X/x11/.Xresources | 155 ++ config/X/x11/xinitrc | 36 + config/X/xmobar/scripts/.updates.swp | Bin 0 -> 12288 bytes config/X/xmobar/scripts/battery | 13 + config/X/xmobar/scripts/checkupds | 2 + config/X/xmobar/scripts/minwinfo | 5 + config/X/xmobar/scripts/whscreen | 23 + config/X/xmobar/scripts/winfo | 124 + config/X/xmobar/scripts/winfo_icons | 15 + config/X/xmobar/xmobarrc0.hs | 20 + config/X/xmobar/xmobarrc1.hs | 149 + config/X/xmonad/autostart/.cyclepaper.sh | 19 + config/X/xmonad/autostart/autostart.sh | 10 + config/X/xmonad/autostart/fehbg.sh | 2 + config/X/xmonad/autostart/getvolume.sh | 20 + config/X/xmonad/autostart/yt-not.sh | 63 + .../xmonad.disabled/autostart/.cyclepaper.sh | 19 + .../xmonad/xmonad.disabled/autostart/autostart.sh | 10 + config/X/xmonad/xmonad.disabled/autostart/fehbg.sh | 2 + .../xmonad/xmonad.disabled/autostart/getvolume.sh | 20 + .../X/xmonad/xmonad.disabled/autostart/yt-not.sh | 63 + config/X/xmonad/xmonad.disabled/xmonad.hs | 344 +++ config/X/xmonad/xmonad.hs | 344 +++ config/common/btop.conf | 212 ++ config/common/mpd/mpd.conf | 12 + config/common/ncmpcpp/bindings | 547 ++++ config/common/ncmpcpp/config | 598 ++++ config/common/ncmpcpp/error.log | 0 config/common/tmux/tmux.conf | 186 ++ config/essentials/git/config | 5 + config/essentials/gnupg/gpg-agent.conf | 2 + config/essentials/nvim/after/plugin/colorizer.lua | 6 + config/essentials/nvim/after/plugin/colors.lua | 16 + config/essentials/nvim/after/plugin/fugitive.lua | 1 + config/essentials/nvim/after/plugin/harpoon.lua | 10 + config/essentials/nvim/after/plugin/telescope.lua | 8 + config/essentials/nvim/after/plugin/treesitter.lua | 16 + config/essentials/nvim/after/plugin/undotree.lua | 1 + config/essentials/nvim/after/plugin/zk.lua | 6 + config/essentials/nvim/init.lua | 1 + config/essentials/nvim/lua/tlast/aucommands.vim | 21 + config/essentials/nvim/lua/tlast/cmp/arduino.lua | 3 + config/essentials/nvim/lua/tlast/cmp/clangd.lua | 2 + config/essentials/nvim/lua/tlast/cmp/css.lua | 1 + config/essentials/nvim/lua/tlast/cmp/emmet.lua | 1 + config/essentials/nvim/lua/tlast/cmp/html.lua | 7 + config/essentials/nvim/lua/tlast/cmp/init.lua | 10 + config/essentials/nvim/lua/tlast/cmp/js.lua | 1 + config/essentials/nvim/lua/tlast/cmp/lua.lua | 20 + config/essentials/nvim/lua/tlast/cmp/python.lua | 1 + config/essentials/nvim/lua/tlast/cmp/setup.lua | 47 + config/essentials/nvim/lua/tlast/init.lua | 6 + config/essentials/nvim/lua/tlast/packer.lua | 68 + config/essentials/nvim/lua/tlast/remap.lua | 62 + config/essentials/nvim/lua/tlast/set.lua | 36 + config/essentials/nvim/lua/tlast/zk.lua | 75 + config/essentials/nvim/templates/cpp.make | 4 + config/essentials/nvim/templates/main.cpp | 6 + config/essentials/zsh/aliases.zsh | 291 ++ config/essentials/zsh/functions.zsh | 79 + config/essentials/zsh/variables.zsh | 27 + config/extra/kdeglobals | 2 + config/extra/kitty/kitty.conf | 2128 ++++++++++++++ config/extra/kitty/nord.conf | 43 + config/extra/ktouch2rc | 5 + .../extra/mutt/configs/raymaekers.luca@gmail.com | 18 + config/extra/mutt/configs/tlast723@gmail.com | 18 + config/extra/mutt/configs/tlast@murena.io | 11 + config/extra/neofetch/config.conf | 864 ++++++ config/extra/pikaur.conf | 50 + config/old/cmus/playlists/default | 0 config/old/cmus/rc | 194 ++ config/old/code/Code | 1 + config/old/code/Code - OSS/User/keybindings.json | 32 + config/old/code/Code - OSS/User/settings.json | 21 + config/old/qutebrowser/autoconfig.yml | 10 + config/old/qutebrowser/bookmarks/urls | 0 config/old/qutebrowser/quickmarks | 0 config/old/spotifyd/spotifyd.conf | 13 + config/old/starship/starship.toml | 24 + config/old/tridactyl/tridactylrc | 211 ++ config/old/vim/.VimballRecord | 1 + config/old/vim/autoload/Colorizer.vim | 2397 ++++++++++++++++ config/old/vim/autoload/plug.vim | 2812 +++++++++++++++++++ config/old/vim/autoload/togglebg.vim | 47 + config/old/vim/colors/solarized.vim | 1117 ++++++++ config/old/vim/doc/Colorizer.txt | 432 +++ config/old/vim/doc/tags | 43 + config/old/vim/ftdetect/z80.vim | 1 + config/old/vim/indent/z80.vim | 35 + config/old/vim/syntax/bash.vim | 1 + config/old/vim/syntax/html.vim | 12 + config/old/vim/syntax/python.vim | 11 + config/old/vim/syntax/tibasic.vim | 21 + config/old/vim/syntax/z80.vim | 145 + config/old/vim/vimrc | 117 + config/theme/fontconfig/fonts.conf | 29 + config/theme/gtk-2.0/gtkfilechooser.ini | 11 + config/theme/gtk-2.0/gtkrc-2.0 | 18 + config/theme/gtk-3.0/bookmarks | 2 + config/theme/gtk-3.0/settings.ini | 15 + config/theme/mimeapps.list | 2 + config/theme/qt5ct/qt5ct.conf | 31 + config/zshrc/.zshrc | 97 + stowcmds.sh | 10 + 150 files changed, 23431 insertions(+) create mode 100755 bin/common/ask create mode 100755 bin/common/autofetch create mode 100755 bin/common/fzfdir create mode 100755 bin/common/fzfdirfile create mode 100755 bin/common/fzffile create mode 100755 bin/common/gign create mode 100755 bin/common/hextorgb create mode 100755 bin/common/wt create mode 100755 bin/dmscripts/dmapimg create mode 100755 bin/dmscripts/dmclip create mode 100755 bin/dmscripts/dmdsktp create mode 100755 bin/dmscripts/dmemoji create mode 100755 bin/dmscripts/dmfm create mode 100755 bin/dmscripts/dmhelp create mode 100755 bin/dmscripts/dminw create mode 100755 bin/dmscripts/dmlang create mode 100755 bin/dmscripts/dmpass create mode 100755 bin/dmscripts/dmpassgen create mode 100755 bin/dmscripts/dmpdf create mode 100755 bin/dmscripts/dmpower create mode 100755 bin/dmscripts/dmpsbm create mode 100755 bin/dmscripts/dmpsclip create mode 100755 bin/dmscripts/dmvid create mode 100755 bin/dmscripts/dmyt-not create mode 100755 bin/extra/arr_hjkl create mode 100755 bin/extra/cht.sh create mode 100755 bin/extra/colorscript create mode 100755 bin/extra/cycleKB create mode 100755 bin/extra/ehbtodl create mode 100644 bin/extra/keyboards.txt create mode 100755 bin/extra/vimastp create mode 100644 config/X/alacritty/alacritty.yml create mode 100644 config/X/dunst/dunstrc create mode 100644 config/X/mpv/input.conf create mode 100755 config/X/mpv/mpv.conf create mode 100755 config/X/mpv/playfile.txt create mode 100644 config/X/mpv/scripts/script-opts/webm.conf create mode 100755 config/X/mpv/scripts/script-opts/youtube-quality.conf create mode 100644 config/X/mpv/scripts/webm.lua create mode 100755 config/X/mpv/scripts/youtube-quality.lua create mode 100644 config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563 create mode 100644 config/X/picom/picom.conf create mode 100644 config/X/picom/picom.conf.bak create mode 100644 config/X/redshift/redshift.conf create mode 100644 config/X/x11/.Xauthority create mode 100755 config/X/x11/.Xresources create mode 100755 config/X/x11/xinitrc create mode 100644 config/X/xmobar/scripts/.updates.swp create mode 100755 config/X/xmobar/scripts/battery create mode 100755 config/X/xmobar/scripts/checkupds create mode 100755 config/X/xmobar/scripts/minwinfo create mode 100755 config/X/xmobar/scripts/whscreen create mode 100755 config/X/xmobar/scripts/winfo create mode 100644 config/X/xmobar/scripts/winfo_icons create mode 100644 config/X/xmobar/xmobarrc0.hs create mode 100644 config/X/xmobar/xmobarrc1.hs create mode 100755 config/X/xmonad/autostart/.cyclepaper.sh create mode 100755 config/X/xmonad/autostart/autostart.sh create mode 100755 config/X/xmonad/autostart/fehbg.sh create mode 100755 config/X/xmonad/autostart/getvolume.sh create mode 100755 config/X/xmonad/autostart/yt-not.sh create mode 100755 config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh create mode 100755 config/X/xmonad/xmonad.disabled/autostart/autostart.sh create mode 100755 config/X/xmonad/xmonad.disabled/autostart/fehbg.sh create mode 100755 config/X/xmonad/xmonad.disabled/autostart/getvolume.sh create mode 100755 config/X/xmonad/xmonad.disabled/autostart/yt-not.sh create mode 100644 config/X/xmonad/xmonad.disabled/xmonad.hs create mode 100644 config/X/xmonad/xmonad.hs create mode 100644 config/common/btop.conf create mode 100644 config/common/mpd/mpd.conf create mode 100644 config/common/ncmpcpp/bindings create mode 100644 config/common/ncmpcpp/config create mode 100644 config/common/ncmpcpp/error.log create mode 100755 config/common/tmux/tmux.conf create mode 100644 config/essentials/git/config create mode 100644 config/essentials/gnupg/gpg-agent.conf create mode 100644 config/essentials/nvim/after/plugin/colorizer.lua create mode 100644 config/essentials/nvim/after/plugin/colors.lua create mode 100644 config/essentials/nvim/after/plugin/fugitive.lua create mode 100644 config/essentials/nvim/after/plugin/harpoon.lua create mode 100644 config/essentials/nvim/after/plugin/telescope.lua create mode 100644 config/essentials/nvim/after/plugin/treesitter.lua create mode 100644 config/essentials/nvim/after/plugin/undotree.lua create mode 100644 config/essentials/nvim/after/plugin/zk.lua create mode 100644 config/essentials/nvim/init.lua create mode 100644 config/essentials/nvim/lua/tlast/aucommands.vim create mode 100755 config/essentials/nvim/lua/tlast/cmp/arduino.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/clangd.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/css.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/emmet.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/html.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/init.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/js.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/lua.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/python.lua create mode 100644 config/essentials/nvim/lua/tlast/cmp/setup.lua create mode 100644 config/essentials/nvim/lua/tlast/init.lua create mode 100644 config/essentials/nvim/lua/tlast/packer.lua create mode 100644 config/essentials/nvim/lua/tlast/remap.lua create mode 100644 config/essentials/nvim/lua/tlast/set.lua create mode 100644 config/essentials/nvim/lua/tlast/zk.lua create mode 100644 config/essentials/nvim/templates/cpp.make create mode 100644 config/essentials/nvim/templates/main.cpp create mode 100644 config/essentials/zsh/aliases.zsh create mode 100644 config/essentials/zsh/functions.zsh create mode 100644 config/essentials/zsh/variables.zsh create mode 100644 config/extra/kdeglobals create mode 100644 config/extra/kitty/kitty.conf create mode 100644 config/extra/kitty/nord.conf create mode 100644 config/extra/ktouch2rc create mode 100644 config/extra/mutt/configs/raymaekers.luca@gmail.com create mode 100644 config/extra/mutt/configs/tlast723@gmail.com create mode 100644 config/extra/mutt/configs/tlast@murena.io create mode 100644 config/extra/neofetch/config.conf create mode 100644 config/extra/pikaur.conf create mode 100755 config/old/cmus/playlists/default create mode 100755 config/old/cmus/rc create mode 120000 config/old/code/Code create mode 100644 config/old/code/Code - OSS/User/keybindings.json create mode 100644 config/old/code/Code - OSS/User/settings.json create mode 100644 config/old/qutebrowser/autoconfig.yml create mode 100644 config/old/qutebrowser/bookmarks/urls create mode 100644 config/old/qutebrowser/quickmarks create mode 100644 config/old/spotifyd/spotifyd.conf create mode 100644 config/old/starship/starship.toml create mode 100644 config/old/tridactyl/tridactylrc create mode 100644 config/old/vim/.VimballRecord create mode 100644 config/old/vim/autoload/Colorizer.vim create mode 100644 config/old/vim/autoload/plug.vim create mode 100644 config/old/vim/autoload/togglebg.vim create mode 100755 config/old/vim/colors/solarized.vim create mode 100644 config/old/vim/doc/Colorizer.txt create mode 100644 config/old/vim/doc/tags create mode 100644 config/old/vim/ftdetect/z80.vim create mode 100644 config/old/vim/indent/z80.vim create mode 100644 config/old/vim/syntax/bash.vim create mode 100644 config/old/vim/syntax/html.vim create mode 100644 config/old/vim/syntax/python.vim create mode 100644 config/old/vim/syntax/tibasic.vim create mode 100644 config/old/vim/syntax/z80.vim create mode 100755 config/old/vim/vimrc create mode 100644 config/theme/fontconfig/fonts.conf create mode 100644 config/theme/gtk-2.0/gtkfilechooser.ini create mode 100644 config/theme/gtk-2.0/gtkrc-2.0 create mode 100644 config/theme/gtk-3.0/bookmarks create mode 100644 config/theme/gtk-3.0/settings.ini create mode 100644 config/theme/mimeapps.list create mode 100644 config/theme/qt5ct/qt5ct.conf create mode 100644 config/zshrc/.zshrc create mode 100644 stowcmds.sh diff --git a/bin/common/ask b/bin/common/ask new file mode 100755 index 0000000..85b5f9e --- /dev/null +++ b/bin/common/ask @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Depends on passmenu +if [ -z "$1" ] +then + echo -n ">" + read prompt +else + prompt="$@" +fi + +API_KEY="$(pass tokens/openai-api)" + +data=$(echo \ +'{ + "prompt": "'"$prompt"'", + "model": "text-davinci-003", + "max_tokens": 1024, + "temperature": 0 +}') + +output=$(curl -s -X POST \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $API_KEY" \ + -d "$data" \ + https://api.openai.com/v1/completions \ + | jq -r '.choices[0].text') + +echo "${output:1}" diff --git a/bin/common/autofetch b/bin/common/autofetch new file mode 100755 index 0000000..3dcdc15 --- /dev/null +++ b/bin/common/autofetch @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +GREEN='\033[0;32m' +NC='\033[0m' +# Fetches for git repos, meant to run at startup +for directory in "." "installdrier" ".config" ".password-store" +do + if cd ~/$directory + then + echo -ne "Fetching in ${GREEN}'~/${directory}'${NC}" + git fetch origin || exit 1 + echo ", done." + fi +done diff --git a/bin/common/fzfdir b/bin/common/fzfdir new file mode 100755 index 0000000..6ae8f6a --- /dev/null +++ b/bin/common/fzfdir @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +find "${1:-$HOME}" -type \d 2> /dev/null | fzf diff --git a/bin/common/fzfdirfile b/bin/common/fzfdirfile new file mode 100755 index 0000000..df0e51a --- /dev/null +++ b/bin/common/fzfdirfile @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +dirname "$(find "${1:-$HOME}" -type f 2> /dev/null | fzf)" diff --git a/bin/common/fzffile b/bin/common/fzffile new file mode 100755 index 0000000..03e39be --- /dev/null +++ b/bin/common/fzffile @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +find "${1:-$HOME}" -type f 2> /dev/null | fzf diff --git a/bin/common/gign b/bin/common/gign new file mode 100755 index 0000000..e3ba12a --- /dev/null +++ b/bin/common/gign @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git status --porcelain=v1 | grep "^??" | cut -d' ' -f2- | sed -r 's/^["](.*)["]$/\1/' >> .gitignore diff --git a/bin/common/hextorgb b/bin/common/hextorgb new file mode 100755 index 0000000..b268db5 --- /dev/null +++ b/bin/common/hextorgb @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cat /dev/stdin \ + | tr -d '#' | tr '[:lower:]' '[:upper:]' \ + | sed -r 's/([0-9A-F]{2})/\1\n/g ; i ibase=16' \ + | bc \ + | tr '\n' ',' \ + | sed 's/.$// ; s/.*/rgb(&)/' diff --git a/bin/common/wt b/bin/common/wt new file mode 100755 index 0000000..81081c8 --- /dev/null +++ b/bin/common/wt @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "$@" > /tmp/truewhile.tmp +while true +do + bash /tmp/truewhile.tmp + sleep 1 + clear +done +rm /tmp/truewhile.tmp diff --git a/bin/dmscripts/dmapimg b/bin/dmscripts/dmapimg new file mode 100755 index 0000000..25c414b --- /dev/null +++ b/bin/dmscripts/dmapimg @@ -0,0 +1,6 @@ +#!/bin/bash +appimage="$(\ + find ~/.local/share/appimages -type f -printf "%f\n" \ + | sed 's/\.[Aa]pp[Ii]mage$//g' \ + | dmenu -x -l 10 -g 1 -p "AppImage:")" +setsid ~/AppImages/"${appimage:-NOSEL}"* diff --git a/bin/dmscripts/dmclip b/bin/dmscripts/dmclip new file mode 100755 index 0000000..5282b35 --- /dev/null +++ b/bin/dmscripts/dmclip @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +NotImage () { + echo -n "" | dmenu -p "NOT AN IMAGE" + exit +} + +# Display clipboard max length + +selection="$(echo -e "primary\nclipboard\nswap" | dmenu -l 1 -g 3 -p "selection:")" +if [[ "${selection}" == "swap" ]] +then + clipboard="$(xclip -o)" + xclip -o | xclip -sel c + echo -n "${clipboard}" | xclip -sel c + exit +elif [[ "${selection}" == "" ]] +then + exit 1 +fi +if "${selection}" == "primary" ]] +then + selection2="clipboard" +else + selection2="primary" +fi + + +clipboard="$(xclip -out -sel "${selection}" -r)" + +DICL_LEN=48 +if [[ "$(xclip -sel ${selection} -o | head -n1 | cut -c 2-4)" == "PNG" ]] +then + disp_clip="IMAGE" +else + disp_clip="$(echo -n "${clipboard}" | tr -d '\n' | cut -c -"${DICL_LEN}")" +fi + +menu_option="$(\ + echo -e "save\nload\nimage\nreplace" \ + | dmenu -l 1 -g 4 -p "'${disp_clip}'" \ +)" +[[ "${menu_option}" ]] || exit + +case "${menu_option}" in + + replace) + replace_text="$(echo -n "" | dmenu -l 0 -p "replace:")" + [[ "${replace_text}" ]] || exit + replace_by_text="$(echo -n "" | dmenu -l 0 -p "by:")" + [[ "${replace_by_text}" ]] || exit + echo "${clipboard}" \ + | sed "s/${replace_text}/${replace_by_text}/g" \ + | xclip -r -sel "${selection}" + ;; + + save) + echo "${clipboard}" >> /tmp/tmpclip.txt + ;; + load) + choice="$(\ + sort /tmp/tmpclip.txt \ + | uniq \ + | dmenu -g 1 -l 5 || exit \ + )" + echo -n "${choice}" | xclip -sel "${selection}" + ;; + + image) + # Menu + # 1: line from paragraph + # 2: param + # + file_name="tmp_xclip" + xclip -o -sel c > "/tmp/${file_name}.png" + file "/tmp/${file_name}.png" \ + | cut -d ':' -f 2 \ + | grep "image" || NotImage + # sed so that dmenu doesn't skip if one line + tesseract "/tmp/${file_name}.png" stdout > "/tmp/${file_name}" + sed "1i\ " "/tmp/${file_name}" | dmenu -l 10 -g 1 -p "PREVIEW:" -l 20 || exit + xclip -sel "${selection}" -in "/tmp/${file_name}" + ;; +esac diff --git a/bin/dmscripts/dmdsktp b/bin/dmscripts/dmdsktp new file mode 100755 index 0000000..2e0ef24 --- /dev/null +++ b/bin/dmscripts/dmdsktp @@ -0,0 +1,12 @@ +#!/bin/bash +# Searches through .desktop files and prompt to launch them via dmenu +gtk-launch \ + "$(\ + find ~/.local/share/applications \ + -maxdepth 1 \ + -type f \ + -not -iname "wine-extension*" -a -iname "*.desktop" \ + -printf "%f\n" \ + | cut -d. -f1 \ + | dmenu -i -p "app:" -g 1 \ + )" diff --git a/bin/dmscripts/dmemoji b/bin/dmscripts/dmemoji new file mode 100755 index 0000000..6211463 --- /dev/null +++ b/bin/dmscripts/dmemoji @@ -0,0 +1,1423 @@ +#!/bin/bash +# This files comes from: +# https://github.com/porras/dmenu-emoji +# +# If this file includes emojis below "__DATA__" it is generated. +# This file was generated: 2022-04-21 12:38:03+00:00 + +set -e + +case "$1" in + "list") + data=$(sed '0,/^__DATA__$/d' "$0") + echo "$data" + ;; + "copy") + input=$(tee) + if [ ! -z "$input" ]; then + emoji=${input: -1} + echo -n "$emoji" | xclip -selection c + dunstify "dmemoji" "$emoji copied!" + fi + ;; + "") + bash $0 list | dmenu -p 'Emoji: ' | bash $0 copy + ;; +esac + +exit + +__DATA__ +grinning face ๐Ÿ˜€ +grinning face with big eyes ๐Ÿ˜ƒ +grinning face with smiling eyes ๐Ÿ˜„ +beaming face with smiling eyes ๐Ÿ˜ +grinning squinting face ๐Ÿ˜† +grinning face with sweat ๐Ÿ˜… +rolling on the floor laughing ๐Ÿคฃ +face with tears of joy ๐Ÿ˜‚ +slightly smiling face ๐Ÿ™‚ +upside-down face ๐Ÿ™ƒ +melting face ๐Ÿซ  +winking face ๐Ÿ˜‰ +smiling face with smiling eyes ๐Ÿ˜Š +smiling face with halo ๐Ÿ˜‡ +smiling face with hearts ๐Ÿฅฐ +smiling face with heart-eyes ๐Ÿ˜ +star-struck ๐Ÿคฉ +face blowing a kiss ๐Ÿ˜˜ +kissing face ๐Ÿ˜— +smiling face โ˜บ +kissing face with closed eyes ๐Ÿ˜š +kissing face with smiling eyes ๐Ÿ˜™ +smiling face with tear ๐Ÿฅฒ +face savoring food ๐Ÿ˜‹ +face with tongue ๐Ÿ˜› +winking face with tongue ๐Ÿ˜œ +zany face ๐Ÿคช +squinting face with tongue ๐Ÿ˜ +money-mouth face ๐Ÿค‘ +smiling face with open hands ๐Ÿค— +face with hand over mouth ๐Ÿคญ +face with open eyes and hand over mouth ๐Ÿซข +face with peeking eye ๐Ÿซฃ +shushing face ๐Ÿคซ +thinking face ๐Ÿค” +saluting face ๐Ÿซก +zipper-mouth face ๐Ÿค +face with raised eyebrow ๐Ÿคจ +neutral face ๐Ÿ˜ +expressionless face ๐Ÿ˜‘ +face without mouth ๐Ÿ˜ถ +dotted line face ๐Ÿซฅ +smirking face ๐Ÿ˜ +unamused face ๐Ÿ˜’ +face with rolling eyes ๐Ÿ™„ +grimacing face ๐Ÿ˜ฌ +lying face ๐Ÿคฅ +relieved face ๐Ÿ˜Œ +pensive face ๐Ÿ˜” +sleepy face ๐Ÿ˜ช +drooling face ๐Ÿคค +sleeping face ๐Ÿ˜ด +face with medical mask ๐Ÿ˜ท +face with thermometer ๐Ÿค’ +face with head-bandage ๐Ÿค• +nauseated face ๐Ÿคข +face vomiting ๐Ÿคฎ +sneezing face ๐Ÿคง +hot face ๐Ÿฅต +cold face ๐Ÿฅถ +woozy face ๐Ÿฅด +face with crossed-out eyes ๐Ÿ˜ต +exploding head ๐Ÿคฏ +cowboy hat face ๐Ÿค  +partying face ๐Ÿฅณ +disguised face ๐Ÿฅธ +smiling face with sunglasses ๐Ÿ˜Ž +nerd face ๐Ÿค“ +face with monocle ๐Ÿง +confused face ๐Ÿ˜• +face with diagonal mouth ๐Ÿซค +worried face ๐Ÿ˜Ÿ +slightly frowning face ๐Ÿ™ +frowning face โ˜น +face with open mouth ๐Ÿ˜ฎ +hushed face ๐Ÿ˜ฏ +astonished face ๐Ÿ˜ฒ +flushed face ๐Ÿ˜ณ +pleading face ๐Ÿฅบ +face holding back tears ๐Ÿฅน +frowning face with open mouth ๐Ÿ˜ฆ +anguished face ๐Ÿ˜ง +fearful face ๐Ÿ˜จ +anxious face with sweat ๐Ÿ˜ฐ +sad but relieved face ๐Ÿ˜ฅ +crying face ๐Ÿ˜ข +loudly crying face ๐Ÿ˜ญ +face screaming in fear ๐Ÿ˜ฑ +confounded face ๐Ÿ˜– +persevering face ๐Ÿ˜ฃ +disappointed face ๐Ÿ˜ž +downcast face with sweat ๐Ÿ˜“ +weary face ๐Ÿ˜ฉ +tired face ๐Ÿ˜ซ +yawning face ๐Ÿฅฑ +face with steam from nose ๐Ÿ˜ค +pouting face ๐Ÿ˜ก +angry face ๐Ÿ˜  +face with symbols on mouth ๐Ÿคฌ +smiling face with horns ๐Ÿ˜ˆ +angry face with horns ๐Ÿ‘ฟ +skull ๐Ÿ’€ +skull and crossbones โ˜  +pile of poo ๐Ÿ’ฉ +clown face ๐Ÿคก +ogre ๐Ÿ‘น +goblin ๐Ÿ‘บ +ghost ๐Ÿ‘ป +alien ๐Ÿ‘ฝ +alien monster ๐Ÿ‘พ +robot ๐Ÿค– +grinning cat ๐Ÿ˜บ +grinning cat with smiling eyes ๐Ÿ˜ธ +cat with tears of joy ๐Ÿ˜น +smiling cat with heart-eyes ๐Ÿ˜ป +cat with wry smile ๐Ÿ˜ผ +kissing cat ๐Ÿ˜ฝ +weary cat ๐Ÿ™€ +crying cat ๐Ÿ˜ฟ +pouting cat ๐Ÿ˜พ +see-no-evil monkey ๐Ÿ™ˆ +hear-no-evil monkey ๐Ÿ™‰ +speak-no-evil monkey ๐Ÿ™Š +kiss mark ๐Ÿ’‹ +love letter ๐Ÿ’Œ +heart with arrow ๐Ÿ’˜ +heart with ribbon ๐Ÿ’ +sparkling heart ๐Ÿ’– +growing heart ๐Ÿ’— +beating heart ๐Ÿ’“ +revolving hearts ๐Ÿ’ž +two hearts ๐Ÿ’• +heart decoration ๐Ÿ’Ÿ +heart exclamation โฃ +broken heart ๐Ÿ’” +red heart โค +orange heart ๐Ÿงก +yellow heart ๐Ÿ’› +green heart ๐Ÿ’š +blue heart ๐Ÿ’™ +purple heart ๐Ÿ’œ +brown heart ๐ŸคŽ +black heart ๐Ÿ–ค +white heart ๐Ÿค +hundred points ๐Ÿ’ฏ +anger symbol ๐Ÿ’ข +collision ๐Ÿ’ฅ +dizzy ๐Ÿ’ซ +sweat droplets ๐Ÿ’ฆ +dashing away ๐Ÿ’จ +hole ๐Ÿ•ณ +bomb ๐Ÿ’ฃ +speech balloon ๐Ÿ’ฌ +left speech bubble ๐Ÿ—จ +right anger bubble ๐Ÿ—ฏ +thought balloon ๐Ÿ’ญ +zzz ๐Ÿ’ค +waving hand ๐Ÿ‘‹ +raised back of hand ๐Ÿคš +hand with fingers splayed ๐Ÿ– +raised hand โœ‹ +vulcan salute ๐Ÿ–– +rightwards hand ๐Ÿซฑ +leftwards hand ๐Ÿซฒ +palm down hand ๐Ÿซณ +palm up hand ๐Ÿซด +OK hand ๐Ÿ‘Œ +pinched fingers ๐ŸคŒ +pinching hand ๐Ÿค +victory hand โœŒ +crossed fingers ๐Ÿคž +hand with index finger and thumb crossed ๐Ÿซฐ +love-you gesture ๐ŸคŸ +sign of the horns ๐Ÿค˜ +call me hand ๐Ÿค™ +backhand index pointing left ๐Ÿ‘ˆ +backhand index pointing right ๐Ÿ‘‰ +backhand index pointing up ๐Ÿ‘† +middle finger ๐Ÿ–• +backhand index pointing down ๐Ÿ‘‡ +index pointing up โ˜ +index pointing at the viewer ๐Ÿซต +thumbs up ๐Ÿ‘ +thumbs down ๐Ÿ‘Ž +raised fist โœŠ +oncoming fist ๐Ÿ‘Š +left-facing fist ๐Ÿค› +right-facing fist ๐Ÿคœ +clapping hands ๐Ÿ‘ +raising hands ๐Ÿ™Œ +heart hands ๐Ÿซถ +open hands ๐Ÿ‘ +palms up together ๐Ÿคฒ +handshake ๐Ÿค +folded hands ๐Ÿ™ +writing hand โœ +nail polish ๐Ÿ’… +selfie ๐Ÿคณ +flexed biceps ๐Ÿ’ช +mechanical arm ๐Ÿฆพ +mechanical leg ๐Ÿฆฟ +leg ๐Ÿฆต +foot ๐Ÿฆถ +ear ๐Ÿ‘‚ +ear with hearing aid ๐Ÿฆป +nose ๐Ÿ‘ƒ +brain ๐Ÿง  +anatomical heart ๐Ÿซ€ +lungs ๐Ÿซ +tooth ๐Ÿฆท +bone ๐Ÿฆด +eyes ๐Ÿ‘€ +eye ๐Ÿ‘ +tongue ๐Ÿ‘… +mouth ๐Ÿ‘„ +biting lip ๐Ÿซฆ +baby ๐Ÿ‘ถ +child ๐Ÿง’ +boy ๐Ÿ‘ฆ +girl ๐Ÿ‘ง +person ๐Ÿง‘ +person: blond hair ๐Ÿ‘ฑ +man ๐Ÿ‘จ +person: beard ๐Ÿง” +woman ๐Ÿ‘ฉ +older person ๐Ÿง“ +old man ๐Ÿ‘ด +old woman ๐Ÿ‘ต +person frowning ๐Ÿ™ +person pouting ๐Ÿ™Ž +person gesturing NO ๐Ÿ™… +deaf person ๐Ÿง +person bowing ๐Ÿ™‡ +person facepalming ๐Ÿคฆ +person shrugging ๐Ÿคท +police officer ๐Ÿ‘ฎ +detective ๐Ÿ•ต +guard ๐Ÿ’‚ +ninja ๐Ÿฅท +construction worker ๐Ÿ‘ท +person with crown ๐Ÿซ… +prince ๐Ÿคด +princess ๐Ÿ‘ธ +person wearing turban ๐Ÿ‘ณ +person with skullcap ๐Ÿ‘ฒ +woman with headscarf ๐Ÿง• +person in tuxedo ๐Ÿคต +person with veil ๐Ÿ‘ฐ +pregnant woman ๐Ÿคฐ +pregnant man ๐Ÿซƒ +pregnant person ๐Ÿซ„ +breast-feeding ๐Ÿคฑ +baby angel ๐Ÿ‘ผ +Santa Claus ๐ŸŽ… +Mrs. Claus ๐Ÿคถ +superhero ๐Ÿฆธ +supervillain ๐Ÿฆน +mage ๐Ÿง™ +fairy ๐Ÿงš +vampire ๐Ÿง› +merperson ๐Ÿงœ +elf ๐Ÿง +genie ๐Ÿงž +zombie ๐ŸงŸ +troll ๐ŸงŒ +person getting massage ๐Ÿ’† +person getting haircut ๐Ÿ’‡ +person walking ๐Ÿšถ +person standing ๐Ÿง +person kneeling ๐ŸงŽ +person running ๐Ÿƒ +woman dancing ๐Ÿ’ƒ +man dancing ๐Ÿ•บ +person in suit levitating ๐Ÿ•ด +people with bunny ears ๐Ÿ‘ฏ +person in steamy room ๐Ÿง– +person climbing ๐Ÿง— +person fencing ๐Ÿคบ +horse racing ๐Ÿ‡ +skier โ›ท +snowboarder ๐Ÿ‚ +person golfing ๐ŸŒ +person surfing ๐Ÿ„ +person rowing boat ๐Ÿšฃ +person swimming ๐ŸŠ +person bouncing ball โ›น +person lifting weights ๐Ÿ‹ +person biking ๐Ÿšด +person mountain biking ๐Ÿšต +person cartwheeling ๐Ÿคธ +people wrestling ๐Ÿคผ +person playing water polo ๐Ÿคฝ +person playing handball ๐Ÿคพ +person juggling ๐Ÿคน +person in lotus position ๐Ÿง˜ +person taking bath ๐Ÿ›€ +person in bed ๐Ÿ›Œ +women holding hands ๐Ÿ‘ญ +woman and man holding hands ๐Ÿ‘ซ +men holding hands ๐Ÿ‘ฌ +kiss ๐Ÿ’ +couple with heart ๐Ÿ’‘ +family ๐Ÿ‘ช +speaking head ๐Ÿ—ฃ +bust in silhouette ๐Ÿ‘ค +busts in silhouette ๐Ÿ‘ฅ +people hugging ๐Ÿซ‚ +footprints ๐Ÿ‘ฃ +red hair ๐Ÿฆฐ +curly hair ๐Ÿฆฑ +white hair ๐Ÿฆณ +bald ๐Ÿฆฒ +monkey face ๐Ÿต +monkey ๐Ÿ’ +gorilla ๐Ÿฆ +orangutan ๐Ÿฆง +dog face ๐Ÿถ +dog ๐Ÿ• +guide dog ๐Ÿฆฎ +poodle ๐Ÿฉ +wolf ๐Ÿบ +fox ๐ŸฆŠ +raccoon ๐Ÿฆ +cat face ๐Ÿฑ +cat ๐Ÿˆ +lion ๐Ÿฆ +tiger face ๐Ÿฏ +tiger ๐Ÿ… +leopard ๐Ÿ† +horse face ๐Ÿด +horse ๐ŸŽ +unicorn ๐Ÿฆ„ +zebra ๐Ÿฆ“ +deer ๐ŸฆŒ +bison ๐Ÿฆฌ +cow face ๐Ÿฎ +ox ๐Ÿ‚ +water buffalo ๐Ÿƒ +cow ๐Ÿ„ +pig face ๐Ÿท +pig ๐Ÿ– +boar ๐Ÿ— +pig nose ๐Ÿฝ +ram ๐Ÿ +ewe ๐Ÿ‘ +goat ๐Ÿ +camel ๐Ÿช +two-hump camel ๐Ÿซ +llama ๐Ÿฆ™ +giraffe ๐Ÿฆ’ +elephant ๐Ÿ˜ +mammoth ๐Ÿฆฃ +rhinoceros ๐Ÿฆ +hippopotamus ๐Ÿฆ› +mouse face ๐Ÿญ +mouse ๐Ÿ +rat ๐Ÿ€ +hamster ๐Ÿน +rabbit face ๐Ÿฐ +rabbit ๐Ÿ‡ +chipmunk ๐Ÿฟ +beaver ๐Ÿฆซ +hedgehog ๐Ÿฆ” +bat ๐Ÿฆ‡ +bear ๐Ÿป +koala ๐Ÿจ +panda ๐Ÿผ +sloth ๐Ÿฆฅ +otter ๐Ÿฆฆ +skunk ๐Ÿฆจ +kangaroo ๐Ÿฆ˜ +badger ๐Ÿฆก +paw prints ๐Ÿพ +turkey ๐Ÿฆƒ +chicken ๐Ÿ” +rooster ๐Ÿ“ +hatching chick ๐Ÿฃ +baby chick ๐Ÿค +front-facing baby chick ๐Ÿฅ +bird ๐Ÿฆ +penguin ๐Ÿง +dove ๐Ÿ•Š +eagle ๐Ÿฆ… +duck ๐Ÿฆ† +swan ๐Ÿฆข +owl ๐Ÿฆ‰ +dodo ๐Ÿฆค +feather ๐Ÿชถ +flamingo ๐Ÿฆฉ +peacock ๐Ÿฆš +parrot ๐Ÿฆœ +frog ๐Ÿธ +crocodile ๐ŸŠ +turtle ๐Ÿข +lizard ๐ŸฆŽ +snake ๐Ÿ +dragon face ๐Ÿฒ +dragon ๐Ÿ‰ +sauropod ๐Ÿฆ• +T-Rex ๐Ÿฆ– +spouting whale ๐Ÿณ +whale ๐Ÿ‹ +dolphin ๐Ÿฌ +seal ๐Ÿฆญ +fish ๐ŸŸ +tropical fish ๐Ÿ  +blowfish ๐Ÿก +shark ๐Ÿฆˆ +octopus ๐Ÿ™ +spiral shell ๐Ÿš +coral ๐Ÿชธ +snail ๐ŸŒ +butterfly ๐Ÿฆ‹ +bug ๐Ÿ› +ant ๐Ÿœ +honeybee ๐Ÿ +beetle ๐Ÿชฒ +lady beetle ๐Ÿž +cricket ๐Ÿฆ— +cockroach ๐Ÿชณ +spider ๐Ÿ•ท +spider web ๐Ÿ•ธ +scorpion ๐Ÿฆ‚ +mosquito ๐ŸฆŸ +fly ๐Ÿชฐ +worm ๐Ÿชฑ +microbe ๐Ÿฆ  +bouquet ๐Ÿ’ +cherry blossom ๐ŸŒธ +white flower ๐Ÿ’ฎ +lotus ๐Ÿชท +rosette ๐Ÿต +rose ๐ŸŒน +wilted flower ๐Ÿฅ€ +hibiscus ๐ŸŒบ +sunflower ๐ŸŒป +blossom ๐ŸŒผ +tulip ๐ŸŒท +seedling ๐ŸŒฑ +potted plant ๐Ÿชด +evergreen tree ๐ŸŒฒ +deciduous tree ๐ŸŒณ +palm tree ๐ŸŒด +cactus ๐ŸŒต +sheaf of rice ๐ŸŒพ +herb ๐ŸŒฟ +shamrock โ˜˜ +four leaf clover ๐Ÿ€ +maple leaf ๐Ÿ +fallen leaf ๐Ÿ‚ +leaf fluttering in wind ๐Ÿƒ +empty nest ๐Ÿชน +nest with eggs ๐Ÿชบ +grapes ๐Ÿ‡ +melon ๐Ÿˆ +watermelon ๐Ÿ‰ +tangerine ๐ŸŠ +lemon ๐Ÿ‹ +banana ๐ŸŒ +pineapple ๐Ÿ +mango ๐Ÿฅญ +red apple ๐ŸŽ +green apple ๐Ÿ +pear ๐Ÿ +peach ๐Ÿ‘ +cherries ๐Ÿ’ +strawberry ๐Ÿ“ +blueberries ๐Ÿซ +kiwi fruit ๐Ÿฅ +tomato ๐Ÿ… +olive ๐Ÿซ’ +coconut ๐Ÿฅฅ +avocado ๐Ÿฅ‘ +eggplant ๐Ÿ† +potato ๐Ÿฅ” +carrot ๐Ÿฅ• +ear of corn ๐ŸŒฝ +hot pepper ๐ŸŒถ +bell pepper ๐Ÿซ‘ +cucumber ๐Ÿฅ’ +leafy green ๐Ÿฅฌ +broccoli ๐Ÿฅฆ +garlic ๐Ÿง„ +onion ๐Ÿง… +mushroom ๐Ÿ„ +peanuts ๐Ÿฅœ +beans ๐Ÿซ˜ +chestnut ๐ŸŒฐ +bread ๐Ÿž +croissant ๐Ÿฅ +baguette bread ๐Ÿฅ– +flatbread ๐Ÿซ“ +pretzel ๐Ÿฅจ +bagel ๐Ÿฅฏ +pancakes ๐Ÿฅž +waffle ๐Ÿง‡ +cheese wedge ๐Ÿง€ +meat on bone ๐Ÿ– +poultry leg ๐Ÿ— +cut of meat ๐Ÿฅฉ +bacon ๐Ÿฅ“ +hamburger ๐Ÿ” +french fries ๐ŸŸ +pizza ๐Ÿ• +hot dog ๐ŸŒญ +sandwich ๐Ÿฅช +taco ๐ŸŒฎ +burrito ๐ŸŒฏ +tamale ๐Ÿซ” +stuffed flatbread ๐Ÿฅ™ +falafel ๐Ÿง† +egg ๐Ÿฅš +cooking ๐Ÿณ +shallow pan of food ๐Ÿฅ˜ +pot of food ๐Ÿฒ +fondue ๐Ÿซ• +bowl with spoon ๐Ÿฅฃ +green salad ๐Ÿฅ— +popcorn ๐Ÿฟ +butter ๐Ÿงˆ +salt ๐Ÿง‚ +canned food ๐Ÿฅซ +bento box ๐Ÿฑ +rice cracker ๐Ÿ˜ +rice ball ๐Ÿ™ +cooked rice ๐Ÿš +curry rice ๐Ÿ› +steaming bowl ๐Ÿœ +spaghetti ๐Ÿ +roasted sweet potato ๐Ÿ  +oden ๐Ÿข +sushi ๐Ÿฃ +fried shrimp ๐Ÿค +fish cake with swirl ๐Ÿฅ +moon cake ๐Ÿฅฎ +dango ๐Ÿก +dumpling ๐ŸฅŸ +fortune cookie ๐Ÿฅ  +takeout box ๐Ÿฅก +crab ๐Ÿฆ€ +lobster ๐Ÿฆž +shrimp ๐Ÿฆ +squid ๐Ÿฆ‘ +oyster ๐Ÿฆช +soft ice cream ๐Ÿฆ +shaved ice ๐Ÿง +ice cream ๐Ÿจ +doughnut ๐Ÿฉ +cookie ๐Ÿช +birthday cake ๐ŸŽ‚ +shortcake ๐Ÿฐ +cupcake ๐Ÿง +pie ๐Ÿฅง +chocolate bar ๐Ÿซ +candy ๐Ÿฌ +lollipop ๐Ÿญ +custard ๐Ÿฎ +honey pot ๐Ÿฏ +baby bottle ๐Ÿผ +glass of milk ๐Ÿฅ› +hot beverage โ˜• +teapot ๐Ÿซ– +teacup without handle ๐Ÿต +sake ๐Ÿถ +bottle with popping cork ๐Ÿพ +wine glass ๐Ÿท +cocktail glass ๐Ÿธ +tropical drink ๐Ÿน +beer mug ๐Ÿบ +clinking beer mugs ๐Ÿป +clinking glasses ๐Ÿฅ‚ +tumbler glass ๐Ÿฅƒ +pouring liquid ๐Ÿซ— +cup with straw ๐Ÿฅค +bubble tea ๐Ÿง‹ +beverage box ๐Ÿงƒ +mate ๐Ÿง‰ +ice ๐ŸงŠ +chopsticks ๐Ÿฅข +fork and knife with plate ๐Ÿฝ +fork and knife ๐Ÿด +spoon ๐Ÿฅ„ +kitchen knife ๐Ÿ”ช +jar ๐Ÿซ™ +amphora ๐Ÿบ +globe showing Europe-Africa ๐ŸŒ +globe showing Americas ๐ŸŒŽ +globe showing Asia-Australia ๐ŸŒ +globe with meridians ๐ŸŒ +world map ๐Ÿ—บ +map of Japan ๐Ÿ—พ +compass ๐Ÿงญ +snow-capped mountain ๐Ÿ” +mountain โ›ฐ +volcano ๐ŸŒ‹ +mount fuji ๐Ÿ—ป +camping ๐Ÿ• +beach with umbrella ๐Ÿ– +desert ๐Ÿœ +desert island ๐Ÿ +national park ๐Ÿž +stadium ๐ŸŸ +classical building ๐Ÿ› +building construction ๐Ÿ— +brick ๐Ÿงฑ +rock ๐Ÿชจ +wood ๐Ÿชต +hut ๐Ÿ›– +houses ๐Ÿ˜ +derelict house ๐Ÿš +house ๐Ÿ  +house with garden ๐Ÿก +office building ๐Ÿข +Japanese post office ๐Ÿฃ +post office ๐Ÿค +hospital ๐Ÿฅ +bank ๐Ÿฆ +hotel ๐Ÿจ +love hotel ๐Ÿฉ +convenience store ๐Ÿช +school ๐Ÿซ +department store ๐Ÿฌ +factory ๐Ÿญ +Japanese castle ๐Ÿฏ +castle ๐Ÿฐ +wedding ๐Ÿ’’ +Tokyo tower ๐Ÿ—ผ +Statue of Liberty ๐Ÿ—ฝ +church โ›ช +mosque ๐Ÿ•Œ +hindu temple ๐Ÿ›• +synagogue ๐Ÿ• +shinto shrine โ›ฉ +kaaba ๐Ÿ•‹ +fountain โ›ฒ +tent โ›บ +foggy ๐ŸŒ +night with stars ๐ŸŒƒ +cityscape ๐Ÿ™ +sunrise over mountains ๐ŸŒ„ +sunrise ๐ŸŒ… +cityscape at dusk ๐ŸŒ† +sunset ๐ŸŒ‡ +bridge at night ๐ŸŒ‰ +hot springs โ™จ +carousel horse ๐ŸŽ  +playground slide ๐Ÿ› +ferris wheel ๐ŸŽก +roller coaster ๐ŸŽข +barber pole ๐Ÿ’ˆ +circus tent ๐ŸŽช +locomotive ๐Ÿš‚ +railway car ๐Ÿšƒ +high-speed train ๐Ÿš„ +bullet train ๐Ÿš… +train ๐Ÿš† +metro ๐Ÿš‡ +light rail ๐Ÿšˆ +station ๐Ÿš‰ +tram ๐ŸšŠ +monorail ๐Ÿš +mountain railway ๐Ÿšž +tram car ๐Ÿš‹ +bus ๐ŸšŒ +oncoming bus ๐Ÿš +trolleybus ๐ŸšŽ +minibus ๐Ÿš +ambulance ๐Ÿš‘ +fire engine ๐Ÿš’ +police car ๐Ÿš“ +oncoming police car ๐Ÿš” +taxi ๐Ÿš• +oncoming taxi ๐Ÿš– +automobile ๐Ÿš— +oncoming automobile ๐Ÿš˜ +sport utility vehicle ๐Ÿš™ +pickup truck ๐Ÿ›ป +delivery truck ๐Ÿšš +articulated lorry ๐Ÿš› +tractor ๐Ÿšœ +racing car ๐ŸŽ +motorcycle ๐Ÿ +motor scooter ๐Ÿ›ต +manual wheelchair ๐Ÿฆฝ +motorized wheelchair ๐Ÿฆผ +auto rickshaw ๐Ÿ›บ +bicycle ๐Ÿšฒ +kick scooter ๐Ÿ›ด +skateboard ๐Ÿ›น +roller skate ๐Ÿ›ผ +bus stop ๐Ÿš +motorway ๐Ÿ›ฃ +railway track ๐Ÿ›ค +oil drum ๐Ÿ›ข +fuel pump โ›ฝ +wheel ๐Ÿ›ž +police car light ๐Ÿšจ +horizontal traffic light ๐Ÿšฅ +vertical traffic light ๐Ÿšฆ +stop sign ๐Ÿ›‘ +construction ๐Ÿšง +anchor โš“ +ring buoy ๐Ÿ›Ÿ +sailboat โ›ต +canoe ๐Ÿ›ถ +speedboat ๐Ÿšค +passenger ship ๐Ÿ›ณ +ferry โ›ด +motor boat ๐Ÿ›ฅ +ship ๐Ÿšข +airplane โœˆ +small airplane ๐Ÿ›ฉ +airplane departure ๐Ÿ›ซ +airplane arrival ๐Ÿ›ฌ +parachute ๐Ÿช‚ +seat ๐Ÿ’บ +helicopter ๐Ÿš +suspension railway ๐ŸšŸ +mountain cableway ๐Ÿš  +aerial tramway ๐Ÿšก +satellite ๐Ÿ›ฐ +rocket ๐Ÿš€ +flying saucer ๐Ÿ›ธ +bellhop bell ๐Ÿ›Ž +luggage ๐Ÿงณ +hourglass done โŒ› +hourglass not done โณ +watch โŒš +alarm clock โฐ +stopwatch โฑ +timer clock โฒ +mantelpiece clock ๐Ÿ•ฐ +twelve oโ€™clock ๐Ÿ•› +twelve-thirty ๐Ÿ•ง +one oโ€™clock ๐Ÿ• +one-thirty ๐Ÿ•œ +two oโ€™clock ๐Ÿ•‘ +two-thirty ๐Ÿ• +three oโ€™clock ๐Ÿ•’ +three-thirty ๐Ÿ•ž +four oโ€™clock ๐Ÿ•“ +four-thirty ๐Ÿ•Ÿ +five oโ€™clock ๐Ÿ•” +five-thirty ๐Ÿ•  +six oโ€™clock ๐Ÿ•• +six-thirty ๐Ÿ•ก +seven oโ€™clock ๐Ÿ•– +seven-thirty ๐Ÿ•ข +eight oโ€™clock ๐Ÿ•— +eight-thirty ๐Ÿ•ฃ +nine oโ€™clock ๐Ÿ•˜ +nine-thirty ๐Ÿ•ค +ten oโ€™clock ๐Ÿ•™ +ten-thirty ๐Ÿ•ฅ +eleven oโ€™clock ๐Ÿ•š +eleven-thirty ๐Ÿ•ฆ +new moon ๐ŸŒ‘ +waxing crescent moon ๐ŸŒ’ +first quarter moon ๐ŸŒ“ +waxing gibbous moon ๐ŸŒ” +full moon ๐ŸŒ• +waning gibbous moon ๐ŸŒ– +last quarter moon ๐ŸŒ— +waning crescent moon ๐ŸŒ˜ +crescent moon ๐ŸŒ™ +new moon face ๐ŸŒš +first quarter moon face ๐ŸŒ› +last quarter moon face ๐ŸŒœ +thermometer ๐ŸŒก +sun โ˜€ +full moon face ๐ŸŒ +sun with face ๐ŸŒž +ringed planet ๐Ÿช +star โญ +glowing star ๐ŸŒŸ +shooting star ๐ŸŒ  +milky way ๐ŸŒŒ +cloud โ˜ +sun behind cloud โ›… +cloud with lightning and rain โ›ˆ +sun behind small cloud ๐ŸŒค +sun behind large cloud ๐ŸŒฅ +sun behind rain cloud ๐ŸŒฆ +cloud with rain ๐ŸŒง +cloud with snow ๐ŸŒจ +cloud with lightning ๐ŸŒฉ +tornado ๐ŸŒช +fog ๐ŸŒซ +wind face ๐ŸŒฌ +cyclone ๐ŸŒ€ +rainbow ๐ŸŒˆ +closed umbrella ๐ŸŒ‚ +umbrella โ˜‚ +umbrella with rain drops โ˜” +umbrella on ground โ›ฑ +high voltage โšก +snowflake โ„ +snowman โ˜ƒ +snowman without snow โ›„ +comet โ˜„ +fire ๐Ÿ”ฅ +droplet ๐Ÿ’ง +water wave ๐ŸŒŠ +jack-o-lantern ๐ŸŽƒ +Christmas tree ๐ŸŽ„ +fireworks ๐ŸŽ† +sparkler ๐ŸŽ‡ +firecracker ๐Ÿงจ +sparkles โœจ +balloon ๐ŸŽˆ +party popper ๐ŸŽ‰ +confetti ball ๐ŸŽŠ +tanabata tree ๐ŸŽ‹ +pine decoration ๐ŸŽ +Japanese dolls ๐ŸŽŽ +carp streamer ๐ŸŽ +wind chime ๐ŸŽ +moon viewing ceremony ๐ŸŽ‘ +red envelope ๐Ÿงง +ribbon ๐ŸŽ€ +wrapped gift ๐ŸŽ +reminder ribbon ๐ŸŽ— +admission tickets ๐ŸŽŸ +ticket ๐ŸŽซ +military medal ๐ŸŽ– +trophy ๐Ÿ† +sports medal ๐Ÿ… +1st place medal ๐Ÿฅ‡ +2nd place medal ๐Ÿฅˆ +3rd place medal ๐Ÿฅ‰ +soccer ball โšฝ +baseball โšพ +softball ๐ŸฅŽ +basketball ๐Ÿ€ +volleyball ๐Ÿ +american football ๐Ÿˆ +rugby football ๐Ÿ‰ +tennis ๐ŸŽพ +flying disc ๐Ÿฅ +bowling ๐ŸŽณ +cricket game ๐Ÿ +field hockey ๐Ÿ‘ +ice hockey ๐Ÿ’ +lacrosse ๐Ÿฅ +ping pong ๐Ÿ“ +badminton ๐Ÿธ +boxing glove ๐ŸฅŠ +martial arts uniform ๐Ÿฅ‹ +goal net ๐Ÿฅ… +flag in hole โ›ณ +ice skate โ›ธ +fishing pole ๐ŸŽฃ +diving mask ๐Ÿคฟ +running shirt ๐ŸŽฝ +skis ๐ŸŽฟ +sled ๐Ÿ›ท +curling stone ๐ŸฅŒ +bullseye ๐ŸŽฏ +yo-yo ๐Ÿช€ +kite ๐Ÿช +pool 8 ball ๐ŸŽฑ +crystal ball ๐Ÿ”ฎ +magic wand ๐Ÿช„ +nazar amulet ๐Ÿงฟ +hamsa ๐Ÿชฌ +video game ๐ŸŽฎ +joystick ๐Ÿ•น +slot machine ๐ŸŽฐ +game die ๐ŸŽฒ +puzzle piece ๐Ÿงฉ +teddy bear ๐Ÿงธ +piรฑata ๐Ÿช… +mirror ball ๐Ÿชฉ +nesting dolls ๐Ÿช† +spade suit โ™  +heart suit โ™ฅ +diamond suit โ™ฆ +club suit โ™ฃ +chess pawn โ™Ÿ +joker ๐Ÿƒ +mahjong red dragon ๐Ÿ€„ +flower playing cards ๐ŸŽด +performing arts ๐ŸŽญ +framed picture ๐Ÿ–ผ +artist palette ๐ŸŽจ +thread ๐Ÿงต +sewing needle ๐Ÿชก +yarn ๐Ÿงถ +knot ๐Ÿชข +glasses ๐Ÿ‘“ +sunglasses ๐Ÿ•ถ +goggles ๐Ÿฅฝ +lab coat ๐Ÿฅผ +safety vest ๐Ÿฆบ +necktie ๐Ÿ‘” +t-shirt ๐Ÿ‘• +jeans ๐Ÿ‘– +scarf ๐Ÿงฃ +gloves ๐Ÿงค +coat ๐Ÿงฅ +socks ๐Ÿงฆ +dress ๐Ÿ‘— +kimono ๐Ÿ‘˜ +sari ๐Ÿฅป +one-piece swimsuit ๐Ÿฉฑ +briefs ๐Ÿฉฒ +shorts ๐Ÿฉณ +bikini ๐Ÿ‘™ +womanโ€™s clothes ๐Ÿ‘š +purse ๐Ÿ‘› +handbag ๐Ÿ‘œ +clutch bag ๐Ÿ‘ +shopping bags ๐Ÿ› +backpack ๐ŸŽ’ +thong sandal ๐Ÿฉด +manโ€™s shoe ๐Ÿ‘ž +running shoe ๐Ÿ‘Ÿ +hiking boot ๐Ÿฅพ +flat shoe ๐Ÿฅฟ +high-heeled shoe ๐Ÿ‘  +womanโ€™s sandal ๐Ÿ‘ก +ballet shoes ๐Ÿฉฐ +womanโ€™s boot ๐Ÿ‘ข +crown ๐Ÿ‘‘ +womanโ€™s hat ๐Ÿ‘’ +top hat ๐ŸŽฉ +graduation cap ๐ŸŽ“ +billed cap ๐Ÿงข +military helmet ๐Ÿช– +rescue workerโ€™s helmet โ›‘ +prayer beads ๐Ÿ“ฟ +lipstick ๐Ÿ’„ +ring ๐Ÿ’ +gem stone ๐Ÿ’Ž +muted speaker ๐Ÿ”‡ +speaker low volume ๐Ÿ”ˆ +speaker medium volume ๐Ÿ”‰ +speaker high volume ๐Ÿ”Š +loudspeaker ๐Ÿ“ข +megaphone ๐Ÿ“ฃ +postal horn ๐Ÿ“ฏ +bell ๐Ÿ”” +bell with slash ๐Ÿ”• +musical score ๐ŸŽผ +musical note ๐ŸŽต +musical notes ๐ŸŽถ +studio microphone ๐ŸŽ™ +level slider ๐ŸŽš +control knobs ๐ŸŽ› +microphone ๐ŸŽค +headphone ๐ŸŽง +radio ๐Ÿ“ป +saxophone ๐ŸŽท +accordion ๐Ÿช— +guitar ๐ŸŽธ +musical keyboard ๐ŸŽน +trumpet ๐ŸŽบ +violin ๐ŸŽป +banjo ๐Ÿช• +drum ๐Ÿฅ +long drum ๐Ÿช˜ +mobile phone ๐Ÿ“ฑ +mobile phone with arrow ๐Ÿ“ฒ +telephone โ˜Ž +telephone receiver ๐Ÿ“ž +pager ๐Ÿ“Ÿ +fax machine ๐Ÿ“  +battery ๐Ÿ”‹ +low battery ๐Ÿชซ +electric plug ๐Ÿ”Œ +laptop ๐Ÿ’ป +desktop computer ๐Ÿ–ฅ +printer ๐Ÿ–จ +keyboard โŒจ +computer mouse ๐Ÿ–ฑ +trackball ๐Ÿ–ฒ +computer disk ๐Ÿ’ฝ +floppy disk ๐Ÿ’พ +optical disk ๐Ÿ’ฟ +dvd ๐Ÿ“€ +abacus ๐Ÿงฎ +movie camera ๐ŸŽฅ +film frames ๐ŸŽž +film projector ๐Ÿ“ฝ +clapper board ๐ŸŽฌ +television ๐Ÿ“บ +camera ๐Ÿ“ท +camera with flash ๐Ÿ“ธ +video camera ๐Ÿ“น +videocassette ๐Ÿ“ผ +magnifying glass tilted left ๐Ÿ” +magnifying glass tilted right ๐Ÿ”Ž +candle ๐Ÿ•ฏ +light bulb ๐Ÿ’ก +flashlight ๐Ÿ”ฆ +red paper lantern ๐Ÿฎ +diya lamp ๐Ÿช” +notebook with decorative cover ๐Ÿ“” +closed book ๐Ÿ“• +open book ๐Ÿ“– +green book ๐Ÿ“— +blue book ๐Ÿ“˜ +orange book ๐Ÿ“™ +books ๐Ÿ“š +notebook ๐Ÿ““ +ledger ๐Ÿ“’ +page with curl ๐Ÿ“ƒ +scroll ๐Ÿ“œ +page facing up ๐Ÿ“„ +newspaper ๐Ÿ“ฐ +rolled-up newspaper ๐Ÿ—ž +bookmark tabs ๐Ÿ“‘ +bookmark ๐Ÿ”– +label ๐Ÿท +money bag ๐Ÿ’ฐ +coin ๐Ÿช™ +yen banknote ๐Ÿ’ด +dollar banknote ๐Ÿ’ต +euro banknote ๐Ÿ’ถ +pound banknote ๐Ÿ’ท +money with wings ๐Ÿ’ธ +credit card ๐Ÿ’ณ +receipt ๐Ÿงพ +chart increasing with yen ๐Ÿ’น +envelope โœ‰ +e-mail ๐Ÿ“ง +incoming envelope ๐Ÿ“จ +envelope with arrow ๐Ÿ“ฉ +outbox tray ๐Ÿ“ค +inbox tray ๐Ÿ“ฅ +package ๐Ÿ“ฆ +closed mailbox with raised flag ๐Ÿ“ซ +closed mailbox with lowered flag ๐Ÿ“ช +open mailbox with raised flag ๐Ÿ“ฌ +open mailbox with lowered flag ๐Ÿ“ญ +postbox ๐Ÿ“ฎ +ballot box with ballot ๐Ÿ—ณ +pencil โœ +black nib โœ’ +fountain pen ๐Ÿ–‹ +pen ๐Ÿ–Š +paintbrush ๐Ÿ–Œ +crayon ๐Ÿ– +memo ๐Ÿ“ +briefcase ๐Ÿ’ผ +file folder ๐Ÿ“ +open file folder ๐Ÿ“‚ +card index dividers ๐Ÿ—‚ +calendar ๐Ÿ“… +tear-off calendar ๐Ÿ“† +spiral notepad ๐Ÿ—’ +spiral calendar ๐Ÿ—“ +card index ๐Ÿ“‡ +chart increasing ๐Ÿ“ˆ +chart decreasing ๐Ÿ“‰ +bar chart ๐Ÿ“Š +clipboard ๐Ÿ“‹ +pushpin ๐Ÿ“Œ +round pushpin ๐Ÿ“ +paperclip ๐Ÿ“Ž +linked paperclips ๐Ÿ–‡ +straight ruler ๐Ÿ“ +triangular ruler ๐Ÿ“ +scissors โœ‚ +card file box ๐Ÿ—ƒ +file cabinet ๐Ÿ—„ +wastebasket ๐Ÿ—‘ +locked ๐Ÿ”’ +unlocked ๐Ÿ”“ +locked with pen ๐Ÿ” +locked with key ๐Ÿ” +key ๐Ÿ”‘ +old key ๐Ÿ— +hammer ๐Ÿ”จ +axe ๐Ÿช“ +pick โ› +hammer and pick โš’ +hammer and wrench ๐Ÿ›  +dagger ๐Ÿ—ก +crossed swords โš” +water pistol ๐Ÿ”ซ +boomerang ๐Ÿชƒ +bow and arrow ๐Ÿน +shield ๐Ÿ›ก +carpentry saw ๐Ÿชš +wrench ๐Ÿ”ง +screwdriver ๐Ÿช› +nut and bolt ๐Ÿ”ฉ +gear โš™ +clamp ๐Ÿ—œ +balance scale โš– +white cane ๐Ÿฆฏ +link ๐Ÿ”— +chains โ›“ +hook ๐Ÿช +toolbox ๐Ÿงฐ +magnet ๐Ÿงฒ +ladder ๐Ÿชœ +alembic โš— +test tube ๐Ÿงช +petri dish ๐Ÿงซ +dna ๐Ÿงฌ +microscope ๐Ÿ”ฌ +telescope ๐Ÿ”ญ +satellite antenna ๐Ÿ“ก +syringe ๐Ÿ’‰ +drop of blood ๐Ÿฉธ +pill ๐Ÿ’Š +adhesive bandage ๐Ÿฉน +crutch ๐Ÿฉผ +stethoscope ๐Ÿฉบ +x-ray ๐Ÿฉป +door ๐Ÿšช +elevator ๐Ÿ›— +mirror ๐Ÿชž +window ๐ŸชŸ +bed ๐Ÿ› +couch and lamp ๐Ÿ›‹ +chair ๐Ÿช‘ +toilet ๐Ÿšฝ +plunger ๐Ÿช  +shower ๐Ÿšฟ +bathtub ๐Ÿ› +mouse trap ๐Ÿชค +razor ๐Ÿช’ +lotion bottle ๐Ÿงด +safety pin ๐Ÿงท +broom ๐Ÿงน +basket ๐Ÿงบ +roll of paper ๐Ÿงป +bucket ๐Ÿชฃ +soap ๐Ÿงผ +bubbles ๐Ÿซง +toothbrush ๐Ÿชฅ +sponge ๐Ÿงฝ +fire extinguisher ๐Ÿงฏ +shopping cart ๐Ÿ›’ +cigarette ๐Ÿšฌ +coffin โšฐ +headstone ๐Ÿชฆ +funeral urn โšฑ +moai ๐Ÿ—ฟ +placard ๐Ÿชง +identification card ๐Ÿชช +ATM sign ๐Ÿง +litter in bin sign ๐Ÿšฎ +potable water ๐Ÿšฐ +wheelchair symbol โ™ฟ +menโ€™s room ๐Ÿšน +womenโ€™s room ๐Ÿšบ +restroom ๐Ÿšป +baby symbol ๐Ÿšผ +water closet ๐Ÿšพ +passport control ๐Ÿ›‚ +customs ๐Ÿ›ƒ +baggage claim ๐Ÿ›„ +left luggage ๐Ÿ›… +warning โš  +children crossing ๐Ÿšธ +no entry โ›” +prohibited ๐Ÿšซ +no bicycles ๐Ÿšณ +no smoking ๐Ÿšญ +no littering ๐Ÿšฏ +non-potable water ๐Ÿšฑ +no pedestrians ๐Ÿšท +no mobile phones ๐Ÿ“ต +no one under eighteen ๐Ÿ”ž +radioactive โ˜ข +biohazard โ˜ฃ +up arrow โฌ† +up-right arrow โ†— +right arrow โžก +down-right arrow โ†˜ +down arrow โฌ‡ +down-left arrow โ†™ +left arrow โฌ… +up-left arrow โ†– +up-down arrow โ†• +left-right arrow โ†” +right arrow curving left โ†ฉ +left arrow curving right โ†ช +right arrow curving up โคด +right arrow curving down โคต +clockwise vertical arrows ๐Ÿ”ƒ +counterclockwise arrows button ๐Ÿ”„ +BACK arrow ๐Ÿ”™ +END arrow ๐Ÿ”š +ON! arrow ๐Ÿ”› +SOON arrow ๐Ÿ”œ +TOP arrow ๐Ÿ” +place of worship ๐Ÿ› +atom symbol โš› +om ๐Ÿ•‰ +star of David โœก +wheel of dharma โ˜ธ +yin yang โ˜ฏ +latin cross โœ +orthodox cross โ˜ฆ +star and crescent โ˜ช +peace symbol โ˜ฎ +menorah ๐Ÿ•Ž +dotted six-pointed star ๐Ÿ”ฏ +Aries โ™ˆ +Taurus โ™‰ +Gemini โ™Š +Cancer โ™‹ +Leo โ™Œ +Virgo โ™ +Libra โ™Ž +Scorpio โ™ +Sagittarius โ™ +Capricorn โ™‘ +Aquarius โ™’ +Pisces โ™“ +Ophiuchus โ›Ž +shuffle tracks button ๐Ÿ”€ +repeat button ๐Ÿ” +repeat single button ๐Ÿ”‚ +play button โ–ถ +fast-forward button โฉ +next track button โญ +play or pause button โฏ +reverse button โ—€ +fast reverse button โช +last track button โฎ +upwards button ๐Ÿ”ผ +fast up button โซ +downwards button ๐Ÿ”ฝ +fast down button โฌ +pause button โธ +stop button โน +record button โบ +eject button โ +cinema ๐ŸŽฆ +dim button ๐Ÿ”… +bright button ๐Ÿ”† +antenna bars ๐Ÿ“ถ +vibration mode ๐Ÿ“ณ +mobile phone off ๐Ÿ“ด +female sign โ™€ +male sign โ™‚ +transgender symbol โšง +multiply โœ– +plus โž• +minus โž– +divide โž— +heavy equals sign ๐ŸŸฐ +infinity โ™พ +double exclamation mark โ€ผ +exclamation question mark โ‰ +red question mark โ“ +white question mark โ” +white exclamation mark โ• +red exclamation mark โ— +wavy dash ใ€ฐ +currency exchange ๐Ÿ’ฑ +heavy dollar sign ๐Ÿ’ฒ +medical symbol โš• +recycling symbol โ™ป +fleur-de-lis โšœ +trident emblem ๐Ÿ”ฑ +name badge ๐Ÿ“› +Japanese symbol for beginner ๐Ÿ”ฐ +hollow red circle โญ• +check mark button โœ… +check box with check โ˜‘ +check mark โœ” +cross mark โŒ +cross mark button โŽ +curly loop โžฐ +double curly loop โžฟ +part alternation mark ใ€ฝ +eight-spoked asterisk โœณ +eight-pointed star โœด +sparkle โ‡ +copyright ยฉ +registered ยฎ +trade mark โ„ข +keycap: # #๏ธโƒฃ +keycap: * *๏ธโƒฃ +keycap: 0 0๏ธโƒฃ +keycap: 1 1๏ธโƒฃ +keycap: 2 2๏ธโƒฃ +keycap: 3 3๏ธโƒฃ +keycap: 4 4๏ธโƒฃ +keycap: 5 5๏ธโƒฃ +keycap: 6 6๏ธโƒฃ +keycap: 7 7๏ธโƒฃ +keycap: 8 8๏ธโƒฃ +keycap: 9 9๏ธโƒฃ +keycap: 10 ๐Ÿ”Ÿ +input latin uppercase ๐Ÿ”  +input latin lowercase ๐Ÿ”ก +input numbers ๐Ÿ”ข +input symbols ๐Ÿ”ฃ +input latin letters ๐Ÿ”ค +A button (blood type) ๐Ÿ…ฐ +AB button (blood type) ๐Ÿ†Ž +B button (blood type) ๐Ÿ…ฑ +CL button ๐Ÿ†‘ +COOL button ๐Ÿ†’ +FREE button ๐Ÿ†“ +information โ„น +ID button ๐Ÿ†” +circled M โ“‚ +NEW button ๐Ÿ†• +NG button ๐Ÿ†– +O button (blood type) ๐Ÿ…พ +OK button ๐Ÿ†— +P button ๐Ÿ…ฟ +SOS button ๐Ÿ†˜ +UP! button ๐Ÿ†™ +VS button ๐Ÿ†š +Japanese โ€œhereโ€ button ๐Ÿˆ +Japanese โ€œservice chargeโ€ button ๐Ÿˆ‚ +Japanese โ€œmonthly amountโ€ button ๐Ÿˆท +Japanese โ€œnot free of chargeโ€ button ๐Ÿˆถ +Japanese โ€œreservedโ€ button ๐Ÿˆฏ +Japanese โ€œbargainโ€ button ๐Ÿ‰ +Japanese โ€œdiscountโ€ button ๐Ÿˆน +Japanese โ€œfree of chargeโ€ button ๐Ÿˆš +Japanese โ€œprohibitedโ€ button ๐Ÿˆฒ +Japanese โ€œacceptableโ€ button ๐Ÿ‰‘ +Japanese โ€œapplicationโ€ button ๐Ÿˆธ +Japanese โ€œpassing gradeโ€ button ๐Ÿˆด +Japanese โ€œvacancyโ€ button ๐Ÿˆณ +Japanese โ€œcongratulationsโ€ button ใŠ— +Japanese โ€œsecretโ€ button ใŠ™ +Japanese โ€œopen for businessโ€ button ๐Ÿˆบ +Japanese โ€œno vacancyโ€ button ๐Ÿˆต +red circle ๐Ÿ”ด +orange circle ๐ŸŸ  +yellow circle ๐ŸŸก +green circle ๐ŸŸข +blue circle ๐Ÿ”ต +purple circle ๐ŸŸฃ +brown circle ๐ŸŸค +black circle โšซ +white circle โšช +red square ๐ŸŸฅ +orange square ๐ŸŸง +yellow square ๐ŸŸจ +green square ๐ŸŸฉ +blue square ๐ŸŸฆ +purple square ๐ŸŸช +brown square ๐ŸŸซ +black large square โฌ› +white large square โฌœ +black medium square โ—ผ +white medium square โ—ป +black medium-small square โ—พ +white medium-small square โ—ฝ +black small square โ–ช +white small square โ–ซ +large orange diamond ๐Ÿ”ถ +large blue diamond ๐Ÿ”ท +small orange diamond ๐Ÿ”ธ +small blue diamond ๐Ÿ”น +red triangle pointed up ๐Ÿ”บ +red triangle pointed down ๐Ÿ”ป +diamond with a dot ๐Ÿ’  +radio button ๐Ÿ”˜ +white square button ๐Ÿ”ณ +black square button ๐Ÿ”ฒ +chequered flag ๐Ÿ +triangular flag ๐Ÿšฉ +crossed flags ๐ŸŽŒ +black flag ๐Ÿด +white flag ๐Ÿณ +letter a ๐Ÿ‡ฆ +letter b ๐Ÿ‡ง +letter c ๐Ÿ‡จ +letter d ๐Ÿ‡ฉ +letter e ๐Ÿ‡ช +letter f ๐Ÿ‡ซ +letter g ๐Ÿ‡ฌ +letter h ๐Ÿ‡ญ +letter i ๐Ÿ‡ฎ +letter j ๐Ÿ‡ฏ +letter k ๐Ÿ‡ฐ +letter l ๐Ÿ‡ฑ +letter m ๐Ÿ‡ฒ +letter n ๐Ÿ‡ณ +letter o ๐Ÿ‡ด +letter p ๐Ÿ‡ต +letter r ๐Ÿ‡ท +letter s ๐Ÿ‡ธ +letter t ๐Ÿ‡น +letter u ๐Ÿ‡บ +letter v ๐Ÿ‡ป +letter y ๐Ÿ‡พ +letter z ๐Ÿ‡ฟ diff --git a/bin/dmscripts/dmfm b/bin/dmscripts/dmfm new file mode 100755 index 0000000..34a9e2c --- /dev/null +++ b/bin/dmscripts/dmfm @@ -0,0 +1,17 @@ +#!/bin/bash + +file=1 +while [ "$file" ]; do + file=$(ls -1 --group-directories-first | dmenu -i -l 8 -g 1 -p "$(basename $(pwd)):") + if [ -e "$file" ]; then + owd=$(pwd) + if [ -d "$file" ]; then + cd "$file" + else [ -f "$file" ] + if which xdg-open &> /dev/null; then + exec xdg-open "$owd/$file" & + unset file + fi + fi + fi +done diff --git a/bin/dmscripts/dmhelp b/bin/dmscripts/dmhelp new file mode 100755 index 0000000..653fa1f --- /dev/null +++ b/bin/dmscripts/dmhelp @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +program="${1:-$(dmenu_path | dmenu -l 4 -g 5)}" +opfil="/tmp/dmh_options.txt" +test -z "${program}" && exit 1 + +if ${program} --help > "${opfil}" +then + option="$(\ + grep -E "^ *-[-a-Z]* " "${opfil}" \ + | tr -s ' ' \ + | sort | uniq \ + | column -l 2 -t \ + | dmenu -x -l 20 -g 1 -p "${program}" \ + | awk '{print $1}' \ + )" +elif man $program > "${opfil}" +then + echo lesgo +else + echo "No options found for '${program}'" > /dev/stderr + exit 1 +fi +test -z "${option}" && exit 1 + +rm -f "${opfil}" +${program} ${option} diff --git a/bin/dmscripts/dminw b/bin/dmscripts/dminw new file mode 100755 index 0000000..2ff32a1 --- /dev/null +++ b/bin/dmscripts/dminw @@ -0,0 +1,4 @@ +#!/bin/bash +WINDOWID=${1:-$(xdotool getwindowfocus)} +WIDTH=$(xdotool getwindowgeometry -s ${WINDOWID} | grep WIDTH | cut -d ' ' -f 2) +dmenu_run -w ${1:-$(xdotool getwindowfocus)} -z ${WIDTH} diff --git a/bin/dmscripts/dmlang b/bin/dmscripts/dmlang new file mode 100755 index 0000000..0009704 --- /dev/null +++ b/bin/dmscripts/dmlang @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +choice="$(\ + echo -e "us\ngb\nbe" \ + | dmenu \ + -p "($(setxkbmap -query | awk 'NR==3 {print $2}'))" \ +)" +setxkbmap "${choice:-us}" diff --git a/bin/dmscripts/dmpass b/bin/dmscripts/dmpass new file mode 100755 index 0000000..2af798b --- /dev/null +++ b/bin/dmscripts/dmpass @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +store="$HOME/.password-store" +lscmd="ls --group-directories-first" +dmenucmd="dmenu -l 4 -g 2" +while [ -d "${store}/${file}" ] +do + choice="$($lscmd "${store}/${file}" | awk -F'.gpg' '{print $1}' | $dmenucmd)" + [ "$choice" ] || break + file="${file}/${choice}" +done +pass show -c "${file}" diff --git a/bin/dmscripts/dmpassgen b/bin/dmscripts/dmpassgen new file mode 100755 index 0000000..c627a1d --- /dev/null +++ b/bin/dmscripts/dmpassgen @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +choice="$(echo -ne "multiline\nsingle" | dmenu -l 1 -g 2)" +test -z "${choice}" && exit 1 + +password="$(echo -n "" | dmenu -p "name:")" +test -z "${password}" && exit 1 + +if [[ "${choice}" == "multiline" ]] +then + logins="$(ls -1 ~/.password-store/e-mails | awk -F '.gpg' '{print $1}')" + login="$(echo "$logins" | dmenu -g 1 -l 8 -p "login:")" + test -z "${login}" && exit 1 + url="$(echo -n "" | dmenu -p "url:")" + test -z "${url}" && exit 1 + echo -e "${password}\nlogin: ${login}\nurl: ${url}" | pass insert -mf "${password}" + pass generate -ci "${password}" +else + pass generate -cf "${password}" +fi + diff --git a/bin/dmscripts/dmpdf b/bin/dmscripts/dmpdf new file mode 100755 index 0000000..6137e1a --- /dev/null +++ b/bin/dmscripts/dmpdf @@ -0,0 +1,21 @@ +#!/bin/bash +directory="${1:-$PWD}" +choice="$(\ + find "${directory}" \ + -type f \ + -iname "*.pdf" \ + -printf "%p\n" \ + | awk -F '/' '{print $(NF - 1) "/" $NF}' \ + | sort \ + | uniq \ + | dmenu -i -x -p "pdf:" -l 10 -g 2 \ + | awk -F '/' '{print $2}' \ +)" + +# find matching file +file="$(\ + find "$directory" -name "*$choice*" \ +)" + +[[ -f "$file" ]] || exit 1 +evince "$file" & diff --git a/bin/dmscripts/dmpower b/bin/dmscripts/dmpower new file mode 100755 index 0000000..bd847d6 --- /dev/null +++ b/bin/dmscripts/dmpower @@ -0,0 +1,3 @@ +#!/bin/sh +choice="$(echo -e "poweroff\nreboot\nhibernate" | dmenu -l 1 -g 3)" +test -z "$choice" || systemctl "$choice" diff --git a/bin/dmscripts/dmpsbm b/bin/dmscripts/dmpsbm new file mode 100755 index 0000000..3b00b2c --- /dev/null +++ b/bin/dmscripts/dmpsbm @@ -0,0 +1,2 @@ +#!/bin/sh +grep -v '^#' ~/.local/share/bookmarks | dmenu -c -x -g 1 -l 10 | cut -f1 -d' ' | xclip -sel c && xdotool key Ctrl+Shift+v diff --git a/bin/dmscripts/dmpsclip b/bin/dmscripts/dmpsclip new file mode 100755 index 0000000..8577e91 --- /dev/null +++ b/bin/dmscripts/dmpsclip @@ -0,0 +1,3 @@ +#!/bin/sh +dmenu -l 10 -g 1 -c -x < /tmp/tmpclip.txt | xclip -sel c +xdotool key Ctrl+Shift+v diff --git a/bin/dmscripts/dmvid b/bin/dmscripts/dmvid new file mode 100755 index 0000000..08dbb6b --- /dev/null +++ b/bin/dmscripts/dmvid @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +find ${1:-~/movies ~/Downloads} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids +choice="$(\ + sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids \ + | tr '\n' '\0' \ + | xargs -0 -I {} echo "๏€ฝ {}" \ + | tr '\0' '\n' \ + | awk '{printf "%-3s %s\n", NR ":", $0}' \ + | dmenu -l 10 -g 1 -x -i \ + | grep -zoE "^[0-9]+:" \ +)" +if [ -z "$choice" ]; then + exit +fi +vid="$(sed -n "${choice::-1}p" /tmp/dmvids)" +mpv "$vid" diff --git a/bin/dmscripts/dmyt-not b/bin/dmscripts/dmyt-not new file mode 100755 index 0000000..4783a8d --- /dev/null +++ b/bin/dmscripts/dmyt-not @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# Open a video from channels.yt-not by selecting the channel +channel="$(awk '{print $2}' ~/.local/share/yt-not/channels.yt-not | dmenu -l 2 -g 4)" +video_id="$(awk "/$channel/ {print \$3}" ~/.local/share/yt-not/channels.yt-not )" +video="https://youtube.com/watch?v=${video_id}" +mpv $video diff --git a/bin/extra/arr_hjkl b/bin/extra/arr_hjkl new file mode 100755 index 0000000..0ef542e --- /dev/null +++ b/bin/extra/arr_hjkl @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "$(xmodmap -pke | grep ' = h')" ] +then + xmodmap -e 'keycode 43 = Left' + xmodmap -e 'keycode 44 = Down Return' + xmodmap -e 'keycode 45 = Up' + xmodmap -e 'keycode 46 = Right' + dunstify "arr hjkl" "arrows on" +else + export ARRKEYMODE="hjkl" + xmodmap -e 'keycode 43 = h' + xmodmap -e 'keycode 44 = j' + xmodmap -e 'keycode 45 = k' + xmodmap -e 'keycode 46 = l' + dunstify "arr hjkl" "arrows off" +fi diff --git a/bin/extra/cht.sh b/bin/extra/cht.sh new file mode 100755 index 0000000..7cd4892 --- /dev/null +++ b/bin/extra/cht.sh @@ -0,0 +1,796 @@ +#!/bin/bash +# shellcheck disable=SC1117,SC2001 +# +# [X] open section +# [X] one shot mode +# [X] usage info +# [X] dependencies check +# [X] help +# [X] yank/y/copy/c +# [X] Y/C +# [X] eof problem +# [X] more +# [X] stealth mode +# +# here are several examples for the stealth mode: +# +# zip lists +# list permutation +# random list element +# reverse a list +# read json from file +# append string to a file +# run process in background +# count words in text counter +# group elements list + +__CHTSH_VERSION=0.0.4 +__CHTSH_DATETIME="2021-04-25 12:30:30 +0200" + +# cht.sh configuration loading +# +# configuration is stored in ~/.cht.sh/ (can be overridden with CHTSH env var.) +# +CHTSH_HOME=${CHTSH:-"$HOME"/.cht.sh} +[ -z "$CHTSH_CONF" ] && CHTSH_CONF=$CHTSH_HOME/cht.sh.conf +# shellcheck disable=SC1090,SC2002 +[ -e "$CHTSH_CONF" ] && source "$CHTSH_CONF" +[ -z "$CHTSH_URL" ] && CHTSH_URL=https://cht.sh + +# currently we support only two modes: +# * lite = access the server using curl +# * auto = try standalone usage first +CHTSH_MODE="$(cat "$CHTSH_HOME"/mode 2> /dev/null)" +[ "$CHTSH_MODE" != lite ] && CHTSH_MODE=auto +CHEATSH_INSTALLATION="$(cat "$CHTSH_HOME/standalone" 2> /dev/null)" + + +export LESSSECURE=1 +STEALTH_MAX_SELECTION_LENGTH=5 + +case "$(uname -s)" in + Darwin) is_macos=yes ;; + *) is_macos=no ;; +esac + +# for KSH93 +# shellcheck disable=SC2034,SC2039,SC2168 +if echo "$KSH_VERSION" | grep -q ' 93' && ! local foo 2>/dev/null; then + alias local=typeset +fi + +fatal() +{ + echo "ERROR: $*" >&2 + exit 1 +} + +_say_what_i_do() +{ + [ -n "$LOG" ] && echo "$(date '+[%Y-%m-%d %H:%M%S]') $*" >> "$LOG" + + local this_prompt="\033[0;1;4;32m>>\033[0m" + printf "\n${this_prompt}%s\033[0m\n" " $* " +} + +cheatsh_standalone_install() +{ + # the function installs cheat.sh with the upstream repositories + # in the standalone mode + local installdir; installdir="$1" + local default_installdir="$HOME/.cheat.sh" + + [ -z "$installdir" ] && installdir=${default_installdir} + + if [ "$installdir" = help ]; then + cat </dev/null || \ + { echo "DEPENDENCY: \"$dep\" is needed to install cheat.sh in the standalone mode" >&2; _exit_code=1; } + done + [ "$_exit_code" -ne 0 ] && return "$_exit_code" + + while true; do + local _installdir + echo -n "Where should cheat.sh be installed [$installdir]? "; read -r _installdir + [ -n "$_installdir" ] && installdir=$_installdir + + if [ "$installdir" = y ] \ + || [ "$installdir" = Y ] \ + || [ "$(echo "$installdir" | tr "[:upper:]" "[:lower:]")" = yes ] + then + echo Please enter the directory name + echo If it was the directory name already, please prepend it with \"./\": "./$installdir" + else + break + fi + done + + if [ -e "$installdir" ]; then + echo "ERROR: Installation directory [$installdir] exists already" + echo "Please remove it first before continuing" + return 1 + fi + + if ! mkdir -p "$installdir"; then + echo "ERROR: Could not create the installation directory \"$installdir\"" + echo "ERROR: Please check the permissions and start the script again" + return 1 + fi + + local space_needed=700 + local space_available; space_available=$(($(df -k "$installdir" | awk '{print $4}' | tail -1)/1024)) + + if [ "$space_available" -lt "$space_needed" ]; then + echo "ERROR: Installation directory has no enough space (needed: ${space_needed}M, available: ${space_available}M" + echo "ERROR: Please clean up and start the script again" + rmdir "$installdir" + return 1 + fi + + _say_what_i_do Cloning cheat.sh locally + local url=https://github.com/chubin/cheat.sh + rmdir "$installdir" + git clone "$url" "$installdir" || fatal Could not clone "$url" with git into "$installdir" + cd "$installdir" || fatal "Cannot cd into $installdir" + + # after the repository cloned, we may have the log directory + # and we can write our installation log into it + mkdir -p "log/" + LOG="$PWD/log/install.log" + + # we use tee everywhere so we should set -o pipefail + set -o pipefail + + # currently the script uses python 2, + # but cheat.sh supports python 3 too + # if you want to switch it to python 3 + # set PYTHON2 to NO: + # PYTHON2=NO + # + PYTHON2=NO + if [[ $PYTHON2 = YES ]]; then + python="python2" + pip="pip" + virtualenv_python3_option=() + else + python="python3" + pip="pip3" + virtualenv_python3_option=(-p python3) + fi + + _say_what_i_do Creating virtual environment + virtualenv "${virtualenv_python3_option[@]}" ve \ + || fatal "Could not create virtual environment with 'virtualenv ve'" + + export CHEATSH_PATH_WORKDIR=$PWD + + # rapidfuzz does not support Python 2, + # so if we are using Python 2, install fuzzywuzzy instead + if [[ $PYTHON2 = YES ]]; then + sed -i s/rapidfuzz/fuzzywuzzy/ requirements.txt + echo "python-Levenshtein" >> requirements.txt + fi + + _say_what_i_do Installing python requirements into the virtual environment + ve/bin/"$pip" install -r requirements.txt > "$LOG" \ + || { + + echo "ERROR:" + echo "---" + tail -n 10 "$LOG" + echo "---" + echo "See $LOG for more" + fatal Could not install python dependencies into the virtual environment + } + echo "$(ve/bin/"$pip" freeze | wc -l) dependencies were successfully installed" + + _say_what_i_do Fetching the upstream cheat sheets repositories + ve/bin/python lib/fetch.py fetch-all | tee -a "$LOG" + + _say_what_i_do Running self-tests + ( + cd tests || exit + + if CHEATSH_TEST_STANDALONE=YES \ + CHEATSH_TEST_SKIP_ONLINE=NO \ + CHEATSH_TEST_SHOW_DETAILS=NO \ + PYTHON=../ve/bin/python bash run-tests.sh | tee -a "$LOG" + then + printf "\033[0;32m%s\033[0m\n" "SUCCESS" + else + printf "\033[0;31m%s\033[0m\n" "FAILED" + echo "Some tests were failed. Run the tests manually for further investigation:" + echo " cd $PWD; bash run-tests.sh)" + fi + ) + + mkdir -p "$CHTSH_HOME" + echo "$installdir" > "$CHTSH_HOME/standalone" + echo auto > "$CHTSH_HOME/mode" + + _say_what_i_do Done + + local v1; v1=$(printf "\033[0;1;32m") + local v2; v2=$(printf "\033[0m") + + cat < "$CHTSH_HOME/mode" + echo "Configured mode: $mode" + fi + else + echo "Unknown mode: $mode" + echo Supported modes: + echo " auto use the standalone installation first" + echo " lite use the cheat sheets server directly" + fi +} + +get_query_options() +{ + local query="$*" + if [ -n "$CHTSH_QUERY_OPTIONS" ]; then + case $query in + *\?*) query="$query&${CHTSH_QUERY_OPTIONS}";; + *) query="$query?${CHTSH_QUERY_OPTIONS}";; + esac + fi + printf "%s" "$query" +} + +do_query() +{ + local query="$*" + local b_opts= + local uri="${CHTSH_URL}/\"\$(get_query_options $query)\"" + + if [ -e "$CHTSH_HOME/id" ]; then + b_opts="-b \"\$CHTSH_HOME/id\"" + fi + + eval curl "$b_opts" -s "$uri" > "$TMP1" + + if [ -z "$lines" ] || [ "$(wc -l "$TMP1" | awk '{print $1}')" -lt "$lines" ]; then + cat "$TMP1" + else + ${PAGER:-$defpager} "$TMP1" + fi +} + +prepare_query() +{ + local section="$1"; shift + local input="$1"; shift + local arguments="$1" + + local query + if [ -z "$section" ] || [ x"${input}" != x"${input#/}" ]; then + query=$(printf %s "$input" | sed 's@ @/@; s@ @+@g') + else + query=$(printf %s "$section/$input" | sed 's@ @+@g') + fi + + [ -n "$arguments" ] && arguments="?$arguments" + printf %s "$query$arguments" +} + +get_list_of_sections() +{ + curl -s "${CHTSH_URL}"/:list | grep -v '/.*/' | grep '/$' | xargs +} + +gen_random_str() +( + len=$1 + if command -v openssl >/dev/null; then + openssl rand -base64 $((len*3/4)) | awk -v ORS='' // + else + rdev=/dev/urandom + for d in /dev/{srandom,random,arandom}; do + test -r "$d" && rdev=$d + done + if command -v hexdump >/dev/null; then + hexdump -vn $((len/2)) -e '1/1 "%02X" 1 ""' "$rdev" + elif command -v xxd >/dev/null; then + xxd -l $((len/2)) -ps "$rdev" | awk -v ORS='' // + else + cd /tmp || { echo Cannot cd into /tmp >&2; exit 1; } + s= + # shellcheck disable=SC2000 + while [ "$(echo "$s" | wc -c)" -lt "$len" ]; do + s="$s$(mktemp -u XXXXXXXXXX)" + done + printf "%.${len}s" "$s" + fi + fi +) + +if [ "$CHTSH_MODE" = auto ] && [ -d "$CHEATSH_INSTALLATION" ]; then + curl() { + # ignoring all options + # currently the standalone.py does not support them anyway + local opt + while getopts "b:s" opt; do + : + done + shift $((OPTIND - 1)) + + local url; url="$1"; shift + PYTHONIOENCODING=UTF-8 "$CHEATSH_INSTALLATION/ve/bin/python" "$CHEATSH_INSTALLATION/lib/standalone.py" "${url#"$CHTSH_URL"}" "$@" + } +elif [ "$(uname -s)" = OpenBSD ] && [ -x /usr/bin/ftp ]; then + # any better test not involving either OS matching or actual query? + curl() { + local opt args="-o -" + while getopts "b:s" opt; do + case $opt in + b) args="$args -c $OPTARG";; + s) args="$args -M -V";; + *) echo "internal error: unsupported cURL option '$opt'" >&2; exit 1;; + esac + done + shift $((OPTIND - 1)) + /usr/bin/ftp "$args" "$@" + } +else + command -v curl >/dev/null || { echo 'DEPENDENCY: install "curl" to use cht.sh' >&2; exit 1; } + _CURL=$(command -v curl) + if [ x"$CHTSH_CURL_OPTIONS" != x ]; then + curl() { + $_CURL "${CHTSH_CURL_OPTIONS}" "$@" + } + fi +fi + +if [ "$1" = --read ]; then + read -r a || a="exit" + printf "%s\n" "$a" + exit 0 +elif [ x"$1" = x--help ] || [ -z "$1" ]; then + + n=${0##*/} + s=$(echo "$n" | sed "s/./ /"g) + + cat </dev/null || echo 'DEPENDENCY: please install "wl-copy" for "copy"' >&2 + else + command -v xclip >/dev/null || echo 'DEPENDENCY: please install "xclip" for "copy"' >&2 + fi +fi +command -v rlwrap >/dev/null || { echo 'DEPENDENCY: install "rlwrap" to use cht.sh in the shell mode' >&2; exit 1; } + +mkdir -p "$CHTSH_HOME/" +lines=$(tput lines) + +if command -v less >/dev/null; then + defpager="less -R" +elif command -v more >/dev/null; then + defpager="more" +else + defpager="cat" +fi + +cmd_cd() { + if [ $# -eq 0 ]; then + section="" + else + new_section=$(echo "$input" | sed 's/cd *//; s@/*$@@; s@^/*@@') + if [ -z "$new_section" ] || [ ".." = "$new_section" ]; then + section="" + else + valid_sections=$(get_list_of_sections) + valid=no; for q in $valid_sections; do [ "$q" = "$new_section/" ] && { valid=yes; break; }; done + if [ "$valid" = no ]; then + echo "Invalid section: $new_section" + echo "Valid sections:" + echo "$valid_sections" \ + | xargs printf "%-10s\n" \ + | tr ' ' . \ + | xargs -n 10 \ + | sed 's/\./ /g; s/^/ /' + else + section="$new_section" + fi + fi + fi +} + +cmd_copy() { + if [ -z "$DISPLAY" ]; then + echo copy: supported only in the Desktop version + elif [ -z "$input" ]; then + echo copy: Make at least one query first. + else + curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?T)" > "$TMP1" + if [ "$is_macos" != yes ]; then + if [ "$XDG_SESSION_TYPE" = wayland ]; then + wl-copy < "$TMP1" + else + xclip -sel c -i < "$TMP1" + fi + else + pbcopy < "$TMP1" + fi + echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection" + fi +} + +cmd_ccopy() { + if [ -z "$DISPLAY" ]; then + echo copy: supported only in the Desktop version + elif [ -z "$input" ]; then + echo copy: Make at least one query first. + else + curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?TQ)" > "$TMP1" + if [ "$is_macos" != yes ]; then + if [ "$XDG_SESSION_TYPE" = wayland ]; then + wl-copy < "$TMP1" + else + xclip -sel c -i < "$TMP1" + fi + else + pbcopy < "$TMP1" + fi + echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection" + fi +} + +cmd_exit() { + exit 0 +} + +cmd_help() { + cat < python zip list + cht.sh/python> zip list + cht.sh/go> /python zip list +EOF +} + +cmd_hush() { + mkdir -p "$CHTSH_HOME/" && touch "$CHTSH_HOME/.hushlogin" && echo "Initial 'use help' message was disabled" +} + +cmd_id() { + id_file="$CHTSH_HOME/id" + + if [ id = "$input" ]; then + new_id="" + else + new_id=$(echo "$input" | sed 's/id *//; s/ *$//; s/ /+/g') + fi + if [ "$new_id" = remove ]; then + if [ -e "$id_file" ]; then + rm -f -- "$id_file" && echo "id is removed" + else + echo "id was not set, so you can't remove it" + fi + return + fi + if [ -n "$new_id" ] && [ reset != "$new_id" ] && [ "$(/bin/echo -n "$new_id" | wc -c)" -lt 16 ]; then + echo "ERROR: $new_id: Too short id. Minimal id length is 16. Use 'id reset' for a random id" + return + fi + if [ -z "$new_id" ]; then + # if new_id is not specified check if we have some id already + # if yes, just show it + # if not, generate a new id + if [ -e "$id_file" ]; then + awk '$6 == "id" {print $NF}' <"$id_file" | tail -n 1 + return + else + new_id=reset + fi + fi + if [ "$new_id" = reset ]; then + new_id=$(gen_random_str 12) + else + echo WARNING: if someone gueses your id, he can read your cht.sh search history + fi + if [ -e "$id_file" ] && grep -q '\tid\t[^\t][^\t]*$' "$id_file" 2> /dev/null; then + sed -i 's/\tid\t[^\t][^\t]*$/ id '"$new_id"'/' "$id_file" + else + if ! [ -e "$id_file" ]; then + printf '#\n\n' > "$id_file" + fi + printf ".cht.sh\tTRUE\t/\tTRUE\t0\tid\t$new_id\n" >> "$id_file" + fi + echo "$new_id" +} + +cmd_query() { + query=$(prepare_query "$section" "$input") + do_query "$query" +} + +cmd_stealth() { + if [ "$input" != stealth ]; then + arguments=$(echo "$input" | sed 's/stealth //; s/ /\&/') + fi + trap break INT + if [ "$is_macos" = yes ]; then + past=$(pbpaste) + else + if [ "$XDG_SESSION_TYPE" = wayland ]; then + past=$(wl-paste -p) + else + past=$(xclip -sel c -o) + fi + fi + printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n" + printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n" + if [ -n "$arguments" ]; then + printf "\033[0;31mstealth:\033[0m query arguments: ?$arguments\n" + fi + printf "\033[0;31mstealth:\033[0m use ^C to leave this mode\n" + while true; do + if [ "$is_macos" = yes ]; then + current=$(pbpaste) + else + if [ "$XDG_SESSION_TYPE" = wayland ]; then + current=$(wl-paste -p) + else + current=$(xclip -sel c -o) + fi + fi + if [ "$past" != "$current" ]; then + past=$current + current_text="$(echo $current | tr -c '[a-zA-Z0-9]' ' ')" + if [ "$(echo "$current_text" | wc -w)" -gt "$STEALTH_MAX_SELECTION_LENGTH" ]; then + printf "\033[0;31mstealth:\033[0m selection length is longer than $STEALTH_MAX_SELECTION_LENGTH words; ignoring\n" + continue + else + printf "\n\033[0;31mstealth: \033[7m $current_text\033[0m\n" + query=$(prepare_query "$section" "$current_text" "$arguments") + do_query "$query" + fi + fi + sleep 1; + done + trap - INT +} + +cmd_update() { + [ -w "$0" ] || { echo "The script is readonly; please update manually: curl -s ${CHTSH_URL}/:cht.sh | sudo tee $0"; return; } + TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) + curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2" + if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then + if grep -q ^__CHTSH_VERSION= "$TMP2"; then + # section was vaildated by us already + args=(--shell "$section") + cp "$TMP2" "$0" && echo "Updated. Restarting..." && rm "$TMP2" && CHEATSH_RESTART=1 exec "$0" "${args[@]}" + else + echo "Something went wrong. Please update manually" + fi + else + echo "cht.sh is up to date. No update needed" + fi + rm -f "$TMP2" > /dev/null 2>&1 +} + +cmd_version() { + insttime=$(ls -l -- "$0" | sed 's/ */ /g' | cut -d ' ' -f 6-8) + echo "cht.sh version $__CHTSH_VERSION of $__CHTSH_DATETIME; installed at: $insttime" + TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) + if curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2"; then + if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then + echo "Update needed (type 'update' for that)". + else + echo "Up to date. No update needed" + fi + fi + rm -f "$TMP2" > /dev/null 2>&1 +} + +TMP1=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) +trap 'rm -f $TMP1 $TMP2' EXIT +trap 'true' INT + +if ! [ -e "$CHTSH_HOME/.hushlogin" ] && [ -z "$this_query" ]; then + echo "type 'help' for the cht.sh shell help" +fi + +while true; do + if [ "$section" != "" ]; then + full_prompt="$prompt/$section> " + else + full_prompt="$prompt> " + fi + + input=$( + rlwrap -H "$CHTSH_HOME/history" -pgreen -C cht.sh -S "$full_prompt" bash "$0" --read | sed 's/ *#.*//' + ) + + cmd_name=${input%% *} + cmd_args=${input#* } + case $cmd_name in + "") continue;; # skip empty input lines + '?'|h|help) cmd_name=help;; + hush) cmd_name=hush;; + cd) cmd_name="cd";; + exit|quit) cmd_name="exit";; + copy|yank|c|y) cmd_name=copy;; + ccopy|cc|C|Y) cmd_name=ccopy;; + id) cmd_name=id;; + stealth) cmd_name=stealth;; + update) cmd_name=update;; + version) cmd_name=version;; + *) cmd_name="query"; cmd_args="$input";; + esac + "cmd_$cmd_name" $cmd_args +done diff --git a/bin/extra/colorscript b/bin/extra/colorscript new file mode 100755 index 0000000..90dacb1 --- /dev/null +++ b/bin/extra/colorscript @@ -0,0 +1,40 @@ +#!/bin/bash + +counter=0 +var1="$(seq 30 38)" +var2="$(seq 39 47)" +var3="$(seq 0 5) $(seq 7 9)" + + +echo +echo " ________________________________________________________" +echo " |" +echo -n " | " + +for j in $var2 +do + echo -ne "\e[0;37;${j}m ${j} \e[0m" +done + +echo +echo " |" +echo -n " |" + +for j in $var1 +do + echo -n " $j " +done + +echo +echo -n " |________________________________________________________" + +for k in $var3 +do + echo + echo -n "$k| " + for i in $var1 + do + echo -ne " \e[${k};${i}m[${i}]\e[0m " + done +done +echo diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB new file mode 100755 index 0000000..5674786 --- /dev/null +++ b/bin/extra/cycleKB @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +keyboards_file="/home/aluc/bin/keyboards.txt" +cur_keyboard="$(setxkbmap -print | grep "xkb_symbols" | cut -f 2 -d "+")" +# Get line number of match +line="$(awk "/${cur_keyboard}/ {print NR}" "${keyboards_file}")" +lines="$(wc -l "${keyboards_file}" | cut -f 1 -d ' ')" +# cycle back to first line +[[ "$line" == "$lines" ]] && line=1 || ((line++)) +new_keyboard="$(sed -n "${line}p" "${keyboards_file}")" +setxkbmap "${new_keyboard}" +dunstify "cycleKB" "keyboard: ${new_keyboard}" diff --git a/bin/extra/ehbtodl b/bin/extra/ehbtodl new file mode 100755 index 0000000..39d8621 --- /dev/null +++ b/bin/extra/ehbtodl @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +echo "$1" | sed 's/-H/\\\n\t&/g' | sed '/gzip/d' > /tmp/curlcommand.sh +sh /tmp/curlcommand.sh > /tmp/ehbso.html +vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | cut -d'/' -f 3 | tr '\n' ' ')" +for i in $vids +do + echo "https://www.youtube.com/watch?v=$i" +done > /tmp/todownload +# yt-dlp -P "$HOME/Downloads/vids" -o "%(title)s" -a /tmp/todownload diff --git a/bin/extra/keyboards.txt b/bin/extra/keyboards.txt new file mode 100644 index 0000000..03ec74b --- /dev/null +++ b/bin/extra/keyboards.txt @@ -0,0 +1,2 @@ +be +us diff --git a/bin/extra/vimastp b/bin/extra/vimastp new file mode 100755 index 0000000..f4ae6b5 --- /dev/null +++ b/bin/extra/vimastp @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +for var in name vcpus memory cdrom disk_size osinfo +do + read -p "${var}:" "$var" +done +echo "virt-install --name=$name \ +--vcpus ${vcpus:-4} \ +--memory ${memory:-4096} \ +--cdrom ${cdrom} \ +--disk size=${disk_size-30},pool=VMs \ +--osinfo ${osinfo:-detect=on}\ +--boot cdrom,hd,network" diff --git a/config/X/alacritty/alacritty.yml b/config/X/alacritty/alacritty.yml new file mode 100644 index 0000000..b771be8 --- /dev/null +++ b/config/X/alacritty/alacritty.yml @@ -0,0 +1,939 @@ +# Configuration for Alacritty, the GPU enhanced terminal emulator. + +# Import additional configuration files +# +# Imports are loaded in order, skipping all missing files, with the importing +# file being loaded last. If a field is already present in a previous import, it +# will be replaced. +# +# All imports must either be absolute paths starting with `/`, or paths relative +# to the user's home directory starting with `~/`. +#import: +# - /path/to/alacritty.yml + +# Any items in the `env` entry below will be added as +# environment variables. Some entries may override variables +# set by alacritty itself. +env: + # TERM variable + # + # This value is used to set the `$TERM` environment variable for + # each instance of Alacritty. If it is not present, alacritty will + # check the local terminfo database and use `alacritty` if it is + # available, otherwise `xterm-256color` is used. + TERM: xterm-256color + +window: + # Window dimensions (changes require restart) + # + # Number of lines/columns (not pixels) in the terminal. The number of columns + # must be at least `2`, while using a value of `0` for columns and lines will + # fall back to the window manager's recommended size. + #dimensions: + # columns: 0 + # lines: 0 + + # Window position (changes require restart) + # + # Specified in number of pixels. + # If the position is not set, the window manager will handle the placement. + #position: + # x: 0 + # y: 0 + + # Window padding (changes require restart) + # + # Blank space added around the window in pixels. This padding is scaled + # by DPI and the specified value is always added at both opposing sides. + padding: + x: 2 + y: 1 + + # Spread additional padding evenly around the terminal content. + #dynamic_padding: false + + # Window decorations + # + # Values for `decorations`: + # - full: Borders and title bar + # - none: Neither borders nor title bar + # + # Values for `decorations` (macOS only): + # - transparent: Title bar, transparent background and title bar buttons + # - buttonless: Title bar, transparent background and no title bar buttons + decorations: none + + # Background opacity + # + # Window opacity as a floating point number from `0.0` to `1.0`. + # The value `0.0` is completely transparent and `1.0` is opaque. + opacity: 0.80 + + # Startup Mode (changes require restart) + # + # Values for `startup_mode`: + # - Windowed + # - Maximized + # - Fullscreen + # + # Values for `startup_mode` (macOS only): + # - SimpleFullscreen + #startup_mode: Windowed + + # Window title + #title: Alacritty + + # Allow terminal applications to change Alacritty's window title. + #dynamic_title: true + + # Window class (Linux/BSD only): + #class: + # Application instance name + #instance: Alacritty + # General application class + #general: Alacritty + + # GTK theme variant (Linux/BSD only) + # + # Override the variant of the GTK theme. Commonly supported values are `dark` + # and `light`. Set this to `None` to use the default theme variant. + #gtk_theme_variant: None + +scrolling: + # Maximum number of lines in the scrollback buffer. + # Specifying '0' will disable scrolling. + history: 10000 + + # Scrolling distance multiplier. + #multiplier: 3 + +# Font configuration +font: + # Normal (roman) font face + normal: + # Font family + # + # Default: + # - (macOS) Menlo + # - (Linux/BSD) monospace + # - (Windows) Consolas + family: monospace + + # The `style` can be specified to pick a specific face. + #style: Regular + + # Bold font face + # bold: + # Font family + # + # If the bold family is not specified, it will fall back to the + # value specified for the normal font. + #family: monospace + + # The `style` can be specified to pick a specific face. + #style: Bold + + # Italic font face + #italic: + # Font family + # + # If the italic family is not specified, it will fall back to the + # value specified for the normal font. + #family: monospace + + # The `style` can be specified to pick a specific face. + #style: Italic + + # Bold italic font face + #bold_italic: + # Font family + # + # If the bold italic family is not specified, it will fall back to the + # value specified for the normal font. + #family: monospace + + # The `style` can be specified to pick a specific face. + #style: Bold Italic + + # Point size + size: 10.0 + + # Offset is the extra space around each character. `offset.y` can be thought + # of as modifying the line spacing, and `offset.x` as modifying the letter + # spacing. + offset: + x: 0 + y: 0 + + # Glyph offset determines the locations of the glyphs within their cells with + # the default being at the bottom. Increasing `x` moves the glyph to the + # right, increasing `y` moves the glyph upward. + #glyph_offset: + # x: 0 + # y: 0 + + # Thin stroke font rendering (macOS only) + # + # Thin strokes are suitable for retina displays, but for non-retina screens + # it is recommended to set `use_thin_strokes` to `false`. + #use_thin_strokes: true + + # Use built-in font for box drawing characters. + # + # If `true`, Alacritty will use a custom built-in font for box drawing + # characters (Unicode points 2500 - 259f). + # + # builtin_box_drawing: true + +# If `true`, bold text is drawn using the bright color variants. +#draw_bold_text_with_bright_colors: false + +# Colors (Tomorrow Night) +#colors: + # Default colors + #primary: + # background: '#1d1f21' + # foreground: '#c5c8c6' + + # Bright and dim foreground colors + # + # The dimmed foreground color is calculated automatically if it is not + # present. If the bright foreground color is not set, or + # `draw_bold_text_with_bright_colors` is `false`, the normal foreground + # color will be used. + #dim_foreground: '#828482' + #bright_foreground: '#eaeaea' + + # Cursor colors + # + # Colors which should be used to draw the terminal cursor. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #cursor: + # text: CellBackground + # cursor: CellForeground + + # Vi mode cursor colors + # + # Colors for the cursor when the vi mode is active. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #vi_mode_cursor: + # text: CellBackground + # cursor: CellForeground + + # Search colors + # + # Colors used for the search bar and match highlighting. + #search: + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #matches: + # foreground: '#000000' + # background: '#ffffff' + #focused_match: + # foreground: '#ffffff' + # background: '#000000' + + #bar: + # background: '#c5c8c6' + # foreground: '#1d1f21' + + # Keyboard regex hints + #hints: + # First character in the hint label + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #start: + # foreground: '#1d1f21' + # background: '#e9ff5e' + + # All characters after the first one in the hint label + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #end: + # foreground: '#e9ff5e' + # background: '#1d1f21' + + # Line indicator + # + # Color used for the indicator displaying the position in history during + # search and vi mode. + # + # By default, these will use the opposing primary color. + #line_indicator: + # foreground: None + # background: None + + # Selection colors + # + # Colors which should be used to draw the selection area. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + #selection: + # text: CellBackground + # background: CellForeground + + # Normal colors + #normal: + # black: '#1d1f21' + # red: '#cc6666' + # green: '#b5bd68' + # yellow: '#f0c674' + # blue: '#81a2be' + # magenta: '#b294bb' + # cyan: '#8abeb7' + # white: '#c5c8c6' + + # Bright colors + #bright: + # black: '#666666' + # red: '#d54e53' + # green: '#b9ca4a' + # yellow: '#e7c547' + # blue: '#7aa6da' + # magenta: '#c397d8' + # cyan: '#70c0b1' + # white: '#eaeaea' + + # Dim colors + # + # If the dim colors are not set, they will be calculated automatically based + # on the `normal` colors. + #dim: + # black: '#131415' + # red: '#864343' + # green: '#777c44' + # yellow: '#9e824c' + # blue: '#556a7d' + # magenta: '#75617b' + # cyan: '#5b7d78' + # white: '#828482' + + # Indexed Colors + # + # The indexed colors include all colors from 16 to 256. + # When these are not set, they're filled with sensible defaults. + # + # Example: + # `- { index: 16, color: '#ff00ff' }` + # + #indexed_colors: [] + + # Transparent cell backgrounds + # + # Whether or not `window.opacity` applies to all cell backgrounds or only to + # the default background. When set to `true` all cells will be transparent + # regardless of their background color. + #transparent_background_colors: false + +# Bell +# +# The bell is rung every time the BEL control character is received. +#bell: + # Visual Bell Animation + # + # Animation effect for flashing the screen when the visual bell is rung. + # + # Values for `animation`: + # - Ease + # - EaseOut + # - EaseOutSine + # - EaseOutQuad + # - EaseOutCubic + # - EaseOutQuart + # - EaseOutQuint + # - EaseOutExpo + # - EaseOutCirc + # - Linear + #animation: EaseOutExpo + + # Duration of the visual bell flash in milliseconds. A `duration` of `0` will + # disable the visual bell animation. + #duration: 0 + + # Visual bell animation color. + #color: '#ffffff' + + # Bell Command + # + # This program is executed whenever the bell is rung. + # + # When set to `command: None`, no command will be executed. + # + # Example: + # command: + # program: notify-send + # args: ["Hello, World!"] + # + #command: None + +#selection: + # This string contains all characters that are used as separators for + # "semantic words" in Alacritty. + #semantic_escape_chars: ",โ”‚`|:\"' ()[]{}<>\t" + + # When set to `true`, selected text will be copied to the primary clipboard. + #save_to_clipboard: false + +cursor: + # Cursor style + style: + # Cursor shape + # + # Values for `shape`: + # - โ–‡ Block + # - _ Underline + # - | Beam + shape: Block + + # Cursor blinking state + # + # Values for `blinking`: + # - Never: Prevent the cursor from ever blinking + # - Off: Disable blinking by default + # - On: Enable blinking by default + # - Always: Force the cursor to always blink + blinking: Off + + # Vi mode cursor style + # + # If the vi mode cursor style is `None` or not specified, it will fall back to + # the style of the active value of the normal cursor. + # + # See `cursor.style` for available options. + #vi_mode_style: None + + # Cursor blinking interval in milliseconds. + #blink_interval: 750 + + # If this is `true`, the cursor will be rendered as a hollow box when the + # window is not focused. + #unfocused_hollow: true + + # Thickness of the cursor relative to the cell width as floating point number + # from `0.0` to `1.0`. + #thickness: 0.15 + +# Live config reload (changes require restart) +live_config_reload: true + +# Shell +# +# You can set `shell.program` to the path of your favorite shell, e.g. +# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the +# shell. +# +# Default: +# - (macOS) /bin/bash --login +# - (Linux/BSD) user login shell +# - (Windows) powershell +# shell: +# program: /bin/bash + # args: + # - --login + +# Startup directory +# +# Directory the shell is started in. If this is unset, or `None`, the working +# directory of the parent process will be used. +#working_directory: None + +# Send ESC (\x1b) before characters when alt is pressed. +#alt_send_esc: true + +# Offer IPC using `alacritty msg` (unix only) +#ipc_socket: true + +#mouse: + # Click settings + # + # The `double_click` and `triple_click` settings control the time + # alacritty should wait for accepting multiple clicks as one double + # or triple click. + #double_click: { threshold: 300 } + #triple_click: { threshold: 300 } + + # If this is `true`, the cursor is temporarily hidden when typing. + #hide_when_typing: false + +# Regex hints +# +# Terminal hints can be used to find text in the visible part of the terminal +# and pipe it to other applications. +hints: + # Keys used for the hint labels. + #alphabet: "jfkdls;ahgurieowpq" + + # List with all available hints + # + # Each hint must have a `regex` and either an `action` or a `command` field. + # The fields `mouse`, `binding` and `post_processing` are optional. + # + # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and + # `mouse.mods` accept the same values as they do in the `key_bindings` section. + # + # The `mouse.enabled` field controls if the hint should be underlined while + # the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. + # + # If the `post_processing` field is set to `true`, heuristics will be used to + # shorten the match if there are characters likely not to be part of the hint + # (e.g. a trailing `.`). This is most useful for URIs. + # + # Values for `action`: + # - Copy + # Copy the hint's text to the clipboard. + # - Paste + # Paste the hint's text to the terminal or search. + # - Select + # Select the hint's text. + # - MoveViModeCursor + # Move the vi mode cursor to the beginning of the hint. + enabled: + - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ + [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^โŸจโŸฉ`]+" + command: xdg-open + post_processing: true + mouse: + enabled: true + mods: Control + binding: + key: U + mods: Control|Shift + - regex: "([0-9a-f]{12,128})|([[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3})" + action: Copy + post_processing: false + binding: + key: I + mods: Control|Shift + +# Mouse bindings are specified as a list of objects, much like the key +# bindings further below. +# +# To trigger mouse bindings when an application running within Alacritty +# captures the mouse, the `Shift` modifier is automatically added as a +# requirement. +# +# Each mouse binding will specify a: +# +# - `mouse`: +# +# - Middle +# - Left +# - Right +# - Numeric identifier such as `5` +# +# - `action` (see key bindings for actions not exclusive to mouse mode) +# +# - Mouse exclusive actions: +# +# - ExpandSelection +# Expand the selection to the current mouse cursor location. +# +# And optionally: +# +# - `mods` (see key bindings) +#mouse_bindings: +# - { mouse: Right, action: ExpandSelection } +# - { mouse: Right, mods: Control, action: ExpandSelection } +# - { mouse: Middle, mode: ~Vi, action: PasteSelection } + +# Key bindings +# +# Key bindings are specified as a list of objects. For example, this is the +# default paste binding: +# +# `- { key: V, mods: Control|Shift, action: Paste }` +# +# Each key binding will specify a: +# +# - `key`: Identifier of the key pressed +# +# - A-Z +# - F1-F24 +# - Key0-Key9 +# +# A full list with available key codes can be found here: +# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants +# +# Instead of using the name of the keys, the `key` field also supports using +# the scancode of the desired key. Scancodes have to be specified as a +# decimal number. This command will allow you to display the hex scancodes +# for certain keys: +# +# `showkey --scancodes`. +# +# Then exactly one of: +# +# - `chars`: Send a byte sequence to the running application +# +# The `chars` field writes the specified string to the terminal. This makes +# it possible to pass escape sequences. To find escape codes for bindings +# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside +# of tmux. Note that applications use terminfo to map escape sequences back +# to keys. It is therefore required to update the terminfo when changing an +# escape sequence. +# +# - `action`: Execute a predefined action +# +# - ToggleViMode +# - SearchForward +# Start searching toward the right of the search origin. +# - SearchBackward +# Start searching toward the left of the search origin. +# - Copy +# - Paste +# - IncreaseFontSize +# - DecreaseFontSize +# - ResetFontSize +# - ScrollPageUp +# - ScrollPageDown +# - ScrollHalfPageUp +# - ScrollHalfPageDown +# - ScrollLineUp +# - ScrollLineDown +# - ScrollToTop +# - ScrollToBottom +# - ClearHistory +# Remove the terminal's scrollback history. +# - Hide +# Hide the Alacritty window. +# - Minimize +# Minimize the Alacritty window. +# - Quit +# Quit Alacritty. +# - ToggleFullscreen +# - SpawnNewInstance +# Spawn a new instance of Alacritty. +# - CreateNewWindow +# Create a new Alacritty window from the current process. +# - ClearLogNotice +# Clear Alacritty's UI warning and error notice. +# - ClearSelection +# Remove the active selection. +# - ReceiveChar +# - None +# +# - Vi mode exclusive actions: +# +# - Open +# Perform the action of the first matching hint under the vi mode cursor +# with `mouse.enabled` set to `true`. +# - ToggleNormalSelection +# - ToggleLineSelection +# - ToggleBlockSelection +# - ToggleSemanticSelection +# Toggle semantic selection based on `selection.semantic_escape_chars`. +# +# - Vi mode exclusive cursor motion actions: +# +# - Up +# One line up. +# - Down +# One line down. +# - Left +# One character left. +# - Right +# One character right. +# - First +# First column, or beginning of the line when already at the first column. +# - Last +# Last column, or beginning of the line when already at the last column. +# - FirstOccupied +# First non-empty cell in this terminal row, or first non-empty cell of +# the line when already at the first cell of the row. +# - High +# Top of the screen. +# - Middle +# Center of the screen. +# - Low +# Bottom of the screen. +# - SemanticLeft +# Start of the previous semantically separated word. +# - SemanticRight +# Start of the next semantically separated word. +# - SemanticLeftEnd +# End of the previous semantically separated word. +# - SemanticRightEnd +# End of the next semantically separated word. +# - WordLeft +# Start of the previous whitespace separated word. +# - WordRight +# Start of the next whitespace separated word. +# - WordLeftEnd +# End of the previous whitespace separated word. +# - WordRightEnd +# End of the next whitespace separated word. +# - Bracket +# Character matching the bracket at the cursor's location. +# - SearchNext +# Beginning of the next match. +# - SearchPrevious +# Beginning of the previous match. +# - SearchStart +# Start of the match to the left of the vi mode cursor. +# - SearchEnd +# End of the match to the right of the vi mode cursor. +# +# - Search mode exclusive actions: +# - SearchFocusNext +# Move the focus to the next search match. +# - SearchFocusPrevious +# Move the focus to the previous search match. +# - SearchConfirm +# - SearchCancel +# - SearchClear +# Reset the search regex. +# - SearchDeleteWord +# Delete the last word in the search regex. +# - SearchHistoryPrevious +# Go to the previous regex in the search history. +# - SearchHistoryNext +# Go to the next regex in the search history. +# +# - macOS exclusive actions: +# - ToggleSimpleFullscreen +# Enter fullscreen without occupying another space. +# +# - Linux/BSD exclusive actions: +# +# - CopySelection +# Copy from the selection buffer. +# - PasteSelection +# Paste from the selection buffer. +# +# - `command`: Fork and execute a specified command plus arguments +# +# The `command` field must be a map containing a `program` string and an +# `args` array of command line parameter strings. For example: +# `{ program: "alacritty", args: ["-e", "vttest"] }` +# +# And optionally: +# +# - `mods`: Key modifiers to filter binding actions +# - Command +# - Control +# - Option +# - Super +# - Shift +# - Alt +# +# Multiple `mods` can be combined using `|` like this: +# `mods: Control|Shift`. +# Whitespace and capitalization are relevant and must match the example. +# +# - `mode`: Indicate a binding for only specific terminal reported modes +# +# This is mainly used to send applications the correct escape sequences +# when in different modes. +# +# - AppCursor +# - AppKeypad +# - Search +# - Alt +# - Vi +# +# A `~` operator can be used before a mode to apply the binding whenever +# the mode is *not* active, e.g. `~Alt`. +# +# Bindings are always filled by default, but will be replaced when a new +# binding with the same triggers is defined. To unset a default binding, it can +# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for +# a no-op if you do not wish to receive input characters for that binding. +# +# If the same trigger is assigned to multiple actions, all of them are executed +# in the order they were defined in. +key_bindings: + - { key: F1, chars: ''} + #- { key: Paste, action: Paste } + #- { key: Copy, action: Copy } + #- { key: L, mods: Control, action: ClearLogNotice } + #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, } + #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } + #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, } + #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + + # Vi Mode + #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } + #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } + #- { key: Escape, mode: Vi|~Search, action: ClearSelection } + #- { key: I, mode: Vi|~Search, action: ToggleViMode } + #- { key: I, mode: Vi|~Search, action: ScrollToBottom } + #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } + #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } + #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } + #- { key: G, mode: Vi|~Search, action: ScrollToTop } + #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } + #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } + #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } + #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } + #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } + #- { key: Y, mode: Vi|~Search, action: Copy } + #- { key: Y, mode: Vi|~Search, action: ClearSelection } + #- { key: Copy, mode: Vi|~Search, action: ClearSelection } + #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } + #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } + #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } + #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } + #- { key: Return, mode: Vi|~Search, action: Open } + #- { key: K, mode: Vi|~Search, action: Up } + #- { key: J, mode: Vi|~Search, action: Down } + #- { key: H, mode: Vi|~Search, action: Left } + #- { key: L, mode: Vi|~Search, action: Right } + #- { key: Up, mode: Vi|~Search, action: Up } + #- { key: Down, mode: Vi|~Search, action: Down } + #- { key: Left, mode: Vi|~Search, action: Left } + #- { key: Right, mode: Vi|~Search, action: Right } + #- { key: Key0, mode: Vi|~Search, action: First } + #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } + #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } + #- { key: H, mods: Shift, mode: Vi|~Search, action: High } + #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } + #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } + #- { key: B, mode: Vi|~Search, action: SemanticLeft } + #- { key: W, mode: Vi|~Search, action: SemanticRight } + #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } + #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } + #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } + #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } + #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } + #- { key: Slash, mode: Vi|~Search, action: SearchForward } + #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } + #- { key: N, mode: Vi|~Search, action: SearchNext } + #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } + + # Search Mode + #- { key: Return, mode: Search|Vi, action: SearchConfirm } + #- { key: Escape, mode: Search, action: SearchCancel } + #- { key: C, mods: Control, mode: Search, action: SearchCancel } + #- { key: U, mods: Control, mode: Search, action: SearchClear } + #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } + #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } + #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } + #- { key: Up, mode: Search, action: SearchHistoryPrevious } + #- { key: Down, mode: Search, action: SearchHistoryNext } + #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } + #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } + + # (Windows, Linux, and BSD only) + #- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } + #- { key: C, mods: Control|Shift, action: Copy } + #- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } + #- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } + #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } + #- { key: Insert, mods: Shift, action: PasteSelection } + #- { key: Key0, mods: Control, action: ResetFontSize } + #- { key: Equals, mods: Control, action: IncreaseFontSize } + #- { key: Plus, mods: Control, action: IncreaseFontSize } + #- { key: NumpadAdd, mods: Control, action: IncreaseFontSize } + #- { key: Minus, mods: Control, action: DecreaseFontSize } + #- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } + + # (Windows only) + #- { key: Return, mods: Alt, action: ToggleFullscreen } + + # (macOS only) + #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } + #- { key: Key0, mods: Command, action: ResetFontSize } + #- { key: Equals, mods: Command, action: IncreaseFontSize } + #- { key: Plus, mods: Command, action: IncreaseFontSize } + #- { key: NumpadAdd, mods: Command, action: IncreaseFontSize } + #- { key: Minus, mods: Command, action: DecreaseFontSize } + #- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize } + #- { key: V, mods: Command, action: Paste } + #- { key: C, mods: Command, action: Copy } + #- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection } + #- { key: H, mods: Command, action: Hide } + #- { key: H, mods: Command|Alt, action: HideOtherApplications } + #- { key: M, mods: Command, action: Minimize } + #- { key: Q, mods: Command, action: Quit } + #- { key: W, mods: Command, action: Quit } + #- { key: N, mods: Command, action: SpawnNewInstance } + #- { key: F, mods: Command|Control, action: ToggleFullscreen } + #- { key: F, mods: Command, mode: ~Search, action: SearchForward } + #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } + +#debug: + # Display the time it takes to redraw each frame. + #render_timer: false + + # Keep the log file after quitting Alacritty. + #persistent_logging: false + + # Log level + # + # Values for `log_level`: + # - Off + # - Error + # - Warn + # - Info + # - Debug + # - Trace + #log_level: Warn + + # Print all received window events. + #print_events: false +# Copyright (c) 2017-present Arctic Ice Studio +# Copyright (c) 2017-present Sven Greb +# + +################################################################################# +# +# Project: Nord Alacritty +# Version: 0.1.0 +# Repository: https://github.com/arcticicestudio/nord-alacritty +# License: MIT +# References: +# https://github.com/alacritty/alacritty +# +colors: + primary: + background: '#2e3440' + foreground: '#d8dee9' + dim_foreground: '#a5abb6' + cursor: + text: '#2e3440' + cursor: '#d8dee9' + vimode_cursor: + text: '#2e3440' + cursor: '#d8dee9' + selection: + text: CellForeground + background: '#4c566a' + search: + matches: + foreground: CellBackground + background: '#88c0d0' + footer_bar: + background: '#434c5e' + foreground: '#d8dee9' + normal: + black: '#3b4252' + red: '#bf616a' + green: '#a3be8c' + yellow: '#ebcb8b' + blue: '#81a1c1' + magenta: '#b48ead' + cyan: '#88c0d0' + white: '#e5e9f0' + bright: + black: '#6c566a' + green: '#a5abb6' + cyan: '#8fbcbb' + white: '#eceff4' + dim: + black: '#373e4d' + red: '#94545d' + green: '#809575' + yellow: '#b29e75' + blue: '#68809a' + magenta: '#8c738c' + cyan: '#6d96a5' + white: '#aeb3bb' diff --git a/config/X/dunst/dunstrc b/config/X/dunst/dunstrc new file mode 100644 index 0000000..58a2753 --- /dev/null +++ b/config/X/dunst/dunstrc @@ -0,0 +1,456 @@ +# See dunst(5) for all configuration options + +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + # monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = keyboard + + ### Geometry ### + + # dynamic width from 0 to 300 + # width = (0, 300) + # constant width of 300 + width = (100,450) + + # The maximum height of a single notification, excluding the frame. + height = 80 + + # Position the notification in the top right corner + origin = top-center + + # Offset from the origin + offset = 10x26 + + # Scale factor. It is auto-detected if value is 0. + scale = 0 + + # Maximum number of notification (0 means no limit) + notification_limit = 3 + + ### Progress bar ### + + # Turn on the progess bar. It appears when a progress hint is passed with + # for example dunstify -h int:value:12 + progress_bar = true + + # Set the progress bar height. This includes the frame, so make sure + # it's at least twice as big as the frame width. + progress_bar_height = 10 + + # Set the frame width of the progress bar + progress_bar_frame_width = 1 + + # Set the minimum width for the progress bar + progress_bar_min_width = 150 + + # Set the maximum width for the progress bar + progress_bar_max_width = 300 + + + # Show how many messages are currently hidden (because of + # notification_limit). + indicate_hidden = yes + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing window manager is + # present (e.g. xcompmgr, compiz, etc.). (X11 only) + transparency = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + # If gap_size is greater than 0, this setting will be ignored. + separator_height = 2 + + # Padding between text and separator. + padding = 6 + + # Horizontal padding. + horizontal_padding = 8 + + # Padding between text and icon. + text_icon_padding = 0 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 1 + + # Defines color of the frame around the notification window. + frame_color = "#00000" + + # Size of gap to display between notifications - requires a compositor. + # If value is greater than 0, separator_height will be ignored and a border + # of size frame_width will be drawn around each notification instead. + # Click events on gaps do not currently propagate to applications below. + gap_size = 2 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort messages by urgency. + sort = yes + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # A client can set the 'transient' hint to bypass this. See the rules + # section for how to disable this if necessary + # idle_threshold = 120 + + ### Text ### + + font = mononoki nerd font mono 10 + + # The spacing between lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 11 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%b" + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = false + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = no + + ### Icons ### + + # Recursive icon lookup. You can set a single theme, instead of having to + # define all lookup paths. + enable_recursive_icon_lookup = true + + # Set icon theme (only used for recursive icon lookup) + icon_theme = Adwaita + # You can also set multiple icon themes, with the leftmost one being used first. + # icon_theme = "Adwaita, breeze" + + # Align icons left/right/top/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. Helpful + # for e.g. small files or high-dpi screens. In case of conflict, + # max_icon_size takes precedence over this. + min_icon_size = 16 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 32 + + # Paths to default icons (only neccesary when not using recursive icon lookup) + icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/xdg-open + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Define the corner radius of the notification window + # in pixel size. If the radius is 0, you have no rounded + # corners. + # The radius will be automatically lowered if it exceeds half of the + # notification height to avoid clipping text and/or icons. + corner_radius = 5 + + # Ignore the dbus closeNotification message. + # Useful to enforce the timeout set by dunst configuration. Without this + # parameter, an application may close the notification sent before the + # user defined timeout. + ignore_dbusclose = false + + ### Wayland ### + # These settings are Wayland-specific. They have no effect when using X11 + + # Uncomment this if you want to let notications appear under fullscreen + # applications (default: overlay) + # layer = top + + # Set this to true to use X11 output on Wayland. + force_xwayland = false + + ### Legacy + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + + ### mouse + + # Defines list of actions for each mouse event + # Possible values are: + # * none: Don't do anything. + # * do_action: Invoke the action determined by the action_name rule. If there is no + # such action, open the context menu. + # * open_url: If the notification has exactly one url, open it. If there are multiple + # ones, open the context menu. + # * close_current: Close current notification. + # * close_all: Close all notifications. + # * context: Open context menu for the notification. + # * context_all: Open context menu for all notifications. + # These values can be strung together for each mouse event, and + # will be executed in sequence. + mouse_left_click = open_url + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + # Icon for notifications with low urgency, uncomment to enable + #default_icon = /path/to/icon + background = "#d08770" + foreground = "#2E3541" + frame_color = "#81a1c1" + timeout = 6 + +[urgency_normal] + background = "#393d4b" + foreground = "#80a0c0" + frame_color = "#81a1c1" + timeout = 5 + # Icon for notifications with normal urgency, uncomment to enable + #default_icon = /path/to/icon + +[urgency_critical] + background = "#b48ead" + foreground = "#d8dee9" + frame_color = "#81a1c1" + timeout = 0 + # Icon for notifications with critical urgency, uncomment to enable + #default_icon = /path/to/icon + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# +# Messages can be matched by +# appname (discouraged, see desktop_entry) +# body +# category +# desktop_entry +# icon +# match_transient +# msg_urgency +# stack_tag +# summary +# +# and you can override the +# background +# foreground +# format +# frame_color +# fullscreen +# new_icon +# set_stack_tag +# set_transient +# set_category +# timeout +# urgency +# icon_position +# skip_display +# history_ignore +# action_name +# word_wrap +# ellipsize +# alignment +# hide_text +# +# Shell-like globbing will get expanded. +# +# Instead of the appname filter, it's recommended to use the desktop_entry filter. +# GLib based applications export their desktop-entry name. In comparison to the appname, +# the desktop-entry won't get localized. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +# Disable the transient hint so that idle_threshold cannot be bypassed from the +# client +#[transient_disable] +# match_transient = yes +# set_transient = no +# +# Make the handling of transient notifications more strict by making them not +# be placed in history. +#[transient_history_ignore] +# match_transient = yes +# history_ignore = yes + +# fullscreen values +# show: show the notifications, regardless if there is a fullscreen window opened +# delay: displays the new notification, if there is no fullscreen window active +# If the notification is already drawn, it won't get undrawn. +# pushback: same as delay, but when switching into fullscreen, the notification will get +# withdrawn from screen again and will get delayed like a new notification +#[fullscreen_delay_everything] +# fullscreen = delay +#[fullscreen_show_critical] +# msg_urgency = critical +# fullscreen = show + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# skip_display = true + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[skip-display] +# # This notification will not be displayed, but will be included in the history +# summary = "foobar" +# skip_display = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[stack-volumes] +# appname = "some_volume_notifiers" +# set_stack_tag = "volume" +# +# vim: ft=cfg diff --git a/config/X/mpv/input.conf b/config/X/mpv/input.conf new file mode 100644 index 0000000..9de1b1b --- /dev/null +++ b/config/X/mpv/input.conf @@ -0,0 +1,204 @@ +# mpv keybindings +# +# Location of user-defined bindings: ~/.config/mpv/input.conf +# +# Lines starting with # are comments. Use SHARP to assign the # key. +# Copy this file and uncomment and edit the bindings you want to change. +# +# List of commands and further details: DOCS/man/input.rst +# List of special keys: --input-keylist +# Keybindings testing mode: mpv --input-test --force-window --idle +# +# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore'). +# +# Strings need to be quoted and escaped: +# KEY show-text "This is a single backslash: \\ and a quote: \" !" +# +# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with +# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal). +# +# The default keybindings are hardcoded into the mpv binary. +# You can disable them completely with: --no-input-default-bindings + +# Developer note: +# On compilation, this file is baked into the mpv binary, and all lines are +# uncommented (unless '#' is followed by a space) - thus this file defines the +# default key bindings. + +# If this is enabled, treat all the following bindings as default. +#default-bindings start + +#MBTN_LEFT ignore # don't do anything +#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen +#MBTN_RIGHT cycle pause # toggle pause/playback mode +#MBTN_BACK playlist-prev # skip to the previous file +#MBTN_FORWARD playlist-next # skip to the next file + +# Mouse wheels, touchpad or other input devices that have axes +# if the input devices supports precise scrolling it will also scale the +# numeric value accordingly +#WHEEL_UP seek 10 # seek 10 seconds forward +#WHEEL_DOWN seek -10 # seek 10 seconds backward +#WHEEL_LEFT add volume -2 +#WHEEL_RIGHT add volume 2 + +## Seek units are in seconds, but note that these are limited by keyframes +#RIGHT seek 5 # seek 5 seconds forward +#LEFT seek -5 # seek 5 seconds backward +#UP seek 60 # seek 1 minute forward +#DOWN seek -60 # seek 1 minute backward +# Do smaller, always exact (non-keyframe-limited), seeks with shift. +# Don't show them on the OSD (no-osd). +#Shift+RIGHT no-osd seek 1 exact # seek exactly 1 second forward +#Shift+LEFT no-osd seek -1 exact # seek exactly 1 second backward +#Shift+UP no-osd seek 5 exact # seek exactly 5 seconds forward +#Shift+DOWN no-osd seek -5 exact # seek exactly 5 seconds backward +#Ctrl+LEFT no-osd sub-seek -1 # seek to the previous subtitle +#Ctrl+RIGHT no-osd sub-seek 1 # seek to the next subtitle +#Ctrl+Shift+LEFT sub-step -1 # change subtitle timing such that the previous subtitle is displayed +#Ctrl+Shift+RIGHT sub-step 1 # change subtitle timing such that the next subtitle is displayed +#Alt+left add video-pan-x 0.1 # move the video right +#Alt+right add video-pan-x -0.1 # move the video left +#Alt+up add video-pan-y 0.1 # move the video down +#Alt+down add video-pan-y -0.1 # move the video up +#Alt++ add video-zoom 0.1 # zoom in +#Alt+- add video-zoom -0.1 # zoom out +#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings +#PGUP add chapter 1 # seek to the next chapter +#PGDWN add chapter -1 # seek to the previous chapter +#Shift+PGUP seek 600 # seek 10 minutes forward +#Shift+PGDWN seek -600 # seek 10 minutes backward +#[ multiply speed 1/1.1 # decrease the playback speed +#] multiply speed 1.1 # increase the playback speed +#{ multiply speed 0.5 # halve the playback speed +#} multiply speed 2.0 # double the playback speed +#BS set speed 1.0 # reset the speed to normal +#Shift+BS revert-seek # undo the previous (or marked) seek +#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek +#q quit +#Q quit-watch-later # exit and remember the playback position +#q {encode} quit 4 +#ESC set fullscreen no # leave fullscreen +#ESC {encode} quit 4 +#p cycle pause # toggle pause/playback mode +#. frame-step # advance one frame and pause +#, frame-back-step # go back by one frame and pause +#SPACE cycle pause # toggle pause/playback mode +#> playlist-next # skip to the next file +#ENTER playlist-next # skip to the next file +#< playlist-prev # skip to the previous file +#O no-osd cycle-values osd-level 3 1 # toggle displaying the OSD on user interaction or always +#o show-progress # show playback progress +#P show-progress # show playback progress +#i script-binding stats/display-stats # display information and statistics +#I script-binding stats/display-stats-toggle # toggle displaying information and statistics +#` script-binding console/enable # open the console +#z add sub-delay -0.1 # shift subtitles 100 ms earlier +#Z add sub-delay +0.1 # delay subtitles by 100 ms +#x add sub-delay +0.1 # delay subtitles by 100 ms +#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio +#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier +#Shift+g add sub-scale +0.1 # increase the subtitle font size +#Shift+f add sub-scale -0.1 # decrease the subtitle font size +#9 add volume -2 +#/ add volume -2 +#0 add volume 2 +#* add volume 2 +#m cycle mute # toggle mute +#1 add contrast -1 +#2 add contrast 1 +#3 add brightness -1 +#4 add brightness 1 +#5 add gamma -1 +#6 add gamma 1 +#7 add saturation -1 +#8 add saturation 1 +#Alt+0 set current-window-scale 0.5 # halve the window size +#Alt+1 set current-window-scale 1.0 # reset the window size +#Alt+2 set current-window-scale 2.0 # double the window size +#d cycle deinterlace # toggle the deinterlacing filter +#r add sub-pos -1 # move subtitles up +#R add sub-pos +1 # move subtitles down +#t add sub-pos +1 # move subtitles down +#v cycle sub-visibility # hide or show the subtitles +#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles +#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer +#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles +#j cycle sub # switch subtitle track +#J cycle sub down # switch subtitle track backwards +#SHARP cycle audio # switch audio track +#_ cycle video # switch video track +#T cycle ontop # toggle placing the video on top of other windows +#f cycle fullscreen # toggle fullscreen +#s screenshot # take a screenshot of the video in its original resolution with subtitles +#S screenshot video # take a screenshot of the video in its original resolution without subtitles +#Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles +#Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots +#w add panscan -0.1 # decrease panscan +#W add panscan +0.1 # shrink black bars by cropping the video +#e add panscan +0.1 # shrink black bars by cropping the video +#A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "-1" # cycle the video aspect ratio ("-1" is the container aspect) +#POWER quit +#PLAY cycle pause # toggle pause/playback mode +#PAUSE cycle pause # toggle pause/playback mode +#PLAYPAUSE cycle pause # toggle pause/playback mode +#PLAYONLY set pause no # unpause +#PAUSEONLY set pause yes # pause +#STOP quit +#FORWARD seek 60 # seek 1 minute forward +#REWIND seek -60 # seek 1 minute backward +#NEXT playlist-next # skip to the next file +#PREV playlist-prev # skip to the previous file +#VOLUME_UP add volume 2 +#VOLUME_DOWN add volume -2 +#MUTE cycle mute # toggle mute +#CLOSE_WIN quit +#CLOSE_WIN {encode} quit 4 +#ctrl+w quit +#E cycle edition # switch edition +#l ab-loop # set/clear A-B loop points +#L cycle-values loop-file "inf" "no" # toggle infinite looping +#ctrl+c quit 4 +#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always +#ctrl+h cycle-values hwdec "auto" "no" # toggle hardware decoding +#F8 show-text ${playlist} # show the playlist +#F9 show-text ${track-list} # show the list of video, audio and sub tracks + +# +# Legacy bindings (may or may not be removed in the future) +# +#! add chapter -1 # seek to the previous chapter +#@ add chapter 1 # seek to the next chapter + +# +# Not assigned by default +# (not an exhaustive list of unbound commands) +# + +# ? cycle sub-forced-only # toggle DVD forced subs +# ? stop # stop playback (quit or enter idle mode) +# + +q quit-watch-later + +# seeking +H add chapter -1 +L add chapter 1 +h seek -5 +l seek 5 +- seek -60 += seek 60 + +# Add/Decrease volume +j add volume -5 +k add volume 5 + +# Subtitles +c cycle sub # switch subtitle track up-order +C cycle sub down # switch subtitle track down-order +Alt+c cycle sub-visibility # Toggle subtitles + +# Cycle audio tracks +v cycle audio # switch audio track +V cycle audio # switch audio track +ctrl+l cycle-values loop-file "inf" "no" # toggle infinite looping diff --git a/config/X/mpv/mpv.conf b/config/X/mpv/mpv.conf new file mode 100755 index 0000000..034ec6a --- /dev/null +++ b/config/X/mpv/mpv.conf @@ -0,0 +1,28 @@ +profile=gpu-hq + +# Set OSD font +osd-font='Ubuntu Mono' +# Set OSD font size +osd-font-size=30 + +# Set volume to 100% on startup. +volume=60 + +# Set player max vol to 100%. +volume-max=100 + +# Set max streaming quality as 1080p. +ytdl-format=bestvideo[height<=?1080]+bestaudio/best + +# Default demuxer is 150/75 MB, note that this uses RAM so set a reasonable amount. +# 150MB, Max pre-load for network streams (1 MiB = 1048576 Bytes). +demuxer-max-bytes=150000000 + +# 75MB, Max loaded video kept after playback. +demuxer-max-back-bytes=75000000 + +# Force stream to be seekable even if disabled. +force-seekable=yes + +slang=eng, en, english +alang=jpn diff --git a/config/X/mpv/playfile.txt b/config/X/mpv/playfile.txt new file mode 100755 index 0000000..9cd1e1c --- /dev/null +++ b/config/X/mpv/playfile.txt @@ -0,0 +1,2 @@ +https://www.youtube.com/watch?v=0C6p5wQ5SwQ +https://www.youtube.com/watch?v=aEWptdD32iA diff --git a/config/X/mpv/scripts/script-opts/webm.conf b/config/X/mpv/scripts/script-opts/webm.conf new file mode 100644 index 0000000..9ea44dd --- /dev/null +++ b/config/X/mpv/scripts/script-opts/webm.conf @@ -0,0 +1,78 @@ +# Defaults to shift+w +keybind=W +# If empty, saves on the same directory of the playing video. +# A starting "~" will be replaced by the home dir. +# This field is delimited by double-square-brackets - [[ and ]] - instead of +# quotes, because Windows users might run into a issue when using +# backslashes as a path separator. Examples of valid inputs for this field +# would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows), +# and [[/home/john]] (on Unix-like systems eg. Linux). +# The [[]] delimiter is not needed when using from a configuration file +# in the script-opts folder. +output_directory= +run_detached=no +# Template string for the output file +# %f - Filename, with extension +# %F - Filename, without extension +# %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube). +# %s, %e - Start and end time, with milliseconds +# %S, %E - Start and end time, without milliseconds +# %M - "-audio", if audio is enabled, empty otherwise +# %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled. +# More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template +# Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion +output_template=%F-[%s-%e]%M +# Scale video to a certain height, keeping the aspect ratio. -1 disables it. +scale_height=-1 +# Change the FPS of the output video, dropping or duplicating frames as needed. +# -1 means the FPS will be unchanged from the source. +fps=-1 +# Target filesize, in kB. This will be used to calculate the bitrate +# used on the encode. If this is set to <= 0, the video bitrate will be set +# to 0, which might enable constant quality modes, depending on the +# video codec that's used (VP8 and VP9, for example). +target_filesize=2500 +# If true, will use stricter flags to ensure the resulting file doesn't +# overshoot the target filesize. Not recommended, as constrained quality +# mode should work well, unless you're really having trouble hitting +# the target size. +strict_filesize_constraint=no +strict_bitrate_multiplier=0.95 +# In kilobits. +strict_audio_bitrate=64 +# Sets the output format, from a few predefined ones. +# Currently we have: +# webm-vp8 (libvpx/libvorbis) +# webm-vp9 (libvpx-vp9/libopus) +# mp4 (h264/AAC) +# mp4-nvenc (h264-NVENC/AAC) +# raw (rawvideo/pcm_s16le). +# mp3 (libmp3lame) +# and gif +output_format=webm-vp8 +twopass=yes +# If set, applies the video filters currently used on the playback to the encode. +apply_current_filters=yes +# If set, writes the video's filename to the "Title" field on the metadata. +write_filename_on_metadata=no +# Set the number of encoding threads, for codecs libvpx and libvpx-vp9 +libvpx_threads=4 +additional_flags= +# Constant Rate Factor (CRF). The value meaning and limits may change, +# from codec to codec. Set to -1 to disable. +crf=10 +# Useful for flags that may impact output filesize, such as qmin, qmax etc +# Won't be applied when strict_filesize_constraint is on. +non_strict_additional_flags= +# Display the encode progress, in %. Requires run_detached to be disabled. +# On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms. +display_progress=auto +# The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc) +font_size=28 +margin=10 +message_duration=5 +# gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a) +gif_dither=2 +# Force square pixels on output video +# Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio +force_square_pixels=no diff --git a/config/X/mpv/scripts/script-opts/youtube-quality.conf b/config/X/mpv/scripts/script-opts/youtube-quality.conf new file mode 100755 index 0000000..b197714 --- /dev/null +++ b/config/X/mpv/scripts/script-opts/youtube-quality.conf @@ -0,0 +1,41 @@ +# KEY BINDINGS + +# invoke or dismiss the quality menu +toggle_menu_binding=ctrl+f +# move the menu cursor up +up_binding=UP +# move the menu cursor down +down_binding=DOWN +# select menu entry +select_binding=ENTER + +# formatting / cursors +selected_and_active=โ–ถ - +selected_and_inactive=โ— - +unselected_and_active=โ–ท - +unselected_and_inactive=โ—‹ - + +# font size scales by window, if false requires larger font and padding sizes +scale_playlist_by_window=false + +# playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua +# example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1 +# read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags +# undeclared tags will use default osd settings +# these styles will be used for the whole playlist. More specific styling will need to be hacked in +# +# (a monospaced font is recommended but not required) +style_ass_tags={\\fnUbuntu} + +# paddings for top left corner +text_padding_x=1 +text_padding_y=1 + +# how many seconds until the quality menu times out +menu_timeout=10 + +#use youtube-dl to fetch a list of available formats (overrides quality_strings) +fetch_formats=yes + +# list of ytdl-format strings to choose from +quality_strings=[ {"4320p" : "bestvideo[height<=?4320p]+bestaudio/best"}, {"2160p" : "bestvideo[height<=?2160]+bestaudio/best"}, {"1440p" : "bestvideo[height<=?1440]+bestaudio/best"}, {"1080p" : "bestvideo[height<=?1080]+bestaudio/best"}, {"720p" : "bestvideo[height<=?720]+bestaudio/best"}, {"480p" : "bestvideo[height<=?480]+bestaudio/best"}, {"360p" : "bestvideo[height<=?360]+bestaudio/best"}, {"240p" : "bestvideo[height<=?240]+bestaudio/best"}, {"144p" : "bestvideo[height<=?144]+bestaudio/best"} ] diff --git a/config/X/mpv/scripts/webm.lua b/config/X/mpv/scripts/webm.lua new file mode 100644 index 0000000..4397b9b --- /dev/null +++ b/config/X/mpv/scripts/webm.lua @@ -0,0 +1,2914 @@ +local mp = require("mp") +local assdraw = require("mp.assdraw") +local msg = require("mp.msg") +local utils = require("mp.utils") +local mpopts = require("mp.options") +local options = { + -- Defaults to shift+w + keybind = "W", + -- If empty, saves on the same directory of the playing video. + -- A starting "~" will be replaced by the home dir. + -- This field is delimited by double-square-brackets - [[ and ]] - instead of + -- quotes, because Windows users might run into a issue when using + -- backslashes as a path separator. Examples of valid inputs for this field + -- would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows), + -- and [[/home/john]] (on Unix-like systems eg. Linux). + -- The [[]] delimiter is not needed when using from a configuration file + -- in the script-opts folder. + output_directory = [[]], + run_detached = false, + -- Template string for the output file + -- %f - Filename, with extension + -- %F - Filename, without extension + -- %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube). + -- %s, %e - Start and end time, with milliseconds + -- %S, %E - Start and end time, without milliseconds + -- %M - "-audio", if audio is enabled, empty otherwise + -- %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled. + -- More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template + -- Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion + output_template = "%F-[%s-%e]%M", + -- Scale video to a certain height, keeping the aspect ratio. -1 disables it. + scale_height = -1, + -- Change the FPS of the output video, dropping or duplicating frames as needed. + -- -1 means the FPS will be unchanged from the source. + fps = -1, + -- Target filesize, in kB. This will be used to calculate the bitrate + -- used on the encode. If this is set to <= 0, the video bitrate will be set + -- to 0, which might enable constant quality modes, depending on the + -- video codec that's used (VP8 and VP9, for example). + target_filesize = 2500, + -- If true, will use stricter flags to ensure the resulting file doesn't + -- overshoot the target filesize. Not recommended, as constrained quality + -- mode should work well, unless you're really having trouble hitting + -- the target size. + strict_filesize_constraint = false, + strict_bitrate_multiplier = 0.95, + -- In kilobits. + strict_audio_bitrate = 64, + -- Sets the output format, from a few predefined ones. + -- Currently we have: + -- webm-vp8 (libvpx/libvorbis) + -- webm-vp9 (libvpx-vp9/libopus) + -- mp4 (h264/AAC) + -- mp4-nvenc (h264-NVENC/AAC) + -- raw (rawvideo/pcm_s16le). + -- mp3 (libmp3lame) + -- and gif + output_format = "webm-vp8", + twopass = true, + -- If set, applies the video filters currently used on the playback to the encode. + apply_current_filters = true, + -- If set, writes the video's filename to the "Title" field on the metadata. + write_filename_on_metadata = false, + -- Set the number of encoding threads, for codecs libvpx and libvpx-vp9 + libvpx_threads = 4, + additional_flags = "", + -- Constant Rate Factor (CRF). The value meaning and limits may change, + -- from codec to codec. Set to -1 to disable. + crf = 10, + -- Useful for flags that may impact output filesize, such as qmin, qmax etc + -- Won't be applied when strict_filesize_constraint is on. + non_strict_additional_flags = "", + -- Display the encode progress, in %. Requires run_detached to be disabled. + -- On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms. + display_progress = "auto", + -- The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc) + font_size = 28, + margin = 10, + message_duration = 5, + -- gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a) + gif_dither = 2, + -- Force square pixels on output video + -- Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio + force_square_pixels = false, +} + +mpopts.read_options(options) +local base64_chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' + +-- encoding +function base64_encode(data) + return ((data:gsub('.', function(x) + local r,b='',x:byte() + for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end + return r; + end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) + if (#x < 6) then return '' end + local c=0 + for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end + return base64_chars:sub(c+1,c+1) + end)..({ '', '==', '=' })[#data%3+1]) +end + +-- decoding +function base64_decode(data) + data = string.gsub(data, '[^'..base64_chars..'=]', '') + return (data:gsub('.', function(x) + if (x == '=') then return '' end + local r,f='',(base64_chars:find(x)-1) + for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end + return r; + end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x) + if (#x ~= 8) then return '' end + local c=0 + for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end + return string.char(c) + end)) +end +local emit_event +emit_event = function(event_name, ...) + return mp.commandv("script-message", "webm-" .. tostring(event_name), ...) +end +local test_set_options +test_set_options = function(new_options_json) + local new_options = utils.parse_json(new_options_json) + for k, v in pairs(new_options) do + options[k] = v + end +end +mp.register_script_message("mpv-webm-set-options", test_set_options) +local bold +bold = function(text) + return "{\\b1}" .. tostring(text) .. "{\\b0}" +end +local message +message = function(text, duration) + local ass = mp.get_property_osd("osd-ass-cc/0") + ass = ass .. text + return mp.osd_message(ass, duration or options.message_duration) +end +local append +append = function(a, b) + for _, val in ipairs(b) do + a[#a + 1] = val + end + return a +end +local seconds_to_time_string +seconds_to_time_string = function(seconds, no_ms, full) + if seconds < 0 then + return "unknown" + end + local ret = "" + if not (no_ms) then + ret = string.format(".%03d", seconds * 1000 % 1000) + end + ret = string.format("%02d:%02d%s", math.floor(seconds / 60) % 60, math.floor(seconds) % 60, ret) + if full or seconds > 3600 then + ret = string.format("%d:%s", math.floor(seconds / 3600), ret) + end + return ret +end +local seconds_to_path_element +seconds_to_path_element = function(seconds, no_ms, full) + local time_string = seconds_to_time_string(seconds, no_ms, full) + local _ + time_string, _ = time_string:gsub(":", ".") + return time_string +end +local file_exists +file_exists = function(name) + local info, err = utils.file_info(name) + if info ~= nil then + return true + end + return false +end +local expand_properties +expand_properties = function(text, magic) + if magic == nil then + magic = "$" + end + for prefix, raw, prop, colon, fallback, closing in text:gmatch("%" .. magic .. "{([?!]?)(=?)([^}:]*)(:?)([^}]*)(}*)}") do + local err + local prop_value + local compare_value + local original_prop = prop + local get_property = mp.get_property_osd + if raw == "=" then + get_property = mp.get_property + end + if prefix ~= "" then + for actual_prop, compare in prop:gmatch("(.-)==(.*)") do + prop = actual_prop + compare_value = compare + end + end + if colon == ":" then + prop_value, err = get_property(prop, fallback) + else + prop_value, err = get_property(prop, "(error)") + end + prop_value = tostring(prop_value) + if prefix == "?" then + if compare_value == nil then + prop_value = err == nil and fallback .. closing or "" + else + prop_value = prop_value == compare_value and fallback .. closing or "" + end + prefix = "%" .. prefix + elseif prefix == "!" then + if compare_value == nil then + prop_value = err ~= nil and fallback .. closing or "" + else + prop_value = prop_value ~= compare_value and fallback .. closing or "" + end + else + prop_value = prop_value .. closing + end + if colon == ":" then + local _ + text, _ = text:gsub("%" .. magic .. "{" .. prefix .. raw .. original_prop:gsub("%W", "%%%1") .. ":" .. fallback:gsub("%W", "%%%1") .. closing .. "}", expand_properties(prop_value)) + else + local _ + text, _ = text:gsub("%" .. magic .. "{" .. prefix .. raw .. original_prop:gsub("%W", "%%%1") .. closing .. "}", prop_value) + end + end + return text +end +local format_filename +format_filename = function(startTime, endTime, videoFormat) + local hasAudioCodec = videoFormat.audioCodec ~= "" + local replaceFirst = { + ["%%mp"] = "%%mH.%%mM.%%mS", + ["%%mP"] = "%%mH.%%mM.%%mS.%%mT", + ["%%p"] = "%%wH.%%wM.%%wS", + ["%%P"] = "%%wH.%%wM.%%wS.%%wT" + } + local replaceTable = { + ["%%wH"] = string.format("%02d", math.floor(startTime / (60 * 60))), + ["%%wh"] = string.format("%d", math.floor(startTime / (60 * 60))), + ["%%wM"] = string.format("%02d", math.floor(startTime / 60 % 60)), + ["%%wm"] = string.format("%d", math.floor(startTime / 60)), + ["%%wS"] = string.format("%02d", math.floor(startTime % 60)), + ["%%ws"] = string.format("%d", math.floor(startTime)), + ["%%wf"] = string.format("%s", startTime), + ["%%wT"] = string.sub(string.format("%.3f", startTime % 1), 3), + ["%%mH"] = string.format("%02d", math.floor(endTime / (60 * 60))), + ["%%mh"] = string.format("%d", math.floor(endTime / (60 * 60))), + ["%%mM"] = string.format("%02d", math.floor(endTime / 60 % 60)), + ["%%mm"] = string.format("%d", math.floor(endTime / 60)), + ["%%mS"] = string.format("%02d", math.floor(endTime % 60)), + ["%%ms"] = string.format("%d", math.floor(endTime)), + ["%%mf"] = string.format("%s", endTime), + ["%%mT"] = string.sub(string.format("%.3f", endTime % 1), 3), + ["%%f"] = mp.get_property("filename"), + ["%%F"] = mp.get_property("filename/no-ext"), + ["%%s"] = seconds_to_path_element(startTime), + ["%%S"] = seconds_to_path_element(startTime, true), + ["%%e"] = seconds_to_path_element(endTime), + ["%%E"] = seconds_to_path_element(endTime, true), + ["%%T"] = mp.get_property("media-title"), + ["%%M"] = (mp.get_property_native('aid') and not mp.get_property_native('mute') and hasAudioCodec) and '-audio' or '', + ["%%R"] = (options.scale_height ~= -1) and "-" .. tostring(options.scale_height) .. "p" or "-" .. tostring(mp.get_property_native('height')) .. "p", + ["%%t%%"] = "%%" + } + local filename = options.output_template + for format, value in pairs(replaceFirst) do + local _ + filename, _ = filename:gsub(format, value) + end + for format, value in pairs(replaceTable) do + local _ + filename, _ = filename:gsub(format, value) + end + if mp.get_property_bool("demuxer-via-network", false) then + local _ + filename, _ = filename:gsub("%%X{([^}]*)}", "%1") + filename, _ = filename:gsub("%%x", "") + else + local x = string.gsub(mp.get_property("stream-open-filename", ""), string.gsub(mp.get_property("filename", ""), "%W", "%%%1") .. "$", "") + local _ + filename, _ = filename:gsub("%%X{[^}]*}", x) + filename, _ = filename:gsub("%%x", x) + end + filename = expand_properties(filename, "%") + for format in filename:gmatch("%%t([aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ])") do + local _ + filename, _ = filename:gsub("%%t" .. format, os.date("%" .. format)) + end + local _ + filename, _ = filename:gsub("[<>:\"/\\|?*]", "") + return tostring(filename) .. "." .. tostring(videoFormat.outputExtension) +end +local parse_directory +parse_directory = function(dir) + local home_dir = os.getenv("HOME") + if not home_dir then + home_dir = os.getenv("USERPROFILE") + end + if not home_dir then + local drive = os.getenv("HOMEDRIVE") + local path = os.getenv("HOMEPATH") + if drive and path then + home_dir = utils.join_path(drive, path) + else + msg.warn("Couldn't find home dir.") + home_dir = "" + end + end + local _ + dir, _ = dir:gsub("^~", home_dir) + return dir +end +local is_windows = type(package) == "table" and type(package.config) == "string" and package.config:sub(1, 1) == "\\" +local trim +trim = function(s) + return s:match("^%s*(.-)%s*$") +end +local get_null_path +get_null_path = function() + if file_exists("/dev/null") then + return "/dev/null" + end + return "NUL" +end +local run_subprocess +run_subprocess = function(params) + local res = utils.subprocess(params) + msg.verbose("Command stdout: ") + msg.verbose(res.stdout) + if res.status ~= 0 then + msg.verbose("Command failed! Reason: ", res.error, " Killed by us? ", res.killed_by_us and "yes" or "no") + return false + end + return true +end +local shell_escape +shell_escape = function(args) + local ret = { } + for i, a in ipairs(args) do + local s = tostring(a) + if string.match(s, "[^A-Za-z0-9_/:=-]") then + if is_windows then + s = '"' .. string.gsub(s, '"', '"\\""') .. '"' + else + s = "'" .. string.gsub(s, "'", "'\\''") .. "'" + end + end + table.insert(ret, s) + end + local concat = table.concat(ret, " ") + if is_windows then + concat = '"' .. concat .. '"' + end + return concat +end +local run_subprocess_popen +run_subprocess_popen = function(command_line) + local command_line_string = shell_escape(command_line) + command_line_string = command_line_string .. " 2>&1" + msg.verbose("run_subprocess_popen: running " .. tostring(command_line_string)) + return io.popen(command_line_string) +end +local calculate_scale_factor +calculate_scale_factor = function() + local baseResY = 720 + local osd_w, osd_h = mp.get_osd_size() + return osd_h / baseResY +end +local should_display_progress +should_display_progress = function() + if options.display_progress == "auto" then + return not is_windows + end + return options.display_progress +end +local reverse +reverse = function(list) + local _accum_0 = { } + local _len_0 = 1 + local _max_0 = 1 + for _index_0 = #list, _max_0 < 0 and #list + _max_0 or _max_0, -1 do + local element = list[_index_0] + _accum_0[_len_0] = element + _len_0 = _len_0 + 1 + end + return _accum_0 +end +local get_pass_logfile_path +get_pass_logfile_path = function(encode_out_path) + return tostring(encode_out_path) .. "-video-pass1.log" +end +local dimensions_changed = true +local _video_dimensions = { } +local get_video_dimensions +get_video_dimensions = function() + if not (dimensions_changed) then + return _video_dimensions + end + local video_params = mp.get_property_native("video-out-params") + if not video_params then + return nil + end + dimensions_changed = false + local keep_aspect = mp.get_property_bool("keepaspect") + local w = video_params["w"] + local h = video_params["h"] + local dw = video_params["dw"] + local dh = video_params["dh"] + if mp.get_property_number("video-rotate") % 180 == 90 then + w, h = h, w + dw, dh = dh, dw + end + _video_dimensions = { + top_left = { }, + bottom_right = { }, + ratios = { } + } + local window_w, window_h = mp.get_osd_size() + if keep_aspect then + local unscaled = mp.get_property_native("video-unscaled") + local panscan = mp.get_property_number("panscan") + local fwidth = window_w + local fheight = math.floor(window_w / dw * dh) + if fheight > window_h or fheight < h then + local tmpw = math.floor(window_h / dh * dw) + if tmpw <= window_w then + fheight = window_h + fwidth = tmpw + end + end + local vo_panscan_area = window_h - fheight + local f_w = fwidth / fheight + local f_h = 1 + if vo_panscan_area == 0 then + vo_panscan_area = window_h - fwidth + f_w = 1 + f_h = fheight / fwidth + end + if unscaled or unscaled == "downscale-big" then + vo_panscan_area = 0 + if unscaled or (dw <= window_w and dh <= window_h) then + fwidth = dw + fheight = dh + end + end + local scaled_width = fwidth + math.floor(vo_panscan_area * panscan * f_w) + local scaled_height = fheight + math.floor(vo_panscan_area * panscan * f_h) + local split_scaling + split_scaling = function(dst_size, scaled_src_size, zoom, align, pan) + scaled_src_size = math.floor(scaled_src_size * 2 ^ zoom) + align = (align + 1) / 2 + local dst_start = math.floor((dst_size - scaled_src_size) * align + pan * scaled_src_size) + if dst_start < 0 then + dst_start = dst_start + 1 + end + local dst_end = dst_start + scaled_src_size + if dst_start >= dst_end then + dst_start = 0 + dst_end = 1 + end + return dst_start, dst_end + end + local zoom = mp.get_property_number("video-zoom") + local align_x = mp.get_property_number("video-align-x") + local pan_x = mp.get_property_number("video-pan-x") + _video_dimensions.top_left.x, _video_dimensions.bottom_right.x = split_scaling(window_w, scaled_width, zoom, align_x, pan_x) + local align_y = mp.get_property_number("video-align-y") + local pan_y = mp.get_property_number("video-pan-y") + _video_dimensions.top_left.y, _video_dimensions.bottom_right.y = split_scaling(window_h, scaled_height, zoom, align_y, pan_y) + else + _video_dimensions.top_left.x = 0 + _video_dimensions.bottom_right.x = window_w + _video_dimensions.top_left.y = 0 + _video_dimensions.bottom_right.y = window_h + end + _video_dimensions.ratios.w = w / (_video_dimensions.bottom_right.x - _video_dimensions.top_left.x) + _video_dimensions.ratios.h = h / (_video_dimensions.bottom_right.y - _video_dimensions.top_left.y) + return _video_dimensions +end +local set_dimensions_changed +set_dimensions_changed = function() + dimensions_changed = true +end +local monitor_dimensions +monitor_dimensions = function() + local properties = { + "keepaspect", + "video-out-params", + "video-unscaled", + "panscan", + "video-zoom", + "video-align-x", + "video-pan-x", + "video-align-y", + "video-pan-y", + "osd-width", + "osd-height" + } + for _, p in ipairs(properties) do + mp.observe_property(p, "native", set_dimensions_changed) + end +end +local clamp +clamp = function(min, val, max) + if val <= min then + return min + end + if val >= max then + return max + end + return val +end +local clamp_point +clamp_point = function(top_left, point, bottom_right) + return { + x = clamp(top_left.x, point.x, bottom_right.x), + y = clamp(top_left.y, point.y, bottom_right.y) + } +end +local VideoPoint +do + local _class_0 + local _base_0 = { + set_from_screen = function(self, sx, sy) + local d = get_video_dimensions() + local point = clamp_point(d.top_left, { + x = sx, + y = sy + }, d.bottom_right) + self.x = math.floor(d.ratios.w * (point.x - d.top_left.x) + 0.5) + self.y = math.floor(d.ratios.h * (point.y - d.top_left.y) + 0.5) + end, + to_screen = function(self) + local d = get_video_dimensions() + return { + x = math.floor(self.x / d.ratios.w + d.top_left.x + 0.5), + y = math.floor(self.y / d.ratios.h + d.top_left.y + 0.5) + } + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function(self) + self.x = -1 + self.y = -1 + end, + __base = _base_0, + __name = "VideoPoint" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + VideoPoint = _class_0 +end +local Region +do + local _class_0 + local _base_0 = { + is_valid = function(self) + return self.x > -1 and self.y > -1 and self.w > -1 and self.h > -1 + end, + set_from_points = function(self, p1, p2) + self.x = math.min(p1.x, p2.x) + self.y = math.min(p1.y, p2.y) + self.w = math.abs(p1.x - p2.x) + self.h = math.abs(p1.y - p2.y) + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function(self) + self.x = -1 + self.y = -1 + self.w = -1 + self.h = -1 + end, + __base = _base_0, + __name = "Region" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + Region = _class_0 +end +local make_fullscreen_region +make_fullscreen_region = function() + local r = Region() + local d = get_video_dimensions() + local a = VideoPoint() + local b = VideoPoint() + local xa, ya + do + local _obj_0 = d.top_left + xa, ya = _obj_0.x, _obj_0.y + end + a:set_from_screen(xa, ya) + local xb, yb + do + local _obj_0 = d.bottom_right + xb, yb = _obj_0.x, _obj_0.y + end + b:set_from_screen(xb, yb) + r:set_from_points(a, b) + return r +end +local read_double +read_double = function(bytes) + local sign = 1 + local mantissa = bytes[2] % 2 ^ 4 + for i = 3, 8 do + mantissa = mantissa * 256 + bytes[i] + end + if bytes[1] > 127 then + sign = -1 + end + local exponent = (bytes[1] % 128) * 2 ^ 4 + math.floor(bytes[2] / 2 ^ 4) + if exponent == 0 then + return 0 + end + mantissa = (math.ldexp(mantissa, -52) + 1) * sign + return math.ldexp(mantissa, exponent - 1023) +end +local write_double +write_double = function(num) + local bytes = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + } + if num == 0 then + return bytes + end + local anum = math.abs(num) + local mantissa, exponent = math.frexp(anum) + exponent = exponent - 1 + mantissa = mantissa * 2 - 1 + local sign = num ~= anum and 128 or 0 + exponent = exponent + 1023 + bytes[1] = sign + math.floor(exponent / 2 ^ 4) + mantissa = mantissa * 2 ^ 4 + local currentmantissa = math.floor(mantissa) + mantissa = mantissa - currentmantissa + bytes[2] = (exponent % 2 ^ 4) * 2 ^ 4 + currentmantissa + for i = 3, 8 do + mantissa = mantissa * 2 ^ 8 + currentmantissa = math.floor(mantissa) + mantissa = mantissa - currentmantissa + bytes[i] = currentmantissa + end + return bytes +end +local FirstpassStats +do + local _class_0 + local duration_multiplier, fields_before_duration, fields_after_duration + local _base_0 = { + get_duration = function(self) + local big_endian_binary_duration = reverse(self.binary_duration) + return read_double(reversed_binary_duration) / duration_multiplier + end, + set_duration = function(self, duration) + local big_endian_binary_duration = write_double(duration * duration_multiplier) + self.binary_duration = reverse(big_endian_binary_duration) + end, + _bytes_to_string = function(self, bytes) + return string.char(unpack(bytes)) + end, + as_binary_string = function(self) + local before_duration_string = self:_bytes_to_string(self.binary_data_before_duration) + local duration_string = self:_bytes_to_string(self.binary_duration) + local after_duration_string = self:_bytes_to_string(self.binary_data_after_duration) + return before_duration_string .. duration_string .. after_duration_string + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function(self, before_duration, duration, after_duration) + self.binary_data_before_duration = before_duration + self.binary_duration = duration + self.binary_data_after_duration = after_duration + end, + __base = _base_0, + __name = "FirstpassStats" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + local self = _class_0 + duration_multiplier = 10000000.0 + fields_before_duration = 16 + fields_after_duration = 1 + self.data_before_duration_size = function(self) + return fields_before_duration * 8 + end + self.data_after_duration_size = function(self) + return fields_after_duration * 8 + end + self.size = function(self) + return (fields_before_duration + 1 + fields_after_duration) * 8 + end + self.from_bytes = function(self, bytes) + local before_duration + do + local _accum_0 = { } + local _len_0 = 1 + local _max_0 = self:data_before_duration_size() + for _index_0 = 1, _max_0 < 0 and #bytes + _max_0 or _max_0 do + local b = bytes[_index_0] + _accum_0[_len_0] = b + _len_0 = _len_0 + 1 + end + before_duration = _accum_0 + end + local duration + do + local _accum_0 = { } + local _len_0 = 1 + local _max_0 = self:data_before_duration_size() + 8 + for _index_0 = self:data_before_duration_size() + 1, _max_0 < 0 and #bytes + _max_0 or _max_0 do + local b = bytes[_index_0] + _accum_0[_len_0] = b + _len_0 = _len_0 + 1 + end + duration = _accum_0 + end + local after_duration + do + local _accum_0 = { } + local _len_0 = 1 + for _index_0 = self:data_before_duration_size() + 8 + 1, #bytes do + local b = bytes[_index_0] + _accum_0[_len_0] = b + _len_0 = _len_0 + 1 + end + after_duration = _accum_0 + end + return self(before_duration, duration, after_duration) + end + FirstpassStats = _class_0 +end +local read_logfile_into_stats_array +read_logfile_into_stats_array = function(logfile_path) + local file = assert(io.open(logfile_path, "rb")) + local logfile_string = base64_decode(file:read()) + file:close() + local stats_size = FirstpassStats:size() + assert(logfile_string:len() % stats_size == 0) + local stats = { } + for offset = 1, #logfile_string, stats_size do + local bytes = { + logfile_string:byte(offset, offset + stats_size - 1) + } + assert(#bytes == stats_size) + stats[#stats + 1] = FirstpassStats:from_bytes(bytes) + end + return stats +end +local write_stats_array_to_logfile +write_stats_array_to_logfile = function(stats_array, logfile_path) + local file = assert(io.open(logfile_path, "wb")) + local logfile_string = "" + for _index_0 = 1, #stats_array do + local stat = stats_array[_index_0] + logfile_string = logfile_string .. stat:as_binary_string() + end + file:write(base64_encode(logfile_string)) + return file:close() +end +local vp8_patch_logfile +vp8_patch_logfile = function(logfile_path, encode_total_duration) + local stats_array = read_logfile_into_stats_array(logfile_path) + local average_duration = encode_total_duration / (#stats_array - 1) + for i = 1, #stats_array - 1 do + stats_array[i]:set_duration(average_duration) + end + stats_array[#stats_array]:set_duration(encode_total_duration) + return write_stats_array_to_logfile(stats_array, logfile_path) +end +local formats = { } +local Format +do + local _class_0 + local _base_0 = { + getPreFilters = function(self) + return { } + end, + getPostFilters = function(self) + return { } + end, + getFlags = function(self) + return { } + end, + getCodecFlags = function(self) + local codecs = { } + if self.videoCodec ~= "" then + codecs[#codecs + 1] = "--ovc=" .. tostring(self.videoCodec) + end + if self.audioCodec ~= "" then + codecs[#codecs + 1] = "--oac=" .. tostring(self.audioCodec) + end + return codecs + end, + postCommandModifier = function(self, command, region, startTime, endTime) + return command + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "Basic" + self.supportsTwopass = true + self.videoCodec = "" + self.audioCodec = "" + self.outputExtension = "" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "Format" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + Format = _class_0 +end +local RawVideo +do + local _class_0 + local _parent_0 = Format + local _base_0 = { + getColorspace = function(self) + local csp = mp.get_property("colormatrix") + local _exp_0 = csp + if "bt.601" == _exp_0 then + return "bt601" + elseif "bt.709" == _exp_0 then + return "bt709" + elseif "bt.2020" == _exp_0 then + return "bt2020" + elseif "smpte-240m" == _exp_0 then + return "smpte240m" + else + msg.info("Warning, unknown colorspace " .. tostring(csp) .. " detected, using bt.601.") + return "bt601" + end + end, + getPostFilters = function(self) + return { + "format=yuv444p16", + "lavfi-scale=in_color_matrix=" .. self:getColorspace(), + "format=bgr24" + } + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "Raw" + self.supportsTwopass = false + self.videoCodec = "rawvideo" + self.audioCodec = "pcm_s16le" + self.outputExtension = "avi" + self.acceptsBitrate = false + end, + __base = _base_0, + __name = "RawVideo", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + RawVideo = _class_0 +end +formats["raw"] = RawVideo() +local WebmVP8 +do + local _class_0 + local _parent_0 = Format + local _base_0 = { + getPreFilters = function(self) + local colormatrixFilter = { + ["bt.709"] = "bt709", + ["bt.2020"] = "bt2020", + ["smpte-240m"] = "smpte240m" + } + local ret = { } + local colormatrix = mp.get_property_native("video-params/colormatrix") + if colormatrixFilter[colormatrix] then + append(ret, { + "lavfi-colormatrix=" .. tostring(colormatrixFilter[colormatrix]) .. ":bt601" + }) + end + return ret + end, + getFlags = function(self) + return { + "--ovcopts-add=threads=" .. tostring(options.libvpx_threads), + "--ovcopts-add=auto-alt-ref=1", + "--ovcopts-add=lag-in-frames=25", + "--ovcopts-add=quality=good", + "--ovcopts-add=cpu-used=0" + } + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "WebM" + self.supportsTwopass = true + self.videoCodec = "libvpx" + self.audioCodec = "libvorbis" + self.outputExtension = "webm" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "WebmVP8", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + WebmVP8 = _class_0 +end +formats["webm-vp8"] = WebmVP8() +local WebmVP9 +do + local _class_0 + local _parent_0 = Format + local _base_0 = { + getFlags = function(self) + return { + "--ovcopts-add=threads=" .. tostring(options.libvpx_threads) + } + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "WebM (VP9)" + self.supportsTwopass = false + self.videoCodec = "libvpx-vp9" + self.audioCodec = "libopus" + self.outputExtension = "webm" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "WebmVP9", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + WebmVP9 = _class_0 +end +formats["webm-vp9"] = WebmVP9() +local MP4 +do + local _class_0 + local _parent_0 = Format + local _base_0 = { } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "MP4 (h264/AAC)" + self.supportsTwopass = true + self.videoCodec = "libx264" + self.audioCodec = "aac" + self.outputExtension = "mp4" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "MP4", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + MP4 = _class_0 +end +formats["mp4"] = MP4() +local MP4NVENC +do + local _class_0 + local _parent_0 = Format + local _base_0 = { } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "MP4 (h264-NVENC/AAC)" + self.supportsTwopass = true + self.videoCodec = "h264_nvenc" + self.audioCodec = "aac" + self.outputExtension = "mp4" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "MP4NVENC", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + MP4NVENC = _class_0 +end +formats["mp4-nvenc"] = MP4NVENC() +local MP3 +do + local _class_0 + local _parent_0 = Format + local _base_0 = { } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "MP3 (libmp3lame)" + self.supportsTwopass = false + self.videoCodec = "" + self.audioCodec = "libmp3lame" + self.outputExtension = "mp3" + self.acceptsBitrate = true + end, + __base = _base_0, + __name = "MP3", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + MP3 = _class_0 +end +formats["mp3"] = MP3() +local GIF +do + local _class_0 + local _parent_0 = Format + local _base_0 = { + postCommandModifier = function(self, command, region, startTime, endTime) + local new_command = { } + local start_ts = seconds_to_time_string(startTime, false, true) + local end_ts = seconds_to_time_string(endTime, false, true) + start_ts = start_ts:gsub(":", "\\\\:") + end_ts = end_ts:gsub(":", "\\\\:") + local cfilter = "[vid1]trim=start=" .. tostring(start_ts) .. ":end=" .. tostring(end_ts) .. "[vidtmp];" + if mp.get_property("deinterlace") == "yes" then + cfilter = cfilter .. "[vidtmp]yadif=mode=1[vidtmp];" + end + for _, v in ipairs(command) do + local _continue_0 = false + repeat + if v:match("^%-%-vf%-add=lavfi%-scale") or v:match("^%-%-vf%-add=lavfi%-crop") or v:match("^%-%-vf%-add=fps") or v:match("^%-%-vf%-add=lavfi%-eq") then + local n = v:gsub("^%-%-vf%-add=", ""):gsub("^lavfi%-", "") + cfilter = cfilter .. "[vidtmp]" .. tostring(n) .. "[vidtmp];" + else + if v:match("^%-%-video%-rotate=90") then + cfilter = cfilter .. "[vidtmp]transpose=1[vidtmp];" + else + if v:match("^%-%-video%-rotate=270") then + cfilter = cfilter .. "[vidtmp]transpose=2[vidtmp];" + else + if v:match("^%-%-video%-rotate=180") then + cfilter = cfilter .. "[vidtmp]transpose=1[vidtmp];[vidtmp]transpose=1[vidtmp];" + else + if v:match("^%-%-deinterlace=") then + _continue_0 = true + break + else + append(new_command, { + v + }) + _continue_0 = true + break + end + end + end + end + end + _continue_0 = true + until true + if not _continue_0 then + break + end + end + cfilter = cfilter .. "[vidtmp]split[topal][vidf];" + cfilter = cfilter .. "[topal]palettegen[pal];" + cfilter = cfilter .. "[vidf]fifo[vidf];" + if options.gif_dither == 6 then + cfilter = cfilter .. "[vidf][pal]paletteuse[vo]" + else + cfilter = cfilter .. "[vidf][pal]paletteuse=dither=bayer:bayer_scale=" .. tostring(options.gif_dither) .. ":diff_mode=rectangle[vo]" + end + append(new_command, { + "--lavfi-complex=" .. tostring(cfilter) + }) + return new_command + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.displayName = "GIF" + self.supportsTwopass = false + self.videoCodec = "gif" + self.audioCodec = "" + self.outputExtension = "gif" + self.acceptsBitrate = false + end, + __base = _base_0, + __name = "GIF", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + GIF = _class_0 +end +formats["gif"] = GIF() +local Page +do + local _class_0 + local _base_0 = { + add_keybinds = function(self) + if not self.keybinds then + return + end + for key, func in pairs(self.keybinds) do + mp.add_forced_key_binding(key, key, func, { + repeatable = true + }) + end + end, + remove_keybinds = function(self) + if not self.keybinds then + return + end + for key, _ in pairs(self.keybinds) do + mp.remove_key_binding(key) + end + end, + observe_properties = function(self) + self.sizeCallback = function() + return self:draw() + end + local properties = { + "keepaspect", + "video-out-params", + "video-unscaled", + "panscan", + "video-zoom", + "video-align-x", + "video-pan-x", + "video-align-y", + "video-pan-y", + "osd-width", + "osd-height" + } + for _index_0 = 1, #properties do + local p = properties[_index_0] + mp.observe_property(p, "native", self.sizeCallback) + end + end, + unobserve_properties = function(self) + if self.sizeCallback then + mp.unobserve_property(self.sizeCallback) + self.sizeCallback = nil + end + end, + clear = function(self) + local window_w, window_h = mp.get_osd_size() + mp.set_osd_ass(window_w, window_h, "") + return mp.osd_message("", 0) + end, + prepare = function(self) + return nil + end, + dispose = function(self) + return nil + end, + show = function(self) + if self.visible then + return + end + self.visible = true + self:observe_properties() + self:add_keybinds() + self:prepare() + self:clear() + return self:draw() + end, + hide = function(self) + if not self.visible then + return + end + self.visible = false + self:unobserve_properties() + self:remove_keybinds() + self:clear() + return self:dispose() + end, + setup_text = function(self, ass) + local scale = calculate_scale_factor() + local margin = options.margin * scale + ass:append("{\\an7}") + ass:pos(margin, margin) + return ass:append("{\\fs" .. tostring(options.font_size * scale) .. "}") + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function() end, + __base = _base_0, + __name = "Page" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + Page = _class_0 +end +local EncodeWithProgress +do + local _class_0 + local _parent_0 = Page + local _base_0 = { + draw = function(self) + local progress = 100 * ((self.currentTime - self.startTime) / self.duration) + local progressText = string.format("%d%%", progress) + local window_w, window_h = mp.get_osd_size() + local ass = assdraw.ass_new() + ass:new_event() + self:setup_text(ass) + ass:append("Encoding (" .. tostring(bold(progressText)) .. ")\\N") + return mp.set_osd_ass(window_w, window_h, ass.text) + end, + parseLine = function(self, line) + local matchTime = string.match(line, "Encode time[-]pos: ([0-9.]+)") + local matchExit = string.match(line, "Exiting... [(]([%a ]+)[)]") + if matchTime == nil and matchExit == nil then + return + end + if matchTime ~= nil and tonumber(matchTime) > self.currentTime then + self.currentTime = tonumber(matchTime) + end + if matchExit ~= nil then + self.finished = true + self.finishedReason = matchExit + end + end, + startEncode = function(self, command_line) + local copy_command_line + do + local _accum_0 = { } + local _len_0 = 1 + for _index_0 = 1, #command_line do + local arg = command_line[_index_0] + _accum_0[_len_0] = arg + _len_0 = _len_0 + 1 + end + copy_command_line = _accum_0 + end + append(copy_command_line, { + '--term-status-msg=Encode time-pos: ${=time-pos}\\n' + }) + self:show() + local processFd = run_subprocess_popen(copy_command_line) + for line in processFd:lines() do + msg.verbose(string.format('%q', line)) + self:parseLine(line) + self:draw() + end + processFd:close() + self:hide() + if self.finishedReason == "End of file" then + return true + end + return false + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self, startTime, endTime) + self.startTime = startTime + self.endTime = endTime + self.duration = endTime - startTime + self.currentTime = startTime + end, + __base = _base_0, + __name = "EncodeWithProgress", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + EncodeWithProgress = _class_0 +end +local get_active_tracks +get_active_tracks = function() + local accepted = { + video = true, + audio = not mp.get_property_bool("mute"), + sub = mp.get_property_bool("sub-visibility") + } + local active = { + video = { }, + audio = { }, + sub = { } + } + for _, track in ipairs(mp.get_property_native("track-list")) do + if track["selected"] and accepted[track["type"]] then + local count = #active[track["type"]] + active[track["type"]][count + 1] = track + end + end + return active +end +local filter_tracks_supported_by_format +filter_tracks_supported_by_format = function(active_tracks, format) + local has_video_codec = format.videoCodec ~= "" + local has_audio_codec = format.audioCodec ~= "" + local supported = { + video = has_video_codec and active_tracks["video"] or { }, + audio = has_audio_codec and active_tracks["audio"] or { }, + sub = has_video_codec and active_tracks["sub"] or { } + } + return supported +end +local append_track +append_track = function(out, track) + local external_flag = { + ["audio"] = "audio-file", + ["sub"] = "sub-file" + } + local internal_flag = { + ["video"] = "vid", + ["audio"] = "aid", + ["sub"] = "sid" + } + if track['external'] and string.len(track['external-filename']) <= 2048 then + return append(out, { + "--" .. tostring(external_flag[track['type']]) .. "=" .. tostring(track['external-filename']) + }) + else + return append(out, { + "--" .. tostring(internal_flag[track['type']]) .. "=" .. tostring(track['id']) + }) + end +end +local append_audio_tracks +append_audio_tracks = function(out, tracks) + local internal_tracks = { } + for _index_0 = 1, #tracks do + local track = tracks[_index_0] + if track['external'] then + append_track(out, track) + else + append(internal_tracks, { + track + }) + end + end + if #internal_tracks > 1 then + local filter_string = "" + for _index_0 = 1, #internal_tracks do + local track = internal_tracks[_index_0] + filter_string = filter_string .. "[aid" .. tostring(track['id']) .. "]" + end + filter_string = filter_string .. "amix[ao]" + return append(out, { + "--lavfi-complex=" .. tostring(filter_string) + }) + else + if #internal_tracks == 1 then + return append_track(out, internal_tracks[1]) + end + end +end +local get_scale_filters +get_scale_filters = function() + local filters = { } + if options.force_square_pixels then + append(filters, { + "lavfi-scale=iw*sar:ih" + }) + end + if options.scale_height > 0 then + append(filters, { + "lavfi-scale=-2:" .. tostring(options.scale_height) + }) + end + return filters +end +local get_fps_filters +get_fps_filters = function() + if options.fps > 0 then + return { + "fps=" .. tostring(options.fps) + } + end + return { } +end +local get_contrast_brightness_and_saturation_filters +get_contrast_brightness_and_saturation_filters = function() + local mpv_brightness = mp.get_property("brightness") + local mpv_contrast = mp.get_property("contrast") + local mpv_saturation = mp.get_property("saturation") + if mpv_brightness == 0 and mpv_contrast == 0 and mpv_saturation == 0 then + return { } + end + local eq_saturation = (mpv_saturation + 100) / 100.0 + local eq_contrast = (mpv_contrast + 100) / 100.0 + local eq_brightness = (mpv_brightness / 50.0 + eq_contrast - 1) / 2.0 + return { + "lavfi-eq=contrast=" .. tostring(eq_contrast) .. ":saturation=" .. tostring(eq_saturation) .. ":brightness=" .. tostring(eq_brightness) + } +end +local append_property +append_property = function(out, property_name, option_name) + option_name = option_name or property_name + local prop = mp.get_property(property_name) + if prop and prop ~= "" then + return append(out, { + "--" .. tostring(option_name) .. "=" .. tostring(prop) + }) + end +end +local append_list_options +append_list_options = function(out, property_name, option_prefix) + option_prefix = option_prefix or property_name + local prop = mp.get_property_native(property_name) + if prop then + for _index_0 = 1, #prop do + local value = prop[_index_0] + append(out, { + "--" .. tostring(option_prefix) .. "-append=" .. tostring(value) + }) + end + end +end +local get_playback_options +get_playback_options = function() + local ret = { } + append_property(ret, "sub-ass-override") + append_property(ret, "sub-ass-force-style") + append_property(ret, "sub-ass-vsfilter-aspect-compat") + append_property(ret, "sub-auto") + append_property(ret, "sub-pos") + append_property(ret, "sub-delay") + append_property(ret, "video-rotate") + append_property(ret, "ytdl-format") + append_property(ret, "deinterlace") + return ret +end +local get_speed_flags +get_speed_flags = function() + local ret = { } + local speed = mp.get_property_native("speed") + if speed ~= 1 then + append(ret, { + "--vf-add=setpts=PTS/" .. tostring(speed), + "--af-add=atempo=" .. tostring(speed), + "--sub-speed=1/" .. tostring(speed) + }) + end + return ret +end +local get_metadata_flags +get_metadata_flags = function() + local title = mp.get_property("filename/no-ext") + return { + "--oset-metadata=title=%" .. tostring(string.len(title)) .. "%" .. tostring(title) + } +end +local apply_current_filters +apply_current_filters = function(filters) + local vf = mp.get_property_native("vf") + msg.verbose("apply_current_filters: got " .. tostring(#vf) .. " currently applied.") + for _index_0 = 1, #vf do + local _continue_0 = false + repeat + local filter = vf[_index_0] + msg.verbose("apply_current_filters: filter name: " .. tostring(filter['name'])) + if filter["enabled"] == false then + _continue_0 = true + break + end + local str = filter["name"] + local params = filter["params"] or { } + for k, v in pairs(params) do + str = str .. ":" .. tostring(k) .. "=%" .. tostring(string.len(v)) .. "%" .. tostring(v) + end + append(filters, { + str + }) + _continue_0 = true + until true + if not _continue_0 then + break + end + end +end +local get_video_filters +get_video_filters = function(format, region) + local filters = { } + append(filters, format:getPreFilters()) + if options.apply_current_filters then + apply_current_filters(filters) + end + if region and region:is_valid() then + append(filters, { + "lavfi-crop=" .. tostring(region.w) .. ":" .. tostring(region.h) .. ":" .. tostring(region.x) .. ":" .. tostring(region.y) + }) + end + append(filters, get_scale_filters()) + append(filters, get_fps_filters()) + append(filters, get_contrast_brightness_and_saturation_filters()) + append(filters, format:getPostFilters()) + return filters +end +local get_video_encode_flags +get_video_encode_flags = function(format, region) + local flags = { } + append(flags, get_playback_options()) + local filters = get_video_filters(format, region) + for _index_0 = 1, #filters do + local f = filters[_index_0] + append(flags, { + "--vf-add=" .. tostring(f) + }) + end + append(flags, get_speed_flags()) + return flags +end +local calculate_bitrate +calculate_bitrate = function(active_tracks, format, length) + if format.videoCodec == "" then + return nil, options.target_filesize * 8 / length + end + local video_kilobits = options.target_filesize * 8 + local audio_kilobits = nil + local has_audio_track = #active_tracks["audio"] > 0 + if options.strict_filesize_constraint and has_audio_track then + audio_kilobits = length * options.strict_audio_bitrate + video_kilobits = video_kilobits - audio_kilobits + end + local video_bitrate = math.floor(video_kilobits / length) + local audio_bitrate = audio_kilobits and math.floor(audio_kilobits / length) or nil + return video_bitrate, audio_bitrate +end +local find_path +find_path = function(startTime, endTime) + local path = mp.get_property('path') + if not path then + return nil, nil, nil, nil, nil + end + local is_stream = not file_exists(path) + local is_temporary = false + if is_stream then + if mp.get_property('file-format') == 'hls' then + path = utils.join_path(parse_directory('~'), 'cache_dump.ts') + mp.command_native({ + 'dump_cache', + seconds_to_time_string(startTime, false, true), + seconds_to_time_string(endTime + 5, false, true), + path + }) + endTime = endTime - startTime + startTime = 0 + is_temporary = true + end + end + return path, is_stream, is_temporary, startTime, endTime +end +local encode +encode = function(region, startTime, endTime) + local format = formats[options.output_format] + local originalStartTime = startTime + local originalEndTime = endTime + local path, is_stream, is_temporary + path, is_stream, is_temporary, startTime, endTime = find_path(startTime, endTime) + if not path then + message("No file is being played") + return + end + local command = { + "mpv", + path, + "--start=" .. seconds_to_time_string(startTime, false, true), + "--end=" .. seconds_to_time_string(endTime, false, true), + "--loop-file=no", + "--no-pause" + } + append(command, format:getCodecFlags()) + local active_tracks = get_active_tracks() + local supported_active_tracks = filter_tracks_supported_by_format(active_tracks, format) + for track_type, tracks in pairs(supported_active_tracks) do + if track_type == "audio" then + append_audio_tracks(command, tracks) + else + for _index_0 = 1, #tracks do + local track = tracks[_index_0] + append_track(command, track) + end + end + end + for track_type, tracks in pairs(supported_active_tracks) do + local _continue_0 = false + repeat + if #tracks > 0 then + _continue_0 = true + break + end + local _exp_0 = track_type + if "video" == _exp_0 then + append(command, { + "--vid=no" + }) + elseif "audio" == _exp_0 then + append(command, { + "--aid=no" + }) + elseif "sub" == _exp_0 then + append(command, { + "--sid=no" + }) + end + _continue_0 = true + until true + if not _continue_0 then + break + end + end + if format.videoCodec ~= "" then + append(command, get_video_encode_flags(format, region)) + end + append(command, format:getFlags()) + if options.write_filename_on_metadata then + append(command, get_metadata_flags()) + end + if format.acceptsBitrate then + if options.target_filesize > 0 then + local length = endTime - startTime + local video_bitrate, audio_bitrate = calculate_bitrate(supported_active_tracks, format, length) + if video_bitrate then + append(command, { + "--ovcopts-add=b=" .. tostring(video_bitrate) .. "k" + }) + end + if audio_bitrate then + append(command, { + "--oacopts-add=b=" .. tostring(audio_bitrate) .. "k" + }) + end + if options.strict_filesize_constraint then + local type = format.videoCodec ~= "" and "ovc" or "oac" + append(command, { + "--" .. tostring(type) .. "opts-add=minrate=" .. tostring(bitrate) .. "k", + "--" .. tostring(type) .. "opts-add=maxrate=" .. tostring(bitrate) .. "k" + }) + end + else + local type = format.videoCodec ~= "" and "ovc" or "oac" + append(command, { + "--" .. tostring(type) .. "opts-add=b=0" + }) + end + end + for token in string.gmatch(options.additional_flags, "[^%s]+") do + command[#command + 1] = token + end + if not options.strict_filesize_constraint then + for token in string.gmatch(options.non_strict_additional_flags, "[^%s]+") do + command[#command + 1] = token + end + if options.crf >= 0 then + append(command, { + "--ovcopts-add=crf=" .. tostring(options.crf) + }) + end + end + local dir = "" + if is_stream then + dir = parse_directory("~") + else + local _ + dir, _ = utils.split_path(path) + end + if options.output_directory ~= "" then + dir = parse_directory(options.output_directory) + end + local formatted_filename = format_filename(originalStartTime, originalEndTime, format) + local out_path = utils.join_path(dir, formatted_filename) + append(command, { + "--o=" .. tostring(out_path) + }) + emit_event("encode-started") + if options.twopass and format.supportsTwopass and not is_stream then + local first_pass_cmdline + do + local _accum_0 = { } + local _len_0 = 1 + for _index_0 = 1, #command do + local arg = command[_index_0] + _accum_0[_len_0] = arg + _len_0 = _len_0 + 1 + end + first_pass_cmdline = _accum_0 + end + append(first_pass_cmdline, { + "--ovcopts-add=flags=+pass1" + }) + message("Starting first pass...") + msg.verbose("First-pass command line: ", table.concat(first_pass_cmdline, " ")) + local res = run_subprocess({ + args = first_pass_cmdline, + cancellable = false + }) + if not res then + message("First pass failed! Check the logs for details.") + emit_event("encode-finished", "fail") + return + end + append(command, { + "--ovcopts-add=flags=+pass2" + }) + if format.videoCodec == "libvpx" then + msg.verbose("Patching libvpx pass log file...") + vp8_patch_logfile(get_pass_logfile_path(out_path), endTime - startTime) + end + end + command = format:postCommandModifier(command, region, startTime, endTime) + msg.info("Encoding to", out_path) + msg.verbose("Command line:", table.concat(command, " ")) + if options.run_detached then + message("Started encode, process was detached.") + return utils.subprocess_detached({ + args = command + }) + else + local res = false + if not should_display_progress() then + message("Started encode...") + res = run_subprocess({ + args = command, + cancellable = false + }) + else + local ewp = EncodeWithProgress(startTime, endTime) + res = ewp:startEncode(command) + end + if res then + message("Encoded successfully! Saved to\\N" .. tostring(bold(out_path))) + emit_event("encode-finished", "success") + else + message("Encode failed! Check the logs for details.") + emit_event("encode-finished", "fail") + end + os.remove(get_pass_logfile_path(out_path)) + if is_temporary then + return os.remove(path) + end + end +end +local CropPage +do + local _class_0 + local _parent_0 = Page + local _base_0 = { + reset = function(self) + local dimensions = get_video_dimensions() + local xa, ya + do + local _obj_0 = dimensions.top_left + xa, ya = _obj_0.x, _obj_0.y + end + self.pointA:set_from_screen(xa, ya) + local xb, yb + do + local _obj_0 = dimensions.bottom_right + xb, yb = _obj_0.x, _obj_0.y + end + self.pointB:set_from_screen(xb, yb) + if self.visible then + return self:draw() + end + end, + setPointA = function(self) + local posX, posY = mp.get_mouse_pos() + self.pointA:set_from_screen(posX, posY) + if self.visible then + return self:draw() + end + end, + setPointB = function(self) + local posX, posY = mp.get_mouse_pos() + self.pointB:set_from_screen(posX, posY) + if self.visible then + return self:draw() + end + end, + cancel = function(self) + self:hide() + return self.callback(false, nil) + end, + finish = function(self) + local region = Region() + region:set_from_points(self.pointA, self.pointB) + self:hide() + return self.callback(true, region) + end, + draw_box = function(self, ass) + local region = Region() + region:set_from_points(self.pointA:to_screen(), self.pointB:to_screen()) + local d = get_video_dimensions() + ass:new_event() + ass:append("{\\an7}") + ass:pos(0, 0) + ass:append('{\\bord0}') + ass:append('{\\shad0}') + ass:append('{\\c&H000000&}') + ass:append('{\\alpha&H77}') + ass:draw_start() + ass:rect_cw(d.top_left.x, d.top_left.y, region.x, region.y + region.h) + ass:rect_cw(region.x, d.top_left.y, d.bottom_right.x, region.y) + ass:rect_cw(d.top_left.x, region.y + region.h, region.x + region.w, d.bottom_right.y) + ass:rect_cw(region.x + region.w, region.y, d.bottom_right.x, d.bottom_right.y) + return ass:draw_stop() + end, + draw = function(self) + local window = { } + window.w, window.h = mp.get_osd_size() + local ass = assdraw.ass_new() + self:draw_box(ass) + ass:new_event() + self:setup_text(ass) + ass:append(tostring(bold('Crop:')) .. "\\N") + ass:append(tostring(bold('1:')) .. " change point A (" .. tostring(self.pointA.x) .. ", " .. tostring(self.pointA.y) .. ")\\N") + ass:append(tostring(bold('2:')) .. " change point B (" .. tostring(self.pointB.x) .. ", " .. tostring(self.pointB.y) .. ")\\N") + ass:append(tostring(bold('r:')) .. " reset to whole screen\\N") + ass:append(tostring(bold('ESC:')) .. " cancel crop\\N") + local width, height = math.abs(self.pointA.x - self.pointB.x), math.abs(self.pointA.y - self.pointB.y) + ass:append(tostring(bold('ENTER:')) .. " confirm crop (" .. tostring(width) .. "x" .. tostring(height) .. ")\\N") + return mp.set_osd_ass(window.w, window.h, ass.text) + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self, callback, region) + self.pointA = VideoPoint() + self.pointB = VideoPoint() + self.keybinds = { + ["1"] = (function() + local _base_1 = self + local _fn_0 = _base_1.setPointA + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["2"] = (function() + local _base_1 = self + local _fn_0 = _base_1.setPointB + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["r"] = (function() + local _base_1 = self + local _fn_0 = _base_1.reset + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["ESC"] = (function() + local _base_1 = self + local _fn_0 = _base_1.cancel + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["ENTER"] = (function() + local _base_1 = self + local _fn_0 = _base_1.finish + return function(...) + return _fn_0(_base_1, ...) + end + end)() + } + self:reset() + self.callback = callback + if region and region:is_valid() then + self.pointA.x = region.x + self.pointA.y = region.y + self.pointB.x = region.x + region.w + self.pointB.y = region.y + region.h + end + end, + __base = _base_0, + __name = "CropPage", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + CropPage = _class_0 +end +local Option +do + local _class_0 + local _base_0 = { + hasPrevious = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + return true + elseif "int" == _exp_0 then + if self.opts.min then + return self.value > self.opts.min + else + return true + end + elseif "list" == _exp_0 then + return self.value > 1 + end + end, + hasNext = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + return true + elseif "int" == _exp_0 then + if self.opts.max then + return self.value < self.opts.max + else + return true + end + elseif "list" == _exp_0 then + return self.value < #self.opts.possibleValues + end + end, + leftKey = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + self.value = not self.value + elseif "int" == _exp_0 then + self.value = self.value - self.opts.step + if self.opts.min and self.opts.min > self.value then + self.value = self.opts.min + end + elseif "list" == _exp_0 then + if self.value > 1 then + self.value = self.value - 1 + end + end + end, + rightKey = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + self.value = not self.value + elseif "int" == _exp_0 then + self.value = self.value + self.opts.step + if self.opts.max and self.opts.max < self.value then + self.value = self.opts.max + end + elseif "list" == _exp_0 then + if self.value < #self.opts.possibleValues then + self.value = self.value + 1 + end + end + end, + getValue = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + return self.value + elseif "int" == _exp_0 then + return self.value + elseif "list" == _exp_0 then + local value, _ + do + local _obj_0 = self.opts.possibleValues[self.value] + value, _ = _obj_0[1], _obj_0[2] + end + return value + end + end, + setValue = function(self, value) + local _exp_0 = self.optType + if "bool" == _exp_0 then + self.value = value + elseif "int" == _exp_0 then + self.value = value + elseif "list" == _exp_0 then + local set = false + for i, possiblePair in ipairs(self.opts.possibleValues) do + local possibleValue, _ + possibleValue, _ = possiblePair[1], possiblePair[2] + if possibleValue == value then + set = true + self.value = i + break + end + end + if not set then + return msg.warn("Tried to set invalid value " .. tostring(value) .. " to " .. tostring(self.displayText) .. " option.") + end + end + end, + getDisplayValue = function(self) + local _exp_0 = self.optType + if "bool" == _exp_0 then + return self.value and "yes" or "no" + elseif "int" == _exp_0 then + if self.opts.altDisplayNames and self.opts.altDisplayNames[self.value] then + return self.opts.altDisplayNames[self.value] + else + return tostring(self.value) + end + elseif "list" == _exp_0 then + local value, displayValue + do + local _obj_0 = self.opts.possibleValues[self.value] + value, displayValue = _obj_0[1], _obj_0[2] + end + return displayValue or value + end + end, + draw = function(self, ass, selected) + if selected then + ass:append(tostring(bold(self.displayText)) .. ": ") + else + ass:append(tostring(self.displayText) .. ": ") + end + if self:hasPrevious() then + ass:append("โ—€ ") + end + ass:append(self:getDisplayValue()) + if self:hasNext() then + ass:append(" โ–ถ") + end + return ass:append("\\N") + end, + optVisible = function(self) + if self.visibleCheckFn == nil then + return true + else + return self.visibleCheckFn() + end + end + } + _base_0.__index = _base_0 + _class_0 = setmetatable({ + __init = function(self, optType, displayText, value, opts, visibleCheckFn) + self.optType = optType + self.displayText = displayText + self.opts = opts + self.value = 1 + self.visibleCheckFn = visibleCheckFn + return self:setValue(value) + end, + __base = _base_0, + __name = "Option" + }, { + __index = _base_0, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + Option = _class_0 +end +local EncodeOptionsPage +do + local _class_0 + local _parent_0 = Page + local _base_0 = { + getCurrentOption = function(self) + return self.options[self.currentOption][2] + end, + leftKey = function(self) + (self:getCurrentOption()):leftKey() + return self:draw() + end, + rightKey = function(self) + (self:getCurrentOption()):rightKey() + return self:draw() + end, + prevOpt = function(self) + for i = self.currentOption - 1, 1, -1 do + if self.options[i][2]:optVisible() then + self.currentOption = i + break + end + end + return self:draw() + end, + nextOpt = function(self) + for i = self.currentOption + 1, #self.options do + if self.options[i][2]:optVisible() then + self.currentOption = i + break + end + end + return self:draw() + end, + confirmOpts = function(self) + for _, optPair in ipairs(self.options) do + local optName, opt + optName, opt = optPair[1], optPair[2] + options[optName] = opt:getValue() + end + self:hide() + return self.callback(true) + end, + cancelOpts = function(self) + self:hide() + return self.callback(false) + end, + draw = function(self) + local window_w, window_h = mp.get_osd_size() + local ass = assdraw.ass_new() + ass:new_event() + self:setup_text(ass) + ass:append(tostring(bold('Options:')) .. "\\N\\N") + for i, optPair in ipairs(self.options) do + local opt = optPair[2] + if opt:optVisible() then + opt:draw(ass, self.currentOption == i) + end + end + ass:append("\\Nโ–ฒ / โ–ผ: navigate\\N") + ass:append(tostring(bold('ENTER:')) .. " confirm options\\N") + ass:append(tostring(bold('ESC:')) .. " cancel\\N") + return mp.set_osd_ass(window_w, window_h, ass.text) + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self, callback) + self.callback = callback + self.currentOption = 1 + local scaleHeightOpts = { + possibleValues = { + { + -1, + "no" + }, + { + 144 + }, + { + 240 + }, + { + 360 + }, + { + 480 + }, + { + 540 + }, + { + 720 + }, + { + 1080 + }, + { + 1440 + }, + { + 2160 + } + } + } + local filesizeOpts = { + step = 250, + min = 0, + altDisplayNames = { + [0] = "0 (constant quality)" + } + } + local crfOpts = { + step = 1, + min = -1, + altDisplayNames = { + [-1] = "disabled" + } + } + local fpsOpts = { + possibleValues = { + { + -1, + "source" + }, + { + 15 + }, + { + 24 + }, + { + 30 + }, + { + 48 + }, + { + 50 + }, + { + 60 + }, + { + 120 + }, + { + 240 + } + } + } + local formatIds = { + "webm-vp8", + "webm-vp9", + "mp4", + "mp4-nvenc", + "raw", + "mp3", + "gif" + } + local formatOpts = { + possibleValues = (function() + local _accum_0 = { } + local _len_0 = 1 + for _index_0 = 1, #formatIds do + local fId = formatIds[_index_0] + _accum_0[_len_0] = { + fId, + formats[fId].displayName + } + _len_0 = _len_0 + 1 + end + return _accum_0 + end)() + } + local gifDitherOpts = { + possibleValues = { + { + 0, + "bayer_scale 0" + }, + { + 1, + "bayer_scale 1" + }, + { + 2, + "bayer_scale 2" + }, + { + 3, + "bayer_scale 3" + }, + { + 4, + "bayer_scale 4" + }, + { + 5, + "bayer_scale 5" + }, + { + 6, + "sierra2_4a" + } + } + } + self.options = { + { + "output_format", + Option("list", "Output Format", options.output_format, formatOpts) + }, + { + "twopass", + Option("bool", "Two Pass", options.twopass) + }, + { + "apply_current_filters", + Option("bool", "Apply Current Video Filters", options.apply_current_filters) + }, + { + "scale_height", + Option("list", "Scale Height", options.scale_height, scaleHeightOpts) + }, + { + "strict_filesize_constraint", + Option("bool", "Strict Filesize Constraint", options.strict_filesize_constraint) + }, + { + "write_filename_on_metadata", + Option("bool", "Write Filename on Metadata", options.write_filename_on_metadata) + }, + { + "target_filesize", + Option("int", "Target Filesize", options.target_filesize, filesizeOpts) + }, + { + "crf", + Option("int", "CRF", options.crf, crfOpts) + }, + { + "fps", + Option("list", "FPS", options.fps, fpsOpts) + }, + { + "gif_dither", + Option("list", "GIF Dither Type", options.gif_dither, gifDitherOpts, function() + return self.options[1][2]:getValue() == "gif" + end) + }, + { + "force_square_pixels", + Option("bool", "Force Square Pixels", options.force_square_pixels) + } + } + self.keybinds = { + ["LEFT"] = (function() + local _base_1 = self + local _fn_0 = _base_1.leftKey + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["RIGHT"] = (function() + local _base_1 = self + local _fn_0 = _base_1.rightKey + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["UP"] = (function() + local _base_1 = self + local _fn_0 = _base_1.prevOpt + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["DOWN"] = (function() + local _base_1 = self + local _fn_0 = _base_1.nextOpt + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["ENTER"] = (function() + local _base_1 = self + local _fn_0 = _base_1.confirmOpts + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["ESC"] = (function() + local _base_1 = self + local _fn_0 = _base_1.cancelOpts + return function(...) + return _fn_0(_base_1, ...) + end + end)() + } + end, + __base = _base_0, + __name = "EncodeOptionsPage", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + EncodeOptionsPage = _class_0 +end +local PreviewPage +do + local _class_0 + local _parent_0 = Page + local _base_0 = { + prepare = function(self) + local vf = mp.get_property_native("vf") + vf[#vf + 1] = { + name = "sub" + } + if self.region:is_valid() then + vf[#vf + 1] = { + name = "crop", + params = { + w = tostring(self.region.w), + h = tostring(self.region.h), + x = tostring(self.region.x), + y = tostring(self.region.y) + } + } + end + mp.set_property_native("vf", vf) + if self.startTime > -1 and self.endTime > -1 then + mp.set_property_native("ab-loop-a", self.startTime) + mp.set_property_native("ab-loop-b", self.endTime) + mp.set_property_native("time-pos", self.startTime) + end + return mp.set_property_native("pause", false) + end, + dispose = function(self) + mp.set_property("ab-loop-a", "no") + mp.set_property("ab-loop-b", "no") + for prop, value in pairs(self.originalProperties) do + mp.set_property_native(prop, value) + end + end, + draw = function(self) + local window_w, window_h = mp.get_osd_size() + local ass = assdraw.ass_new() + ass:new_event() + self:setup_text(ass) + ass:append("Press " .. tostring(bold('ESC')) .. " to exit preview.\\N") + return mp.set_osd_ass(window_w, window_h, ass.text) + end, + cancel = function(self) + self:hide() + return self.callback() + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self, callback, region, startTime, endTime) + self.callback = callback + self.originalProperties = { + ["vf"] = mp.get_property_native("vf"), + ["time-pos"] = mp.get_property_native("time-pos"), + ["pause"] = mp.get_property_native("pause") + } + self.keybinds = { + ["ESC"] = (function() + local _base_1 = self + local _fn_0 = _base_1.cancel + return function(...) + return _fn_0(_base_1, ...) + end + end)() + } + self.region = region + self.startTime = startTime + self.endTime = endTime + self.isLoop = false + end, + __base = _base_0, + __name = "PreviewPage", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + PreviewPage = _class_0 +end +local MainPage +do + local _class_0 + local _parent_0 = Page + local _base_0 = { + setStartTime = function(self) + self.startTime = mp.get_property_number("time-pos") + if self.visible then + self:clear() + return self:draw() + end + end, + setEndTime = function(self) + self.endTime = mp.get_property_number("time-pos") + if self.visible then + self:clear() + return self:draw() + end + end, + setupStartAndEndTimes = function(self) + if mp.get_property_native("duration") then + self.startTime = 0 + self.endTime = mp.get_property_native("duration") + else + self.startTime = -1 + self.endTime = -1 + end + if self.visible then + self:clear() + return self:draw() + end + end, + draw = function(self) + local window_w, window_h = mp.get_osd_size() + local ass = assdraw.ass_new() + ass:new_event() + self:setup_text(ass) + ass:append(tostring(bold('WebM maker')) .. "\\N\\N") + ass:append(tostring(bold('c:')) .. " crop\\N") + ass:append(tostring(bold('1:')) .. " set start time (current is " .. tostring(seconds_to_time_string(self.startTime)) .. ")\\N") + ass:append(tostring(bold('2:')) .. " set end time (current is " .. tostring(seconds_to_time_string(self.endTime)) .. ")\\N") + ass:append(tostring(bold('o:')) .. " change encode options\\N") + ass:append(tostring(bold('p:')) .. " preview\\N") + ass:append(tostring(bold('e:')) .. " encode\\N\\N") + ass:append(tostring(bold('ESC:')) .. " close\\N") + return mp.set_osd_ass(window_w, window_h, ass.text) + end, + show = function(self) + _class_0.__parent.show(self) + return emit_event("show-main-page") + end, + onUpdateCropRegion = function(self, updated, newRegion) + if updated then + self.region = newRegion + end + return self:show() + end, + crop = function(self) + self:hide() + local cropPage = CropPage((function() + local _base_1 = self + local _fn_0 = _base_1.onUpdateCropRegion + return function(...) + return _fn_0(_base_1, ...) + end + end)(), self.region) + return cropPage:show() + end, + onOptionsChanged = function(self, updated) + return self:show() + end, + changeOptions = function(self) + self:hide() + local encodeOptsPage = EncodeOptionsPage((function() + local _base_1 = self + local _fn_0 = _base_1.onOptionsChanged + return function(...) + return _fn_0(_base_1, ...) + end + end)()) + return encodeOptsPage:show() + end, + onPreviewEnded = function(self) + return self:show() + end, + preview = function(self) + self:hide() + local previewPage = PreviewPage((function() + local _base_1 = self + local _fn_0 = _base_1.onPreviewEnded + return function(...) + return _fn_0(_base_1, ...) + end + end)(), self.region, self.startTime, self.endTime) + return previewPage:show() + end, + encode = function(self) + self:hide() + if self.startTime < 0 then + message("No start time, aborting") + return + end + if self.endTime < 0 then + message("No end time, aborting") + return + end + if self.startTime >= self.endTime then + message("Start time is ahead of end time, aborting") + return + end + return encode(self.region, self.startTime, self.endTime) + end + } + _base_0.__index = _base_0 + setmetatable(_base_0, _parent_0.__base) + _class_0 = setmetatable({ + __init = function(self) + self.keybinds = { + ["c"] = (function() + local _base_1 = self + local _fn_0 = _base_1.crop + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["1"] = (function() + local _base_1 = self + local _fn_0 = _base_1.setStartTime + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["2"] = (function() + local _base_1 = self + local _fn_0 = _base_1.setEndTime + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["o"] = (function() + local _base_1 = self + local _fn_0 = _base_1.changeOptions + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["p"] = (function() + local _base_1 = self + local _fn_0 = _base_1.preview + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["e"] = (function() + local _base_1 = self + local _fn_0 = _base_1.encode + return function(...) + return _fn_0(_base_1, ...) + end + end)(), + ["ESC"] = (function() + local _base_1 = self + local _fn_0 = _base_1.hide + return function(...) + return _fn_0(_base_1, ...) + end + end)() + } + self.startTime = -1 + self.endTime = -1 + self.region = Region() + end, + __base = _base_0, + __name = "MainPage", + __parent = _parent_0 + }, { + __index = function(cls, name) + local val = rawget(_base_0, name) + if val == nil then + local parent = rawget(cls, "__parent") + if parent then + return parent[name] + end + else + return val + end + end, + __call = function(cls, ...) + local _self_0 = setmetatable({}, _base_0) + cls.__init(_self_0, ...) + return _self_0 + end + }) + _base_0.__class = _class_0 + if _parent_0.__inherited then + _parent_0.__inherited(_parent_0, _class_0) + end + MainPage = _class_0 +end +monitor_dimensions() +local mainPage = MainPage() +mp.add_key_binding(options.keybind, "display-webm-encoder", (function() + local _base_0 = mainPage + local _fn_0 = _base_0.show + return function(...) + return _fn_0(_base_0, ...) + end +end)(), { + repeatable = false +}) +mp.register_event("file-loaded", (function() + local _base_0 = mainPage + local _fn_0 = _base_0.setupStartAndEndTimes + return function(...) + return _fn_0(_base_0, ...) + end +end)()) +msg.verbose("Loaded mpv-webm script!") +return emit_event("script-loaded") diff --git a/config/X/mpv/scripts/youtube-quality.lua b/config/X/mpv/scripts/youtube-quality.lua new file mode 100755 index 0000000..1331210 --- /dev/null +++ b/config/X/mpv/scripts/youtube-quality.lua @@ -0,0 +1,275 @@ +-- youtube-quality.lua +-- +-- Change youtube video quality on the fly. +-- +-- Diplays a menu that lets you switch to different ytdl-format settings while +-- you're in the middle of a video (just like you were using the web player). +-- +-- Bound to ctrl-f by default. + +local mp = require 'mp' +local utils = require 'mp.utils' +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' + +local opts = { + --key bindings + toggle_menu_binding = "ctrl+f", + up_binding = "UP", + down_binding = "DOWN", + select_binding = "ENTER", + + --formatting / cursors + selected_and_active = "โ–ถ - ", + selected_and_inactive = "โ— - ", + unselected_and_active = "โ–ท - ", + unselected_and_inactive = "โ—‹ - ", + + --font size scales by window, if false requires larger font and padding sizes + scale_playlist_by_window=false, + + --playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua + --example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1 + --read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags + --undeclared tags will use default osd settings + --these styles will be used for the whole playlist. More specific styling will need to be hacked in + -- + --(a monospaced font is recommended but not required) + style_ass_tags = "{\\fnmonospace}", + + --paddings for top left corner + text_padding_x = 5, + text_padding_y = 5, + + --other + menu_timeout = 10, + + --use yt-dlp to fetch a list of available formats (overrides quality_strings) + fetch_formats = true, + + --default menu entries + quality_strings=[[ + [ + {"4320p" : "bestvideo[height<=?4320p]+bestaudio/best"}, + {"2160p" : "bestvideo[height<=?2160]+bestaudio/best"}, + {"1440p" : "bestvideo[height<=?1440]+bestaudio/best"}, + {"1080p" : "bestvideo[height<=?1080]+bestaudio/best"}, + {"720p" : "bestvideo[height<=?720]+bestaudio/best"}, + {"480p" : "bestvideo[height<=?480]+bestaudio/best"}, + {"360p" : "bestvideo[height<=?360]+bestaudio/best"}, + {"240p" : "bestvideo[height<=?240]+bestaudio/best"}, + {"144p" : "bestvideo[height<=?144]+bestaudio/best"} + ] + ]], +} +(require 'mp.options').read_options(opts, "youtube-quality") +opts.quality_strings = utils.parse_json(opts.quality_strings) + +local destroyer = nil + + +function show_menu() + local selected = 1 + local active = 0 + local current_ytdl_format = mp.get_property("ytdl-format") + msg.verbose("current ytdl-format: "..current_ytdl_format) + local num_options = 0 + local options = {} + + + if opts.fetch_formats then + options, num_options = download_formats() + end + + if next(options) == nil then + for i,v in ipairs(opts.quality_strings) do + num_options = num_options + 1 + for k,v2 in pairs(v) do + options[i] = {label = k, format=v2} + if v2 == current_ytdl_format then + active = i + selected = active + end + end + end + end + + --set the cursor to the currently format + for i,v in ipairs(options) do + if v.format == current_ytdl_format then + active = i + selected = active + break + end + end + + function selected_move(amt) + selected = selected + amt + if selected < 1 then selected = num_options + elseif selected > num_options then selected = 1 end + timeout:kill() + timeout:resume() + draw_menu() + end + function choose_prefix(i) + if i == selected and i == active then return opts.selected_and_active + elseif i == selected then return opts.selected_and_inactive end + + if i ~= selected and i == active then return opts.unselected_and_active + elseif i ~= selected then return opts.unselected_and_inactive end + return "> " --shouldn't get here. + end + + function draw_menu() + local ass = assdraw.ass_new() + + ass:pos(opts.text_padding_x, opts.text_padding_y) + ass:append(opts.style_ass_tags) + + for i,v in ipairs(options) do + ass:append(choose_prefix(i)..v.label.."\\N") + end + + local w, h = mp.get_osd_size() + if opts.scale_playlist_by_window then w,h = 0, 0 end + mp.set_osd_ass(w, h, ass.text) + end + + function destroy() + timeout:kill() + mp.set_osd_ass(0,0,"") + mp.remove_key_binding("move_up") + mp.remove_key_binding("move_down") + mp.remove_key_binding("select") + mp.remove_key_binding("escape") + destroyer = nil + end + timeout = mp.add_periodic_timer(opts.menu_timeout, destroy) + destroyer = destroy + + mp.add_forced_key_binding(opts.up_binding, "move_up", function() selected_move(-1) end, {repeatable=true}) + mp.add_forced_key_binding(opts.down_binding, "move_down", function() selected_move(1) end, {repeatable=true}) + mp.add_forced_key_binding(opts.select_binding, "select", function() + destroy() + mp.set_property("ytdl-format", options[selected].format) + reload_resume() + end) + mp.add_forced_key_binding(opts.toggle_menu_binding, "escape", destroy) + + draw_menu() + return +end + +local ytdl = { + path = "yt-dlp", + searched = false, + blacklisted = {} +} + +format_cache={} +function download_formats() + local function exec(args) + local ret = utils.subprocess({args = args}) + return ret.status, ret.stdout, ret + end + + local function table_size(t) + s = 0 + for i,v in ipairs(t) do + s = s+1 + end + return s + end + + local url = mp.get_property("path") + + url = string.gsub(url, "ytdl://", "") -- Strip possible ytdl:// prefix. + + -- don't fetch the format list if we already have it + if format_cache[url] ~= nil then + local res = format_cache[url] + return res, table_size(res) + end + mp.osd_message("fetching available formats with yt-dlp...", 60) + + if not (ytdl.searched) then + local ytdl_mcd = mp.find_config_file("yt-dlp") + if not (ytdl_mcd == nil) then + msg.verbose("found yt-dlp at: " .. ytdl_mcd) + ytdl.path = ytdl_mcd + end + ytdl.searched = true + end + + local command = {ytdl.path, "--no-warnings", "--no-playlist", "-J"} + table.insert(command, url) + local es, json, result = exec(command) + + if (es < 0) or (json == nil) or (json == "") then + mp.osd_message("fetching formats failed...", 1) + msg.error("failed to get format list: " .. err) + return {}, 0 + end + + local json, err = utils.parse_json(json) + + if (json == nil) then + mp.osd_message("fetching formats failed...", 1) + msg.error("failed to parse JSON data: " .. err) + return {}, 0 + end + + res = {} + msg.verbose("yt-dlp succeeded!") + for i,v in ipairs(json.formats) do + if v.vcodec ~= "none" then + local fps = v.fps and v.fps.."fps" or "" + local resolution = string.format("%sx%s", v.width, v.height) + local l = string.format("%-9s %-5s (%-4s / %s)", resolution, fps, v.ext, v.vcodec) + local f = string.format("%s+bestaudio/best", v.format_id) + table.insert(res, {label=l, format=f, width=v.width }) + end + end + + table.sort(res, function(a, b) return a.width > b.width end) + + mp.osd_message("", 0) + format_cache[url] = res + return res, table_size(res) +end + + +-- register script message to show menu +mp.register_script_message("toggle-quality-menu", +function() + if destroyer ~= nil then + destroyer() + else + show_menu() + end +end) + +-- keybind to launch menu +mp.add_key_binding(opts.toggle_menu_binding, "quality-menu", show_menu) + +-- special thanks to reload.lua (https://github.com/4e6/mpv-reload/) +function reload_resume() + local playlist_pos = mp.get_property_number("playlist-pos") + local reload_duration = mp.get_property_native("duration") + local time_pos = mp.get_property("time-pos") + + mp.set_property_number("playlist-pos", playlist_pos) + + -- Tries to determine live stream vs. pre-recordered VOD. VOD has non-zero + -- duration property. When reloading VOD, to keep the current time position + -- we should provide offset from the start. Stream doesn't have fixed start. + -- Decent choice would be to reload stream from it's current 'live' positon. + -- That's the reason we don't pass the offset when reloading streams. + if reload_duration and reload_duration > 0 then + local function seeker() + mp.commandv("seek", time_pos, "absolute") + mp.unregister_event(seeker) + end + mp.register_event("file-loaded", seeker) + end +end diff --git a/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563 b/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563 new file mode 100644 index 0000000..8356b1e --- /dev/null +++ b/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563 @@ -0,0 +1,2 @@ +start=9052.872000 +volume=45.000000 diff --git a/config/X/picom/picom.conf b/config/X/picom/picom.conf new file mode 100644 index 0000000..9e9ecdb --- /dev/null +++ b/config/X/picom/picom.conf @@ -0,0 +1,493 @@ +################################# +# Animations # +################################# +# requires https://github.com/jonaburg/picom +# (These are also the default values) +transition-length = 300 +transition-pow-x = 0.1 +transition-pow-y = 0.1 +transition-pow-w = 0.1 +transition-pow-h = 0.1 +size-transition = true + + +################################# +# Corners # +################################# +# requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom +corner-radius = 5.0; +rounded-corners-exclude = [ + "class_g = 'Dunst'" +]; +round-borders = 1; +round-borders-exclude = [ + #"class_g = 'TelegramDesktop'", +]; + +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +shadow = false; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +shadow-radius = 7; + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +# shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +shadow-offset-x = -7; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +shadow-offset-y = -7; + +# Avoid drawing shadows on dock/panel windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dock-shadow = false + +# Don't draw shadows on drag-and-drop windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dnd-shadow = false + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Do not paint shadows on shaped windows. Note shaped windows +# here means windows setting its shape through X Shape extension. +# Those using ARGB background is beyond our control. +# Deprecated, use +# shadow-exclude = 'bounding_shaped' +# or +# shadow-exclude = 'bounding_shaped && !rounded_corners' +# instead. +# +# shadow-ignore-shaped = '' + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] +shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "class_g = 'slop'", + "class_g = 'Polybar'", + "_GTK_FRAME_EXTENTS@:c" +]; + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = true; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 +fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 +fade-out-step = 1.00; + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +# don't need this, we disable fading for all normal windows with wintypes: {} +fade-exclude = [ + "class_g = 'slop'", # maim + "class_g = 'dmenu'", + "class_g = 'Pinentry-gtk-2'", +] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +inactive-opacity = 0.8; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +frame-opacity = 0.7; + +# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0) +# menu-opacity = 1.0 +# menu-opacity is depreciated use dropdown-menu and popup-menu instead. + +#If using these 2 below change their values in line 510 & 511 aswell +popup_menu = { opacity = 0.8; } +dropdown_menu = { opacity = 0.8; } + + +# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +active-opacity = 1.0; + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should always be considered focused. +# focus-exclude = [] +focus-exclude = [ + "class_g = 'Cairo-clock'", + "class_g = 'Bar'", # lemonbar + "class_g = 'slop'" # maim +]; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] +opacity-rule = [ +]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = kawase +# blur-size = 12 +# +# blur-deviation = false + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = true; + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false; + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false; + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = '' +# blur-kern = "3x3box"; + +blur: { + # requires: https://github.com/ibhagwan/picom + method = "dual_kawase"; + #method = "kernel"; + strength = 7; + # deviation = 1.0; + # kernel = "11x11gaussian"; + background = false; + background-frame = false; + background-fixed = false; + kern = "3x3box"; +} + +# Exclude conditions for background blur. +blur-background-exclude = [ + #"window_type = 'dock'", + #"window_type = 'desktop'", + # + # prevents picom from blurring the background + # when taking selection screenshot with `main` + # https://github.com/naelstrof/maim/issues/130 + "class_g = 'slop'", + "_GTK_FRAME_EXTENTS@:c" +]; + + +################################# +# General Settings # +################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +experimental-backends = true; +backend = "glx"; +#backend = "xrender"; + + +# Enable/disable VSync. +# vsync = false +vsync = true + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false +detect-rounded-corners = true; + +# Detect '_NET_WM_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false +detect-client-opacity = true; + +# Limit picom to repaint at most once every 1 / 'refresh_rate' second to +# boost performance. This should not be used with +# vsync drm/opengl/opengl-oml +# as they essentially does sw-opti's job already, +# unless you wish to specify a lower refresh rate than the actual value. +# +# sw-opti = + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if +# detect-transient is enabled, too. +# +# detect-client-leader = false +detect-client-leader = true + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +# glx-no-stencil = false + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +#use-damage = true (Causing Weird Black semi opaque rectangles when terminal is opened) +#Changing use-damage to false fixes the problem +use-damage = false + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = '' + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "info"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = '/path/to/your/log/file' + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = '/path/to/your/log/file' + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + dialog = { fade = false; } + combo = { fade = false; } + desktop = { fade = false; } + dock = { shadow = false; } + dnd = { shadow = false; } + dropdown_menu = { fade = false; } + menu = { fade = false; } + normal = { fade = true; shadow = false; } + notification = { fade = false; } + popup_menu = { fade = false; } + splash = { fade = false; } + toolbar = { fade = false; } + tooltip = { fade = false; } + uknown = { fade = false; } + utility = { fade = false; } +}; diff --git a/config/X/picom/picom.conf.bak b/config/X/picom/picom.conf.bak new file mode 100644 index 0000000..c8c56b4 --- /dev/null +++ b/config/X/picom/picom.conf.bak @@ -0,0 +1,410 @@ +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +# shadow = true; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 13; + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +# shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -11 + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -11 + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue) +# shadow-color = "#000000" + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [ +# "name = 'xmobar2'" +# ] + + +# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. +# clip-shadow-above = [] + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = true; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +fade-in-step = 0.06 + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +fade-out-step = 0.06 + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +fade-exclude = [ + "class_g = 'dmenu'", + "class_g = 'Pinentry-gtk-2'" +] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +inactive-opacity = 1.0; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +frame-opacity = 1.0; + +# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +active-opacity = 1.0 + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should never be considered focused. +# focus-exclude = [] +focus-exclude = [ +]; + +# If I want dmenu to be excluded I can do so by giving position +# focus-exclude = "x = 0 && y = 0 && override_redirect = true"; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +opacity-rule = [ + # "100:name *= '- YouTube'", + # "90:class_g = 'firefox'", +]; +# + +################################# +# Corners # +################################# + +# Sets the radius of rounded window corners. When > 0, the compositor will +# round the corners of windows. Does not interact well with +# `transparent-clipping`. +corner-radius = 9 + + +# Exclude conditions for rounded corners. +rounded-corners-exclude = [ + #"window_type = 'dock'", + #"window_type = 'desktop'", + "name != 'xmobar2'" +]; + +################################# +# Background-Blurring # +################################# + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = +# blur-size = 12 +# +# blur-deviation = false +# +# blur-strength = 5 + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = false + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = "" +# blur-kern = "3x3box"; + +# Exclude conditions for background blur. +# blur-background-exclude = [] +# blur-background-exclude = [ +# "window_type = 'dock'", +# "window_type = 'desktop'", +# "_GTK_FRAME_EXTENTS@:c" +# ]; + +################################# +# General Settings # +################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +# backend = "glx" +backend = "glx"; + +# Enable/disable VSync. +# vsync = false +vsync = true; + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = false; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = false; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false +detect-rounded-corners = false; + +# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false +detect-client-opacity = false; + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. +# +unredir-if-possible = true + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true; + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. This usually means windows from the same application +# will be considered focused or unfocused at the same time. +# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too. +# +detect-client-leader = true + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +glx-no-stencil = true; + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +use-damage = false; + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = "" + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "warn"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = "/path/to/your/log/file" + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = "/path/to/your/log/file" + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# clip-shadow-above::: +# Controls wether shadows that would have been drawn above the window should +# be clipped. Useful for dock windows that should have no shadow painted on top. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +#wintypes: +#{ +# tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; +# dock = { shadow = false; clip-shadow-above = true; } +# dnd = { shadow = false; } +# popup_menu = { opacity = 0.8; } +# dropdown_menu = { opacity = 0.8; } +#}; diff --git a/config/X/redshift/redshift.conf b/config/X/redshift/redshift.conf new file mode 100644 index 0000000..9652fab --- /dev/null +++ b/config/X/redshift/redshift.conf @@ -0,0 +1,70 @@ +; Global settings for redshift +[redshift] +; Set the day and night screen temperatures +temp-day=5700 +temp-night=3500 + +; Disable the smooth fade between temperatures when Redshift starts and stops. +; 0 will cause an immediate change between screen temperatures. +; 1 will gradually apply the new screen temperature over a couple of seconds. +fade=0 + +; Solar elevation thresholds. +; By default, Redshift will use the current elevation of the sun to determine +; whether it is daytime, night or in transition (dawn/dusk). When the sun is +; above the degrees specified with elevation-high it is considered daytime and +; below elevation-low it is considered night. +;elevation-high=3 +;elevation-low=-6 + +; Custom dawn/dusk intervals. +; Instead of using the solar elevation, the time intervals of dawn and dusk +; can be specified manually. The times must be specified as HH:MM in 24-hour +; format. +;dawn-time=6:00-7:45 +;dusk-time=18:35-20:15 + +; Set the screen brightness. Default is 1.0. +;brightness=0.9 +; It is also possible to use different settings for day and night +; since version 1.8. +;brightness-day=0.7 +;brightness-night=0.4 +; Set the screen gamma (for all colors, or each color channel +; individually) +gamma=0.8 +;gamma=0.8:0.7:0.8 +; This can also be set individually for day and night since +; version 1.10. +;gamma-day=0.8:0.7:0.8 +;gamma-night=0.6 + +; Set the location-provider: 'geoclue2', 'manual' +; type 'redshift -l list' to see possible values. +; The location provider settings are in a different section. +location-provider=manual + +; Set the adjustment-method: 'randr', 'vidmode' +; type 'redshift -m list' to see all possible values. +; 'randr' is the preferred method, 'vidmode' is an older API. +; but works in some cases when 'randr' does not. +; The adjustment method settings are in a different section. +adjustment-method=randr + +; Configuration of the location-provider: +; type 'redshift -l PROVIDER:help' to see the settings. +; ex: 'redshift -l manual:help' +; Keep in mind that longitudes west of Greenwich (e.g. the Americas) +; are negative numbers. +[manual] +lat=50 +lon=4 + +; Configuration of the adjustment-method +; type 'redshift -m METHOD:help' to see the settings. +; ex: 'redshift -m randr:help' +; In this example, randr is configured to adjust only screen 0. +; Note that the numbering starts from 0, so this is actually the first screen. +; If this option is not specified, Redshift will try to adjust _all_ screens. +[randr] +screen=0 diff --git a/config/X/x11/.Xauthority b/config/X/x11/.Xauthority new file mode 100644 index 0000000..b606434 Binary files /dev/null and b/config/X/x11/.Xauthority differ diff --git a/config/X/x11/.Xresources b/config/X/x11/.Xresources new file mode 100755 index 0000000..c809b23 --- /dev/null +++ b/config/X/x11/.Xresources @@ -0,0 +1,155 @@ +! Use Xterm with 256 beautiful colors +xterm*termName: xterm-256color + +! Use a nice truetype font and size by default... +xterm*faceName: Ubuntu Mono +xterm*faceSize: 16 + +! VT font menu: unreadable +xterm*facesize1: 8 +! VT font menu : tiny +xterm*facesize2: 10 +! VT font menu: small +xterm*facesize3: 12 +! VT font menu: medium +xterm*facesize4: 18 +! VT font menu: large +xterm*facesize5: 22 +! VT font menu: huge +xterm*facesize6: 24 + +! Every shell is a login shell by default (for inclusion of all necessary environment variables) +xterm*loginshell: true + +! A lot of scrollback +xterm*savelines: 16384 + +! right hand side scrollbar... +! xterm*rightScrollBar: true +! xterm*ScrollBar: true + +! stop output to terminal from jumping down to bottom of scroll again +xterm*scrollTtyOutput: false + +! ## select text ## +xterm*highlightSelection: true +! remove trailing spaces +xterm*trimSelection: true +! selection goes to CLIPBOARD selection +! xterm*selectToClipboard: true +! double-click to select whole URLs :D +xterm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48 + +! ## keybindings ## +! ctrl -/+ zooms out/in +! ctrl shift c/v = copy/paste +! selection with mouse left click goes right to clipboard +xterm*translations: #override \n\ + Ctrl -: smaller-vt-font() \n\ + Ctrl +: larger-vt-font() \n\ + Ctrl 0: set-vt-font(d) \n\ + Ctrl Shift C: copy-selection(CLIPBOARD) \n\ + Ctrl Shift V: insert-selection(CLIPBOARD) \n\ + : select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) +! Alt key becomes the ESC key >:) +xterm*metaSendsEscape: true + +! Base16 Solarized Dark +! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized) + +!#define S_base03 #002b36 +!#define S_base02 #073642 +!#define S_base01 #586e75 +!#define S_base00 #657b83 +!#define S_base0 #839496 +!#define S_base1 #93a1a1 +!#define S_base2 #eee8d5 +!#define S_base3 #fdf6e3 +! +!*background: S_base03 +!*foreground: S_base0 +!*fadeColor: S_base03 +!*cursorColor: S_base1 +!*pointerColorBackground:S_base01 +!*pointerColorForeground:S_base1 +! +!#define S_yellow #b58900 +!#define S_orange #cb4b16 +!#define S_red #dc322f +!#define S_magenta #d33682 +!#define S_violet #6c71c4 +!#define S_blue #268bd2 +!#define S_cyan #2aa198 +!#define S_green #859900 +! +!!! black dark/light +!*color0: S_base02 +!*color8: S_base03 +! +!!! red dark/light +!*color1: S_red +!*color9: S_orange +! +!!! green dark/light +!*color2: S_green +!*color10: S_base01 +! +!!! yellow dark/light +!*color3: S_yellow +!*color11: S_base00 +! +!!! blue dark/light +!*color4: S_blue +!*color12: S_base0 +! +!!! magenta dark/light +!*color5: S_magenta +!*color13: S_violet +! +!!! cyan dark/light +!*color6: S_cyan +!*color14: S_base1 +! +!!! white dark/light +!*color7: S_base2 +!*color15: S_base3 + +#define nord0 #2E3440 +#define nord1 #3B4252 +#define nord2 #434C5E +#define nord3 #4C566A +#define nord4 #D8DEE9 +#define nord5 #E5E9F0 +#define nord6 #ECEFF4 +#define nord7 #8FBCBB +#define nord8 #88C0D0 +#define nord9 #81A1C1 +#define nord10 #5E81AC +#define nord11 #BF616A +#define nord12 #D08770 +#define nord13 #EBCB8B +#define nord14 #A3BE8C +#define nord15 #B48EAD + +*.foreground: nord4 +*.background: nord0 +*.cursorColor: nord4 +*fading: 35 +*fadeColor: nord3 + +*.color0: nord1 +*.color1: nord11 +*.color2: nord14 +*.color3: nord13 +*.color4: nord9 +*.color5: nord15 +*.color6: nord8 +*.color7: nord5 +*.color8: nord3 +*.color9: nord11 +*.color10: nord14 +*.color11: nord13 +*.color12: nord9 +*.color13: nord15 +*.color14: nord7 +*.color15: nord6 diff --git a/config/X/x11/xinitrc b/config/X/x11/xinitrc new file mode 100755 index 0000000..c438f1b --- /dev/null +++ b/config/X/x11/xinitrc @@ -0,0 +1,36 @@ +#!/bin/sh +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then + xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then + xmodmap $sysmodmap +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" +fi + +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" +fi + +xrandr --output HDMI-1 --primary --left-of VGA-1 +if [ -d /etc/X11/xinit/xinitrc.d ] ; then + for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + +picom -b +setxkbmap -option ctrl:nocaps +xautolock -time 5 -locker slock & +exec xmonad diff --git a/config/X/xmobar/scripts/.updates.swp b/config/X/xmobar/scripts/.updates.swp new file mode 100644 index 0000000..99422fc Binary files /dev/null and b/config/X/xmobar/scripts/.updates.swp differ diff --git a/config/X/xmobar/scripts/battery b/config/X/xmobar/scripts/battery new file mode 100755 index 0000000..77b0d29 --- /dev/null +++ b/config/X/xmobar/scripts/battery @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +battery="$(acpi -i | awk -F ',' 'NR==1 {print $2}')" +charging="$(acpi -i | awk 'NR==1 {print $3}')" +battery=${battery:1:-1} +if [[ "${charging::-1}" == "Charging" ]] +then + icon="๏‡ฆ" +else + index=$((battery/25)) + array=("๏‰„" "๏‰ƒ" "๏‰‚" "๏‰" "๏‰€") + icon="${array[$index]}" +fi +echo -n " ${battery}% ${icon}" diff --git a/config/X/xmobar/scripts/checkupds b/config/X/xmobar/scripts/checkupds new file mode 100755 index 0000000..6cc6030 --- /dev/null +++ b/config/X/xmobar/scripts/checkupds @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +checkupdates | wc -l diff --git a/config/X/xmobar/scripts/minwinfo b/config/X/xmobar/scripts/minwinfo new file mode 100755 index 0000000..1736a5f --- /dev/null +++ b/config/X/xmobar/scripts/minwinfo @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# +echo "name: $1" +echo "icon: $2" +echo "sentence: $3" diff --git a/config/X/xmobar/scripts/whscreen b/config/X/xmobar/scripts/whscreen new file mode 100755 index 0000000..030493b --- /dev/null +++ b/config/X/xmobar/scripts/whscreen @@ -0,0 +1,23 @@ +#!/bin/bash + +# # -- Based on mouse +# # Get mouse location, only X matters +# X=$(\ +# xdotool getmouselocation -s \ +# | head -n1 \ +# | cut -f2 -d'='\ +# ) + +# Based on active window +X=$(xdotool getwindowgeometry -s $(xdotool getwindowfocus) | grep "X" | cut -d'=' -f2) + +# For dual monitor setup +monitor_width="$(\ + xdotool getdisplaygeometry \ + | cut -d ' ' -f 1 \ +)" + +# If '-' number is negative +[[ "$((${X} - ${monitor_width}))" -lt 0 ]] \ + && echo -n '<' \ + || echo -n '>' diff --git a/config/X/xmobar/scripts/winfo b/config/X/xmobar/scripts/winfo new file mode 100755 index 0000000..033ab49 --- /dev/null +++ b/config/X/xmobar/scripts/winfo @@ -0,0 +1,124 @@ +#!/bin/bash +XMDIR="$HOME/.config/xmobar" + +terminal="$(\ + grep -m 1 "myTerminal *=" ~/.config/xmonad/xmonad.hs \ + | cut -f 2 -d '"' \ +)" + +# Gets info over active window in X server +# made to work with xmobar +# Make option to change the terminal + +# ID of focused window +GetWinID () { + xdotool getWindowfocus +} + +# Gets name of program running active window +GetWinName () { + xdotool getwindowclassname $(GetWinID) +} + +GetWinIcons () { + NAME="$(GetWinName | cut -f 1 -d " ")" + test -z "$NAME" || \ + grep -i -m 1 "${NAME}" "$XMDIR/scripts/winfo_icons" | cut -f1 -d' ' +} + +# Get current directory of active window +# for st +GetCWD (){ + # Parent PID of process running in window + PARENT_PID="$(\ + xdotool getwindowpid $(GetWinID)\ + )" + + # PID of process runnning in window + PROCESS="$(\ + pstree -p ${PARENT_PID} \ + | head -n1 \ + | sed \ + -e 's/^.*-\(.*\)$/\1/g' \ + -e 's/^ *\([^{:( ]*\).*$/\1/g' \ + )" + + echo -n "${PROCESS}" \ + | sed \ + -e "s;^zsh$;๎žข&;g" \ + -e "s;^htop$;๏ƒค &;g" \ + -e "s;^ranger$;๏“ &;g" +} + +# Get title of window / name of process +# takes one argument, window name +GetWinTitle() { + # Max length of string + MAX_LEN=64 + xdotool GetWindowName $(GetWinID) \ + | sed \ + -e 's/ โ€” Mozilla Firefox//g' \ + -e "s;${HOME};~;g" \ + -e "s/^\(.\{$MAX_LEN\}\).*$/\1../g" \ + -e 's/ *\.\.$/\.\./g' \ + -e "s;^${terminal^}$;$(GetCWD);g" +} + +# Help function +Help () { + echo "-- This is winfo --" + echo "Gets information over focused window" + echo + echo "Usage: getFWinfo [OPTION]" + echo " -h display this help and exit" + echo " -n for name" + echo " -i for icons" + echo " -t for titles" +} + +############################################## +#################### MAIN #################### +############################################## + +# Handles options +if [ $# -eq 0 ] +then + Help + exit 0 +fi + +while getopts ":hinTt" option +do + case "$option" in + + h) # Prints help message + Help + exit 0 + ;; + + T) # Get terminal specified by xmonad + echo ${terminal} + exit 0 + ;; + + i) # Get window icons, uses GetWinName + GetWinIcons + exit 0 + ;; + + n) # Get window name "WM_CLASS" + GetWinName + # Capitalize + exit 0 + ;; + + t) # Get window title, like name of webpage/working dir + GetWinTitle + exit 0 + ;; + + esac +done + echo "Invalid option." + Help + exit 1 diff --git a/config/X/xmobar/scripts/winfo_icons b/config/X/xmobar/scripts/winfo_icons new file mode 100644 index 0000000..dbdc3ae --- /dev/null +++ b/config/X/xmobar/scripts/winfo_icons @@ -0,0 +1,15 @@ +๎ž• alacritty kitty +๏‰ฉ firefox +๏กฒ minecraft multimc +๏„ˆ virt-manager virtualbox rustdesk +๏ข€ mpv +๏ญฎ discord +๎ซ„ jetbrains-clion +๎ฌ‘ pinentry-gtk-2 +๎œŒ code-oss +๏ซŠ mumble +๏œ˜ soffice libreoffice-writer +๏†ท steam +๎ฅ packettracer +๏ ‹ ktouch +๏กจ signal diff --git a/config/X/xmobar/xmobarrc0.hs b/config/X/xmobar/xmobarrc0.hs new file mode 100644 index 0000000..e3824f2 --- /dev/null +++ b/config/X/xmobar/xmobarrc0.hs @@ -0,0 +1,20 @@ +Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true" + -- Only 1 font, so height automatic + , position = BottomW C 16 + , bgColor = "#2e3440" + , fgColor = "#2aa198" + , lowerOnStart = True + , pickBroadest = False + , persistent = False + , hideOnStart = False + , overrideRedirect = True + , wmName = "xmobar2" + + , commands = [ + Run StdinReader + ] + , sepChar = "%" + , alignSep = "}{" + + , template = "} %StdinReader% {"} + diff --git a/config/X/xmobar/xmobarrc1.hs b/config/X/xmobar/xmobarrc1.hs new file mode 100644 index 0000000..a187055 --- /dev/null +++ b/config/X/xmobar/xmobarrc1.hs @@ -0,0 +1,149 @@ +Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true" + , additionalFonts = [ + "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=true:hinting=true", + "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=false:hinting=true" + ] + , position = TopH 24 + , borderColor = "#2e3440" + , borderWidth = 2 + , border = BottomB + , bgColor = "#2e3440" + , fgColor = "#2aa198" + , lowerOnStart = True + , pickBroadest = False + , persistent = False + , hideOnStart = False + , iconRoot = "/home/aluc/.config/xmobar/icons" + , overrideRedirect = True + , commands = [ Run Cpu [ "-t", "%" + ,"-l", "#2e3440,#58e1ac" + ,"-L", "20" + ,"-n", "#4c566a,#58e1ac" + ,"-h", "#cb4b16,#58e1ac" + ,"-H", "50" + ,"-w", "3" + ] 10 + + , Run Memory ["-t", "%" + ,"-l", "#2e3440,#58e1ac" + ,"-L", "20" + ,"-n", "#4c566a,#58e1ac" + ,"-h", "#cb4b16,#58e1ac" + ,"-H", "50" + ,"-w", "2" + ] 10 + + -- Focused window info + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-n"] "FWname" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-t"] "FWtitle" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-i"] "FWicon" 3 + , Run Com "/home/aluc/.config/xmobar/scripts/checkupds" ["-i"] "updates" 3600 + -- , Run ComX "$HOME/bin/cmusP" [] "" "cmus" 1 + , Run Com "uname" ["-r"] "" 36000 + , Run Date "\xf073 %b %_d %Y - %H:%M:%S" "date" 10 + , Run PipeReader "/home/aluc/.config/xmobar/scripts/volume-pipe" "vol" + ] + , sepChar = "%" + , alignSep = "}{" + + + -- COLORS + -- #2aa198 : Blue/green -- fg + -- + -- #d08770 : pinkish brown -- memory + -- #ff00ff : pink/purple -- swap + -- #828be6 : perrywinkle -- FWname + -- #825be6 : purpley -- FWtitle + -- bgColor = "#2e3440" + -- fgColor = "#2aa198" + -- #58e1ac + + , template = " \ + -- Left + + \๎‚ฒ\ + \\ + \\ + \ ๏Œƒ %uname% \ + \\ + \\ + \๎‚ฒ\ + + \๎‚ฒ\ + \\ + \\ + \ %vol% \ + \\ + \\ + \๎‚ฒ\ + + \๎‚ฒ\ + \\ + \\ + \\ + \ dmenu \ + \\ + \\ + \\ + \๎‚ฐ\ + + + -- Centered + \}\ + \๎‚ฒ\ + \\ + \\ + \ %FWicon% \ + \\ + \\ + \\ + \\ + \%FWname% \ + \\ + \\ + \\ + \\ + \\ + \%FWtitle%\ + \\ + \\ + \\ + \ \ + \๎‚ฐ\ + + + -- Right + \{ \ + + \๎‚ฒ\ + \\ + \\ + \ %updates% ๏’‡\ + \\ + \\ + \๎‚ฐ\ + + \๎‚ฐ\ + \\ + \\ + \ ๏‘ฃ%cpu% \ + \\ + \\ + \\ + \%memory% \ + \\ + \\ + \\ + \๎‚ฐ\ + + \๎‚ฐ\ + \\ + \\ + \ %date% \ + \\ + \\ + \๎‚ฐ " + + } + + diff --git a/config/X/xmonad/autostart/.cyclepaper.sh b/config/X/xmonad/autostart/.cyclepaper.sh new file mode 100755 index 0000000..fb07bc9 --- /dev/null +++ b/config/X/xmonad/autostart/.cyclepaper.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +wallpaper_dir="$HOME/Pictures/Wallpapers/nord" + +interval="15m" + +wallpapers=($(ls $wallpaper_dir)) +wp_count=${#wallpapers[@]} +i=0 + +while true; do + feh --bg-scale $wallpaper_dir/${wallpapers[$i]} + ((i++)) + if [ $i -eq $wp_count ] + then + i=0 + fi + sleep $interval +done diff --git a/config/X/xmonad/autostart/autostart.sh b/config/X/xmonad/autostart/autostart.sh new file mode 100755 index 0000000..c9d75ae --- /dev/null +++ b/config/X/xmonad/autostart/autostart.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd $HOME/.config/xmonad/autostart/ +for script in *.sh +do + if [ "./$script" != "$0" ] && [ -z "$(ps aux | grep "$script" | head -n -1)" ] + then + echo "started $script" + setsid ./$script & + fi +done diff --git a/config/X/xmonad/autostart/fehbg.sh b/config/X/xmonad/autostart/fehbg.sh new file mode 100755 index 0000000..4b65f3a --- /dev/null +++ b/config/X/xmonad/autostart/fehbg.sh @@ -0,0 +1,2 @@ +#!/bin/sh +feh --no-fehbg --bg-scale "$HOME/pictures/Wallpapers/nord/nord_background3.jpg" diff --git a/config/X/xmonad/autostart/getvolume.sh b/config/X/xmonad/autostart/getvolume.sh new file mode 100755 index 0000000..ee2509e --- /dev/null +++ b/config/X/xmonad/autostart/getvolume.sh @@ -0,0 +1,20 @@ +#!/bin/bash +while true +do + string=$(pamixer --get-volume) + muted=$(pamixer --get-mute) + if [[ "$muted" == "true" ]] + then + icon="๏€ฆ" + elif [ $string -gt 49 ] + then + icon="๏€จ" + elif [ $string -eq 0 ] + then + icon="๏€ฆ" + elif [ $string -lt 50 ] + then + icon="๏€ง" + fi + echo "${string}% $icon" > $HOME/.config/xmobar/scripts/volume-pipe +done diff --git a/config/X/xmonad/autostart/yt-not.sh b/config/X/xmonad/autostart/yt-not.sh new file mode 100755 index 0000000..a68f0c3 --- /dev/null +++ b/config/X/xmonad/autostart/yt-not.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +ytnotdir="$HOME/.local/share/yt-not" + +get_notification() +{ + + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + channelId="$(echo "$line" | awk '{print $1}')" + ch_name="$(echo "$line" | awk '{print $2}')" + pre_vId="$(echo "$line" | awk '{print $3}')" + # Get last vid from xml feed + new_vId="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" | sed '/videoId/!d;s/^.*>\(.*\)<.*$/\1/g' | head -n1)" + if [ "$new_vId" != "$pre_vId" ] + then + dunstify "yt-notify" "NEW VID!! from\n${ch_name}" + newline=$(echo "$line" | sed "s/$pre_vId/$new_vId/") + sed -i "s/$line/$newline/" "${ytnotdir}/channels.yt-not" + fi + done +} + +# Two valid formats: +# 1: @channel +# 2: channelId @channel videoId +parse_channels() +{ + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + # First word of line is channelId or channelTag + chidot="$(echo "$line" | awk '{print $1}')" + # Tags start with @ + if [ "${chidot::1}" == "@" ] + then + # channel tag -> channelId + channelId="$(curl -s "https://www.youtube.com/${chidot}" | pup 'meta[itemprop="channelId"] attr{content}')" + sed -i "s/${chidot}/${channelId} ${chidot} novideo/" "${ytnotdir}/channels.yt-not" + fi + done +} + +main() +{ + mkdir -p "${ytnotdir}" + if [ ! -f "${ytnotdir}/channels.yt-not" ] + then + echo "@bugswriter_" > "${ytnotdir}/channels.yt-not" + echo "@DistroTube" >> "${ytnotdir}/channels.yt-not" + echo "@MentalOutlaw" >> "${ytnotdir}/channels.yt-not" + echo "@Fireship" >> "${ytnotdir}/channels.yt-not" + fi + + while true + do + sleep 15m + parse_channels + get_notification + done +} + +main diff --git a/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh b/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh new file mode 100755 index 0000000..fb07bc9 --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +wallpaper_dir="$HOME/Pictures/Wallpapers/nord" + +interval="15m" + +wallpapers=($(ls $wallpaper_dir)) +wp_count=${#wallpapers[@]} +i=0 + +while true; do + feh --bg-scale $wallpaper_dir/${wallpapers[$i]} + ((i++)) + if [ $i -eq $wp_count ] + then + i=0 + fi + sleep $interval +done diff --git a/config/X/xmonad/xmonad.disabled/autostart/autostart.sh b/config/X/xmonad/xmonad.disabled/autostart/autostart.sh new file mode 100755 index 0000000..c9d75ae --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/autostart/autostart.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd $HOME/.config/xmonad/autostart/ +for script in *.sh +do + if [ "./$script" != "$0" ] && [ -z "$(ps aux | grep "$script" | head -n -1)" ] + then + echo "started $script" + setsid ./$script & + fi +done diff --git a/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh b/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh new file mode 100755 index 0000000..4b65f3a --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh @@ -0,0 +1,2 @@ +#!/bin/sh +feh --no-fehbg --bg-scale "$HOME/pictures/Wallpapers/nord/nord_background3.jpg" diff --git a/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh b/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh new file mode 100755 index 0000000..ee2509e --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh @@ -0,0 +1,20 @@ +#!/bin/bash +while true +do + string=$(pamixer --get-volume) + muted=$(pamixer --get-mute) + if [[ "$muted" == "true" ]] + then + icon="๏€ฆ" + elif [ $string -gt 49 ] + then + icon="๏€จ" + elif [ $string -eq 0 ] + then + icon="๏€ฆ" + elif [ $string -lt 50 ] + then + icon="๏€ง" + fi + echo "${string}% $icon" > $HOME/.config/xmobar/scripts/volume-pipe +done diff --git a/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh b/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh new file mode 100755 index 0000000..a68f0c3 --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +ytnotdir="$HOME/.local/share/yt-not" + +get_notification() +{ + + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + channelId="$(echo "$line" | awk '{print $1}')" + ch_name="$(echo "$line" | awk '{print $2}')" + pre_vId="$(echo "$line" | awk '{print $3}')" + # Get last vid from xml feed + new_vId="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" | sed '/videoId/!d;s/^.*>\(.*\)<.*$/\1/g' | head -n1)" + if [ "$new_vId" != "$pre_vId" ] + then + dunstify "yt-notify" "NEW VID!! from\n${ch_name}" + newline=$(echo "$line" | sed "s/$pre_vId/$new_vId/") + sed -i "s/$line/$newline/" "${ytnotdir}/channels.yt-not" + fi + done +} + +# Two valid formats: +# 1: @channel +# 2: channelId @channel videoId +parse_channels() +{ + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + # First word of line is channelId or channelTag + chidot="$(echo "$line" | awk '{print $1}')" + # Tags start with @ + if [ "${chidot::1}" == "@" ] + then + # channel tag -> channelId + channelId="$(curl -s "https://www.youtube.com/${chidot}" | pup 'meta[itemprop="channelId"] attr{content}')" + sed -i "s/${chidot}/${channelId} ${chidot} novideo/" "${ytnotdir}/channels.yt-not" + fi + done +} + +main() +{ + mkdir -p "${ytnotdir}" + if [ ! -f "${ytnotdir}/channels.yt-not" ] + then + echo "@bugswriter_" > "${ytnotdir}/channels.yt-not" + echo "@DistroTube" >> "${ytnotdir}/channels.yt-not" + echo "@MentalOutlaw" >> "${ytnotdir}/channels.yt-not" + echo "@Fireship" >> "${ytnotdir}/channels.yt-not" + fi + + while true + do + sleep 15m + parse_channels + get_notification + done +} + +main diff --git a/config/X/xmonad/xmonad.disabled/xmonad.hs b/config/X/xmonad/xmonad.disabled/xmonad.hs new file mode 100644 index 0000000..e72957b --- /dev/null +++ b/config/X/xmonad/xmonad.disabled/xmonad.hs @@ -0,0 +1,344 @@ +import XMonad + +-- Actions +import qualified XMonad.Actions.CycleWS as CWS +import XMonad.Actions.NoBorders +import XMonad.Actions.SpawnOn + +-- Hooks +import XMonad.Hooks.DynamicLog (dynamicLogWithPP, filterOutWsPP, wrap, xmobarPP, xmobarColor, shorten, shorten', shortenLeft', PP(..)) +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) +import XMonad.Hooks.SetWMName +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP (xmobarFont) +import XMonad.Hooks.WorkspaceHistory + +import XMonad.Layout.Gaps +import XMonad.Layout.PerWorkspace +import XMonad.Layout.NoBorders +import XMonad.Layout.Spacing +import XMonad.Layout.Spiral + +import qualified XMonad.StackSet as W +-- import XMonad.EZConfig (AddAdditionalKeysP) + +-- Utils +import XMonad.Util.Cursor +import XMonad.Util.Dmenu +import XMonad.Util.EZConfig (additionalKeysP) +import XMonad.Util.NamedScratchpad +import XMonad.Util.Run +import XMonad.Util.SpawnOnce + +-- Data +import Data.Maybe (fromJust) +import Data.Monoid +import qualified Data.Map as M + +import System.Exit +import System.IO + +-- Variables +-- +-- Default Terminal +myTerminal :: String +myTerminal = "alacritty" + +-- Whether focus follows the mouse pointer. +myFocusFollowsMouse :: Bool +myFocusFollowsMouse = True + +-- Whether clicking on a window to focus also passes the click to the window +myClickJustFocuses :: Bool +myClickJustFocuses = True + +-- Width of the window border in pixels. +-- +myBorderWidth = 2 + +myModMask = mod4Mask + +-- myScratchPads :: [NamedScratchpad] +-- myScratchPads = [ NS "terminal" "kitty" (title =? "getScratched") defaultFloating ] +-- +-- Workspaces +myWorkspaces = ["cab","web","lab","ser","gfx","idi","gam","muz","cha","hid"] +colorbg = "#2e3440" +colorfg = "#eceff4" + +color01 = "#5e8bac" +color02 = "#b48ead" +color04 = "#ebcb8b" +color05 = "#81a1c1" +color09 = "#4c566a" +color17 = "#d03a3f" + +leftwp = "" +rightwp = "" + +-- Count of window in active workspace +windowCount :: X (Maybe String) +windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset + +------ COLORS + +-- Border colors for unfocused and focused windows, respectively. +myNormalBorderColor = color09 +myFocusedBorderColor = color05 + +------------------------------------------------------------------------ +-- Key bindings. Add, modify or remove key bindings here. +myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + -- + [((m .|. modm, k), windows $ f i) + | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] + ++ + -- + -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 + -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 + -- + [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] + -- | (key, sc) <- zip [xK_e, xK_w, xK_r] [0..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] + +------------------------------------------------------------------------ +-- Mouse bindings: default actions bound to mouse events +-- +myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- mod-button1, Set the window to floating mode and move by dragging + [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w + >> windows W.shiftMaster)) + -- mod-button2, Raise the window to the top of the stack + , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) + -- mod-button3, Set the window to floating mode and resize by dragging + , ((modm, button3), (\w -> focus w >> mouseResizeWindow w + >> windows W.shiftMaster)) + -- you may also bind events to the mouse scroll wheel (button4 and button5) + ] + +------------------------------------------------------------------------ +-- Layouts: +myLayoutPrinter :: String -> String +myLayoutPrinter "Spacing Tall" = xmobarColor colorfg colorbg "til" +myLayoutPrinter "Spacing Mirror Tall" = xmobarColor colorfg colorbg "mti" +myLayoutPrinter "Spacing Spiral" = xmobarColor colorfg colorbg "fib" +myLayoutPrinter "Spacing Full" = xmobarColor colorfg colorbg "ful" +myLayoutPrinter x = xmobarColor colorfg colorbg x + +myLayout = + onWorkspace "gam" Full $ + avoidStruts(gaps [(L,3), (D,3), (U,3), (R,3)] $ smartSpacing 2 $ tiled ||| Mirror tiled ||| fib ||| Full) + where + -- default tiling algorithm partitions the screen into two panes + tiled = Tall nmaster delta ratio + -- The default number of windows in the master pane + nmaster = 1 + -- Default proportion of screen occupied by master pane + ratio = 2/5 + -- Percent of screen to increment by when resizing panes + delta = 3/100 + + fib = spiral (6/7) + + +------------------------------------------------------------------------ +-- Window rules: + +myManageHook = composeAll + [ + -- className =? "Gimp" --> doFloat + -- , className =? "Tilp" --> doFloat + -- , resource =? "desktop_window" --> doIgnore + -- , resource =? "kdesktop" --> doIgnore + -- + className =? "discord" --> doShift "cha", + className =? "Steam" --> doShift "gam" + ] +-- <+> namedScratchpadManageHook myScratchPads + + +------------------------------------------------------------------------ +-- Startup hook +myStartupHook = do + + setWMName "XMonad" + + setDefaultCursor xC_arrow + + spawnOnce "checkupdates | wc -l > /tmp/updates.tmp" + spawnOnce "systemctl --user restart redshift.service" + spawnOnce "unclutter --timeout 3 --jitter 50 -b" + spawnOnce "numlockx" + spawnOnce "$HOME/.config/xmonad/autostart/autostart.sh" + +------------------------------------------------------------------------ +-- Now run xmonad with all the defaults we set up. + +-- Run xmonad with the settings you specify. No need to modify this. +-- +main = do + -- Setup xmobar as docks + -- + xmproc0 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc0.hs" + xmproc1 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc1.hs" + + -- ewmh: Add fullscreen handling support + xmonad $ docks . ewmh $ defaults { + layoutHook = avoidStruts $ layoutHook defaults + , logHook = dynamicLogWithPP $ filterOutWsPP ["hid"] $ xmobarPP { + ppOutput = \x -> hPutStrLn xmproc0 x + + , ppCurrent = xmobarColor colorfg colorbg . wrap leftwp rightwp -- Visible but not current workspace + , ppVisible = xmobarColor colorfg colorbg -- Hidden workspace + , ppHidden = xmobarColor color01 colorbg -- Hidden workspaces (no windows) + , ppHiddenNoWindows = xmobarColor color04 colorbg -- Title of active window + , ppTitle = xmobarColor "" "" . shorten' "" 0 -- Separator character + , ppSep = " " + , ppLayout = myLayoutPrinter + -- Urgent workspace , ppUrgent = xmobarColor color17 colorbg . wrap "!" "!" + , ppExtras = [windowCount] -- Adding # of windows on current workspace to the bar + } + +} + + +defaults = ewmh def { + -- simple stuff + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + + -- key bindings + keys = myKeys, + mouseBindings = myMouseBindings, + + -- hooks, layouts + layoutHook = myLayout, + manageHook = myManageHook <+> manageSpawn, + startupHook = myStartupHook + } + `additionalKeysP` + [ ("M-", spawn myTerminal) + , ("M-", withFocused hide) -- N.B. this is an absurd thing to do + , ("M-0", windows $ W.greedyView $ "hid") -- N.B. this is an absurd thing to do + , ("M-u", incScreenWindowSpacing (2)) + , ("M-i", incScreenWindowSpacing (-2)) + , ("M-o", setScreenWindowSpacing (2)) + -- Then these key bindings + -- cycling worspaces + , ("M-", CWS.nextWS) + , ("M-", CWS.prevWS) + , ("M-S-", CWS.shiftToNext >> CWS.nextWS) + , ("M-S-", CWS.shiftToPrev >> CWS.prevWS) + , ("M-m", spawn "emacs") + -- launch firefox + , ("M-b", spawn "firefox") + -- take screenshots + , ("M-s", spawn "maim ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png") + , ("M-C-s", spawn "maim -i $(xdotool getactivewindow) ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png") + , ("M-S-s", spawn "maim --select | xclip -selection clipboard -t image/png") + -- close focused window + , ("M-c", spawn "kill $(xprop | grep PID | cut -d = -f 2)") + , ("M-S-c", kill) + -- Rotate through the available layout algorithms + , ("M-C-1", sendMessage $ JumpToLayout "Tall") + , ("M-C-2", sendMessage $ JumpToLayout "Mirror Tall") + , ("M-C-3", sendMessage $ JumpToLayout "Spiral") + , ("M-C-4", sendMessage $ JumpToLayout "Full") + , ("M-", sendMessage NextLayout) + + , ("M-", spawn "cycleKB") + -- Resize viewed windows to the correct size + , ("M-n", refresh) + -- Move focus to the next window + , ("M-j", windows W.focusDown) + -- Move focus to the previous window + , ("M-k", windows W.focusUp) + -- Swap the focused window with the next window + , ("M-S-j", windows W.swapDown) + -- Swap the focused window with the previous window + , ("M-S-k", windows W.swapUp) + -- Shrink the master area + , ("M-h", sendMessage Shrink) + -- Expand the master area + , ("M-l", sendMessage Expand) + -- Push window back into tiling + , ("M-S-t", withFocused $ windows . W.sink) + -- Increment the number of windows in the master area + , ("M-,", sendMessage (IncMasterN 1)) + -- Deincrement the number of windows in the master area + , ("M-.", sendMessage (IncMasterN (-1))) + -- Quit xmonad + , ("M-S-q", io (exitWith ExitSuccess)) + -- Restart xmonad + , ("M-q", spawn "killall xmobar; xmonad --recompile && xmonad --restart") + , ("M-x m", spawn "kill -USR1 $(pgrep xmobar)") + -- open alsamixer and change volume with keyboard wheel + , ("" , spawn "pamixer -d 5") + , ("" , spawn "pamixer -i 5") + , ("" , spawn "pamixer -t") + , ("", spawn "light -U 5") + , ("" , spawn "light -A 5") + , ("M-y" , spawn "arr_hjkl") + -- Toggle borders + , ("M-S-b", do + withFocused toggleBorder + refresh) + -- Fullscreen by toggling borders, + -- struts so docks can be obfuscated + -- (forcing it into tiling, because problems if you change layouts) + , ("M-S-f", do + sendMessage ToggleStruts + sendMessage ToggleGaps + toggleWindowSpacingEnabled + withFocused toggleBorder + refresh) + + , ("M-a c" , spawn "code") + , ("M-a d" , spawnOn "cha" "discord") + , ("M-a s" , spawnOn "cha" "signal-desktop") + , ("M-a k" , spawn "virt-manager") + , ("M-a m" , spawn "mumble") + , ("M-a v" , spawn "virtualbox") + -- file managers + , ("M-f k", spawn ("kitty" ++ " -e ranger")) + , ("M-f d", spawn "dolphin") + + + -- cycle keyboards + -- dmenu + , ("M-S-", spawn "dmenu_run") + , ("M-p a", spawn "dmapimg") + , ("M-", spawn "dmpsbm") + , ("M-S-", spawn "dmpsclip") + , ("M-p c", spawn "dmclip") + , ("M-p d", spawn "dmdsktp") + , ("M-p f", spawn "dmfm") + , ("M-p g", spawn "passgen") + , ("M-p h", spawn "dmhelp") + , ("M-p l", spawn "dmlang") + , ("M-p m", spawn "passmenu") + -- , ("M-p S-m", spawn "passmenu --type") + , ("M-p p", spawn "dmpdf") + , ("M-p o", spawn "dmpower") + , ("M-p v", spawn "dmvid") + + -- Gaming + , ("M-g s", spawnOn "gam" "steam") + , ("M-g m", spawnOn "gam" "multimc -l 1.8.9") + ] diff --git a/config/X/xmonad/xmonad.hs b/config/X/xmonad/xmonad.hs new file mode 100644 index 0000000..c6cf44b --- /dev/null +++ b/config/X/xmonad/xmonad.hs @@ -0,0 +1,344 @@ +import XMonad + +-- Actions +import qualified XMonad.Actions.CycleWS as CWS +import XMonad.Actions.NoBorders +import XMonad.Actions.SpawnOn + +-- Hooks +import XMonad.Hooks.DynamicLog (dynamicLogWithPP, filterOutWsPP, wrap, xmobarPP, xmobarColor, shorten, shorten', shortenLeft', PP(..)) +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) +import XMonad.Hooks.SetWMName +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP (xmobarFont) +import XMonad.Hooks.WorkspaceHistory + +import XMonad.Layout.Gaps +import XMonad.Layout.PerWorkspace +import XMonad.Layout.NoBorders +import XMonad.Layout.Spacing +import XMonad.Layout.Spiral + +import qualified XMonad.StackSet as W +-- import XMonad.EZConfig (AddAdditionalKeysP) + +-- Utils +import XMonad.Util.Cursor +import XMonad.Util.Dmenu +import XMonad.Util.EZConfig (additionalKeysP) +import XMonad.Util.NamedScratchpad +import XMonad.Util.Run +import XMonad.Util.SpawnOnce + +-- Data +import Data.Maybe (fromJust) +import Data.Monoid +import qualified Data.Map as M + +import System.Exit +import System.IO + +-- Variables +-- +-- Default Terminal +myTerminal :: String +myTerminal = "alacritty" + +-- Whether focus follows the mouse pointer. +myFocusFollowsMouse :: Bool +myFocusFollowsMouse = True + +-- Whether clicking on a window to focus also passes the click to the window +myClickJustFocuses :: Bool +myClickJustFocuses = True + +-- Width of the window border in pixels. +-- +myBorderWidth = 2 + +myModMask = mod4Mask + +-- myScratchPads :: [NamedScratchpad] +-- myScratchPads = [ NS "terminal" "kitty" (title =? "getScratched") defaultFloating ] +-- +-- Workspaces +myWorkspaces = ["cab","web","lab","ser","gfx","idi","gam","muz","cha","hid"] +colorbg = "#2e3440" +colorfg = "#eceff4" + +color01 = "#5e8bac" +color02 = "#b48ead" +color04 = "#ebcb8b" +color05 = "#81a1c1" +color09 = "#4c566a" +color17 = "#d03a3f" + +leftwp = "" +rightwp = "" + +-- Count of window in active workspace +windowCount :: X (Maybe String) +windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset + +------ COLORS + +-- Border colors for unfocused and focused windows, respectively. +myNormalBorderColor = color09 +myFocusedBorderColor = color05 + +------------------------------------------------------------------------ +-- Key bindings. Add, modify or remove key bindings here. +myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + -- + [((m .|. modm, k), windows $ f i) + | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] + ++ + -- + -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 + -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 + -- + [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] + -- | (key, sc) <- zip [xK_e, xK_w, xK_r] [0..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] + +------------------------------------------------------------------------ +-- Mouse bindings: default actions bound to mouse events +-- +myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- mod-button1, Set the window to floating mode and move by dragging + [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w + >> windows W.shiftMaster)) + -- mod-button2, Raise the window to the top of the stack + , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) + -- mod-button3, Set the window to floating mode and resize by dragging + , ((modm, button3), (\w -> focus w >> mouseResizeWindow w + >> windows W.shiftMaster)) + -- you may also bind events to the mouse scroll wheel (button4 and button5) + ] + +------------------------------------------------------------------------ +-- Layouts: +myLayoutPrinter :: String -> String +myLayoutPrinter "Spacing Tall" = xmobarColor colorfg colorbg "til" +myLayoutPrinter "Spacing Mirror Tall" = xmobarColor colorfg colorbg "mti" +myLayoutPrinter "Spacing Spiral" = xmobarColor colorfg colorbg "fib" +myLayoutPrinter "Spacing Full" = xmobarColor colorfg colorbg "ful" +myLayoutPrinter x = xmobarColor colorfg colorbg x + +myLayout = + onWorkspace "gam" Full $ + avoidStruts(gaps [(L,3), (D,3), (U,3), (R,3)] $ smartSpacing 2 $ tiled ||| Mirror tiled ||| fib ||| Full) + where + -- default tiling algorithm partitions the screen into two panes + tiled = Tall nmaster delta ratio + -- The default number of windows in the master pane + nmaster = 1 + -- Default proportion of screen occupied by master pane + ratio = 2/5 + -- Percent of screen to increment by when resizing panes + delta = 3/100 + + fib = spiral (6/7) + + +------------------------------------------------------------------------ +-- Window rules: + +myManageHook = composeAll + [ + -- className =? "Gimp" --> doFloat + -- , className =? "Tilp" --> doFloat + -- , resource =? "desktop_window" --> doIgnore + -- , resource =? "kdesktop" --> doIgnore + -- + className =? "discord" --> doShift "cha", + className =? "Steam" --> doShift "gam" + ] +-- <+> namedScratchpadManageHook myScratchPads + + +------------------------------------------------------------------------ +-- Startup hook +myStartupHook = do + + setWMName "XMonad" + + setDefaultCursor xC_arrow + + spawnOnce "checkupdates | wc -l > /tmp/updates.tmp" + spawnOnce "systemctl --user restart redshift.service" + spawnOnce "unclutter --timeout 3 --jitter 50 -b" + spawnOnce "numlockx" + spawnOnce "$HOME/.config/xmonad/autostart/autostart.sh" + +------------------------------------------------------------------------ +-- Now run xmonad with all the defaults we set up. + +-- Run xmonad with the settings you specify. No need to modify this. +-- +main = do + -- Setup xmobar as docks + -- + xmproc0 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc0.hs" + xmproc1 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc1.hs" + + -- ewmh: Add fullscreen handling support + xmonad $ docks . ewmh $ defaults { + layoutHook = avoidStruts $ layoutHook defaults + , logHook = dynamicLogWithPP $ filterOutWsPP ["hid"] $ xmobarPP { + ppOutput = \x -> hPutStrLn xmproc0 x + + , ppCurrent = xmobarColor colorfg colorbg . wrap leftwp rightwp -- Visible but not current workspace + , ppVisible = xmobarColor colorfg colorbg -- Hidden workspace + , ppHidden = xmobarColor color01 colorbg -- Hidden workspaces (no windows) + , ppHiddenNoWindows = xmobarColor color04 colorbg -- Title of active window + , ppTitle = xmobarColor "" "" . shorten' "" 0 -- Separator character + , ppSep = " " + , ppLayout = myLayoutPrinter + -- Urgent workspace , ppUrgent = xmobarColor color17 colorbg . wrap "!" "!" + , ppExtras = [windowCount] -- Adding # of windows on current workspace to the bar + } + +} + + +defaults = ewmh def { + -- simple stuff + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + + -- key bindings + keys = myKeys, + mouseBindings = myMouseBindings, + + -- hooks, layouts + layoutHook = myLayout, + manageHook = myManageHook <+> manageSpawn, + startupHook = myStartupHook + } + `additionalKeysP` + [ ("M-", spawn myTerminal) + , ("M-", withFocused hide) -- N.B. this is an absurd thing to do + , ("M-0", windows $ W.greedyView $ "hid") -- N.B. this is an absurd thing to do + , ("M-u", incScreenWindowSpacing (2)) + , ("M-i", incScreenWindowSpacing (-2)) + , ("M-o", setScreenWindowSpacing (2)) + -- Then these key bindings + -- cycling worspaces + , ("M-", CWS.nextWS) + , ("M-", CWS.prevWS) + , ("M-S-", CWS.shiftToNext >> CWS.nextWS) + , ("M-S-", CWS.shiftToPrev >> CWS.prevWS) + , ("M-m", spawn "emacs") + -- launch firefox + , ("M-b", spawn "firefox") + -- take screenshots + , ("M-s", spawn "maim ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png") + , ("M-C-s", spawn "maim -i $(xdotool getactivewindow) ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png") + , ("M-S-s", spawn "maim --select | xclip -selection clipboard -t image/png") + -- close focused window + , ("M-c", spawn "kill $(xprop | grep PID | cut -d = -f 2)") + , ("M-S-c", kill) + -- Rotate through the available layout algorithms + , ("M-C-1", sendMessage $ JumpToLayout "Tall") + , ("M-C-2", sendMessage $ JumpToLayout "Mirror Tall") + , ("M-C-3", sendMessage $ JumpToLayout "Spiral") + , ("M-C-4", sendMessage $ JumpToLayout "Full") + , ("M-", sendMessage NextLayout) + + , ("M-", spawn "cycleKB") + -- Resize viewed windows to the correct size + , ("M-n", refresh) + -- Move focus to the next window + , ("M-j", windows W.focusDown) + -- Move focus to the previous window + , ("M-k", windows W.focusUp) + -- Swap the focused window with the next window + , ("M-S-j", windows W.swapDown) + -- Swap the focused window with the previous window + , ("M-S-k", windows W.swapUp) + -- Shrink the master area + , ("M-h", sendMessage Shrink) + -- Expand the master area + , ("M-l", sendMessage Expand) + -- Push window back into tiling + , ("M-S-t", withFocused $ windows . W.sink) + -- Increment the number of windows in the master area + , ("M-,", sendMessage (IncMasterN 1)) + -- Deincrement the number of windows in the master area + , ("M-.", sendMessage (IncMasterN (-1))) + -- Quit xmonad + , ("M-S-q", io (exitWith ExitSuccess)) + -- Restart xmonad + , ("M-q", spawn "killall xmobar; xmonad --recompile && xmonad --restart") + , ("M-x m", spawn "kill -USR1 $(pgrep xmobar)") + -- open alsamixer and change volume with keyboard wheel + , ("" , spawn "pamixer -d 5") + , ("" , spawn "pamixer -i 5") + , ("" , spawn "pamixer -t") + , ("", spawn "light -U 5") + , ("" , spawn "light -A 5") + , ("M-y" , spawn "arr_hjkl") + -- Toggle borders + , ("M-S-b", do + withFocused toggleBorder + refresh) + -- Fullscreen by toggling borders, + -- struts so docks can be obfuscated + -- (forcing it into tiling, because problems if you change layouts) + , ("M-S-f", do + sendMessage ToggleStruts + sendMessage ToggleGaps + toggleWindowSpacingEnabled + withFocused toggleBorder + refresh) + + , ("M-a c" , spawn "code") + , ("M-a d" , spawnOn "cha" "discord") + , ("M-a s" , spawnOn "cha" "signal-desktop") + , ("M-a k" , spawn "virt-manager") + , ("M-a m" , spawn "mumble") + , ("M-a v" , spawn "virtualbox") + -- file managers + , ("M-f k", spawn ("kitty" ++ " -e ranger")) + , ("M-f d", spawn "dolphin") + + + -- cycle keyboards + -- dmenu + , ("M-S-", spawn "dmenu_run") + , ("M-p a", spawn "dmapimg") + , ("M-", spawn "dmpsbm") + , ("M-S-", spawn "dmpsclip") + , ("M-p c", spawn "dmclip") + , ("M-p d", spawn "dmdsktp") + , ("M-p f", spawn "dmfm") + , ("M-p g", spawn "dmpassgen") + , ("M-p h", spawn "dmhelp") + , ("M-p l", spawn "dmlang") + , ("M-p m", spawn "dmpass") + -- , ("M-p S-m", spawn "passmenu --type") + , ("M-p p", spawn "dmpdf") + , ("M-p o", spawn "dmpower") + , ("M-p v", spawn "dmvid") + + -- Gaming + , ("M-g s", spawnOn "gam" "steam") + , ("M-g m", spawnOn "gam" "multimc -l 1.8.9") + ] diff --git a/config/common/btop.conf b/config/common/btop.conf new file mode 100644 index 0000000..2e6d928 --- /dev/null +++ b/config/common/btop.conf @@ -0,0 +1,212 @@ +#? Config file for btop v. 1.2.13 + +#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. +#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" +color_theme = "Default" + +#* If the theme set background should be shown, set to False if you want terminal background transparency. +theme_background = True + +#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false. +truecolor = True + +#* Set to true to force tty mode regardless if a real tty has been detected or not. +#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols. +force_tty = False + +#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets. +#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box. +#* Use whitespace " " as separator between different presets. +#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty" +presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty" + +#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists. +#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift. +vim_keys = True + +#* Rounded corners on boxes, is ignored if TTY mode is ON. +rounded_corners = True + +#* Default symbols to use for graph creation, "braille", "block" or "tty". +#* "braille" offers the highest resolution but might not be included in all fonts. +#* "block" has half the resolution of braille but uses more common characters. +#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY. +#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view. +graph_symbol = "braille" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_cpu = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_mem = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_net = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_proc = "default" + +#* Manually set which boxes to show. Available values are "cpu mem net proc", separate values with whitespace. +shown_boxes = "cpu mem net proc" + +#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs. +update_ms = 2000 + +#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", +#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. +proc_sorting = "cpu direct" + +#* Reverse sorting order, True or False. +proc_reversed = False + +#* Show processes as a tree. +proc_tree = True + +#* Use the cpu graph colors in the process list. +proc_colors = True + +#* Use a darkening gradient in the process list. +proc_gradient = True + +#* If process cpu usage should be of the core it's running on or usage of the total available cpu power. +proc_per_core = False + +#* Show process memory as bytes instead of percent. +proc_mem_bytes = True + +#* Show cpu graph for each process. +proc_cpu_graphs = True + +#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate) +proc_info_smaps = False + +#* Show proc box on left side of screen instead of right. +proc_left = False + +#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop). +proc_filter_kernel = False + +#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_upper = "total" + +#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_lower = "total" + +#* Toggles if the lower CPU graph should be inverted. +cpu_invert_lower = True + +#* Set to True to completely disable the lower CPU graph. +cpu_single_graph = False + +#* Show cpu box at bottom of screen instead of top. +cpu_bottom = False + +#* Shows the system uptime in the CPU box. +show_uptime = True + +#* Show cpu temperature. +check_temp = True + +#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors. +cpu_sensor = "Auto" + +#* Show temperatures for cpu cores also if check_temp is True and sensors has been found. +show_coretemp = True + +#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core. +#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine. +#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries. +#* Example: "4:0 5:1 6:3" +cpu_core_map = "" + +#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine". +temp_scale = "celsius" + +#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024. +base_10_sizes = False + +#* Show CPU frequency. +show_cpu_freq = True + +#* Draw a clock at top of screen, formatting according to strftime, empty string to disable. +#* Special formatting: /host = hostname | /user = username | /uptime = system uptime +clock_format = "%X" + +#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort. +background_update = True + +#* Custom cpu model name, empty string to disable. +custom_cpu_name = "" + +#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ". +#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user". +disks_filter = "" + +#* Show graphs instead of meters for memory values. +mem_graphs = True + +#* Show mem box below net box instead of above. +mem_below_net = False + +#* Count ZFS ARC in cached and available memory. +zfs_arc_cached = True + +#* If swap memory should be shown in memory box. +show_swap = True + +#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk. +swap_disk = True + +#* If mem box should be split to also show disks info. +show_disks = True + +#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar. +only_physical = True + +#* Read disks list from /etc/fstab. This also disables only_physical. +use_fstab = True + +#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool) +zfs_hide_datasets = False + +#* Set to true to show available disk space for privileged users. +disk_free_priv = False + +#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view. +show_io_stat = True + +#* Toggles io mode for disks, showing big graphs for disk read/write speeds. +io_mode = False + +#* Set to True to show combined read/write io graphs in io mode. +io_graph_combined = False + +#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ". +#* Example: "/mnt/media:100 /:20 /boot:1". +io_graph_speeds = "" + +#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False. +net_download = 100 + +net_upload = 100 + +#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest. +net_auto = True + +#* Sync the auto scaling for download and upload to whichever currently has the highest scale. +net_sync = True + +#* Starts with the Network Interface specified here. +net_iface = "" + +#* Show battery stats in top right if battery is present. +show_battery = True + +#* Which battery to use if multiple are present. "Auto" for auto detection. +selected_battery = "Auto" + +#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG". +#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info. +log_level = "WARNING" \ No newline at end of file diff --git a/config/common/mpd/mpd.conf b/config/common/mpd/mpd.conf new file mode 100644 index 0000000..4e047ba --- /dev/null +++ b/config/common/mpd/mpd.conf @@ -0,0 +1,12 @@ +music_directory "~/music" +playlist_directory "~/.config/mpd/playlists" +db_file "~/.config/mpd/database" +pid_file "~/.config/mpd/pid" +auto_update "yes" +restore_paused "yes" +bind_to_address "127.0.0.1" +port "6600" +audio_output { + type "pulse" + name "pulse audio" +} diff --git a/config/common/ncmpcpp/bindings b/config/common/ncmpcpp/bindings new file mode 100644 index 0000000..470b986 --- /dev/null +++ b/config/common/ncmpcpp/bindings @@ -0,0 +1,547 @@ +############################################################## +## This is the example bindings file. Copy it to ## +## $XDG_CONFIG_HOME/ncmpcpp/bindings or ~/.ncmpcpp/bindings ## +## and set up your preferences. ## +############################################################## +## +##### General rules ##### +## +## 1) Because each action has runtime checks whether it's +## ok to run it, a few actions can be bound to one key. +## Actions will be bound in order given in configuration +## file. When a key is pressed, first action in order +## will test itself whether it's possible to run it. If +## test succeeds, action is executed and other actions +## bound to this key are ignored. If it doesn't, next +## action in order tests itself etc. +## +## 2) It's possible to bind more that one action at once +## to a key. It can be done using the following syntax: +## +## def_key "key" +## action1 +## action2 +## ... +## +## This creates a chain of actions. When such chain is +## executed, each action in chain is run until the end of +## chain is reached or one of its actions fails to execute +## due to its requirements not being met. If multiple actions +## and/or chains are bound to the same key, they will be +## consecutively run until one of them gets fully executed. +## +## 3) When ncmpcpp starts, bindings configuration file is +## parsed and then ncmpcpp provides "missing pieces" +## of default keybindings. If you want to disable some +## bindings, there is a special action called 'dummy' +## for that purpose. Eg. if you want to disable ability +## to crop playlists, you need to put the following +## into configuration file: +## +## def_key "C" +## dummy +## +## After that ncmpcpp will not bind any default action +## to this key. +## +## 4) To let you write simple macros, the following special +## actions are provided: +## +## - push_character "character" - pushes given special +## character into input queue, so it will be immediately +## picked by ncmpcpp upon next call to readKey function. +## Accepted values: mouse, up, down, page_up, page_down, +## home, end, space, enter, insert, delete, left, right, +## tab, ctrl-a, ctrl-b, ..., ctrl-z, ctrl-[, ctrl-\\, +## ctrl-], ctrl-^, ctrl-_, f1, f2, ..., f12, backspace. +## In addition, most of these names can be prefixed with +## alt-/ctrl-/shift- to be recognized with the appropriate +## modifier key(s). +## +## - push_characters "string" - pushes given string into +## input queue. +## +## - require_runnable "action" - checks whether given action +## is runnable and fails if it isn't. This is especially +## useful when mixed with previous two functions. Consider +## the following macro definition: +## +## def_key "key" +## push_characters "custom_filter" +## apply_filter +## +## If apply_filter can't be currently run, we end up with +## sequence of characters in input queue which will be +## treated just as we typed them. This may lead to unexpected +## results (in this case 'c' will most likely clear current +## playlist, 'u' will trigger database update, 's' will stop +## playback etc.). To prevent such thing from happening, we +## need to change above definition to this one: +## +## def_key "key" +## require_runnable "apply_filter" +## push_characters "custom_filter" +## apply_filter +## +## Here, first we test whether apply_filter can be actually run +## before we stuff characters into input queue, so if condition +## is not met, whole chain is aborted and we're fine. +## +## - require_screen "screen" - checks whether given screen is +## currently active. accepted values: browser, clock, help, +## media_library, outputs, playlist, playlist_editor, +## search_engine, tag_editor, visualizer, last_fm, lyrics, +## selected_items_adder, server_info, song_info, +## sort_playlist_dialog, tiny_tag_editor. +## +## - run_external_command "command" - runs given command using +## system() function. +## +## - run_external_console_command "command" - runs given console +## command using system() function. +## +## +## 5) In addition to binding to a key, you can also bind actions +## or chains of actions to a command. If it comes to commands, +## syntax is very similar to defining keys. Here goes example +## definition of a command: +## +## def_command "quit" [deferred] +## stop +## quit +## +## If you execute the above command (which can be done by +## invoking action execute_command, typing 'quit' and pressing +## enter), ncmpcpp will stop the player and then quit. Note the +## presence of word 'deferred' enclosed in square brackets. It +## tells ncmpcpp to wait for confirmation (ie. pressing enter) +## after you typed quit. Instead of 'deferred', 'immediate' +## could be used. Then ncmpcpp will not wait for confirmation +## (enter) and will execute the command the moment it sees it. +## +## Note: while command chains are executed, internal environment +## update (which includes current window refresh and mpd status +## update) is not performed for performance reasons. However, it +## may be desirable to do so in some situration. Therefore it's +## possible to invoke by hand by performing 'update enviroment' +## action. +## +## Note: There is a difference between: +## +## def_key "key" +## action1 +## +## def_key "key" +## action2 +## +## and +## +## def_key "key" +## action1 +## action2 +## +## First one binds two single actions to the same key whilst +## second one defines a chain of actions. The behavior of +## these two is different and is described in (1) and (2). +## +## Note: Function def_key accepts non-ascii characters. +## +##### List of unbound actions ##### +## +## The following actions are not bound to any key/command: +## +## - set_volume +## - load +## +# +#def_key "mouse" +# mouse_event +# +def_key "k" + scroll_up +def_key "j" + scroll_down +def_key "H" + move_home +def_key "L" + move_end +# +# +#def_key "[" +# scroll_up_album +# +#def_key "]" +# scroll_down_album +# +#def_key "{" +# scroll_up_artist +# +#def_key "}" +# scroll_down_artist +# +#def_key "page_up" +# page_up +# +#def_key "page_down" +# page_down +# +#def_key "home" +# move_home +# +#def_key "end" +# move_end +# +#def_key "insert" +# select_item +# +#def_key "enter" +# enter_directory +# +#def_key "enter" +# toggle_output +# +#def_key "enter" +# run_action +# +#def_key "enter" +# play_item +# +#def_key "space" +# add_item_to_playlist +# +#def_key "space" +# toggle_lyrics_update_on_song_change +# +#def_key "space" +# toggle_visualization_type +# +#def_key "delete" +# delete_playlist_items +# +#def_key "delete" +# delete_browser_items +# +#def_key "delete" +# delete_stored_playlist +# +#def_key "right" +# next_column +# +#def_key "right" +# slave_screen +# +#def_key "right" +# volume_up +# +#def_key "+" +# volume_up +# +#def_key "left" +# previous_column +# +#def_key "left" +# master_screen +# +#def_key "left" +# volume_down +# +#def_key "-" +# volume_down +# +#def_key ":" +# execute_command +# +#def_key "tab" +# next_screen +# +#def_key "shift-tab" +# previous_screen +# +#def_key "f1" +# show_help +# +#def_key "1" +# show_playlist +# +#def_key "2" +# show_browser +# +#def_key "2" +# change_browse_mode +# +#def_key "3" +# show_search_engine +# +#def_key "3" +# reset_search_engine +# +#def_key "4" +# show_media_library +# +#def_key "4" +# toggle_media_library_columns_mode +# +#def_key "5" +# show_playlist_editor +# +#def_key "6" +# show_tag_editor +# +#def_key "7" +# show_outputs +# +#def_key "8" +# show_visualizer +# +#def_key "=" +# show_clock +# +#def_key "@" +# show_server_info +# +#def_key "s" +# stop +# +#def_key "p" +# pause +# +#def_key ">" +# next +# +#def_key "<" +# previous +# +#def_key "ctrl-h" +# jump_to_parent_directory +# +#def_key "ctrl-h" +# replay_song +# +#def_key "backspace" +# jump_to_parent_directory +# +#def_key "backspace" +# replay_song +# +#def_key "backspace" +# play +# +#def_key "f" +# seek_forward +# +#def_key "b" +# seek_backward +# +#def_key "r" +# toggle_repeat +# +#def_key "z" +# toggle_random +# +#def_key "y" +# save_tag_changes +# +#def_key "y" +# start_searching +# +#def_key "y" +# toggle_single +# +#def_key "R" +# toggle_consume +# +#def_key "Y" +# toggle_replay_gain_mode +# +#def_key "T" +# toggle_add_mode +# +#def_key "|" +# toggle_mouse +# +#def_key "#" +# toggle_bitrate_visibility +# +#def_key "Z" +# shuffle +# +#def_key "x" +# toggle_crossfade +# +#def_key "X" +# set_crossfade +# +#def_key "u" +# update_database +# +#def_key "ctrl-s" +# sort_playlist +# +#def_key "ctrl-s" +# toggle_browser_sort_mode +# +#def_key "ctrl-s" +# toggle_media_library_sort_mode +# +#def_key "ctrl-r" +# reverse_playlist +# +#def_key "ctrl-f" +# apply_filter +# +#def_key "ctrl-_" +# select_found_items +# +#def_key "/" +# find +# +#def_key "/" +# find_item_forward +# +#def_key "?" +# find +# +#def_key "?" +# find_item_backward +# +#def_key "." +# next_found_item +# +#def_key "," +# previous_found_item +# +#def_key "w" +# toggle_find_mode +# +#def_key "e" +# edit_song +# +#def_key "e" +# edit_library_tag +# +#def_key "e" +# edit_library_album +# +#def_key "e" +# edit_directory_name +# +#def_key "e" +# edit_playlist_name +# +#def_key "e" +# edit_lyrics +# +#def_key "i" +# show_song_info +# +#def_key "I" +# show_artist_info +# +#def_key "g" +# jump_to_position_in_song +# +#def_key "l" +# show_lyrics +# +#def_key "ctrl-v" +# select_range +# +#def_key "v" +# reverse_selection +# +#def_key "V" +# remove_selection +# +#def_key "B" +# select_album +# +#def_key "a" +# add_selected_items +# +#def_key "c" +# clear_playlist +# +#def_key "c" +# clear_main_playlist +# +#def_key "C" +# crop_playlist +# +#def_key "C" +# crop_main_playlist +# +#def_key "m" +# move_sort_order_up +# +#def_key "m" +# move_selected_items_up +# +#def_key "n" +# move_sort_order_down +# +#def_key "n" +# move_selected_items_down +# +#def_key "M" +# move_selected_items_to +# +#def_key "A" +# add +# +#def_key "S" +# save_playlist +# +#def_key "o" +# jump_to_playing_song +# +#def_key "G" +# jump_to_browser +# +#def_key "G" +# jump_to_playlist_editor +# +#def_key "~" +# jump_to_media_library +# +#def_key "E" +# jump_to_tag_editor +# +#def_key "U" +# toggle_playing_song_centering +# +#def_key "P" +# toggle_display_mode +# +#def_key "\\" +# toggle_interface +# +#def_key "!" +# toggle_separators_between_albums +# +#def_key "L" +# toggle_lyrics_fetcher +# +#def_key "F" +# fetch_lyrics_in_background +# +#def_key "alt-l" +# toggle_fetching_lyrics_in_background +# +#def_key "ctrl-l" +# toggle_screen_lock +# +#def_key "`" +# toggle_library_tag_type +# +#def_key "`" +# refetch_lyrics +# +#def_key "`" +# add_random_items +# +#def_key "ctrl-p" +# set_selected_items_priority +# +#def_key "q" +# quit +# diff --git a/config/common/ncmpcpp/config b/config/common/ncmpcpp/config new file mode 100644 index 0000000..88893cf --- /dev/null +++ b/config/common/ncmpcpp/config @@ -0,0 +1,598 @@ +############################################################## +## This is an example configuration file. Copy it to ## +## $XDG_CONFIG_HOME/ncmpcpp/config or $HOME/.ncmpcpp/config ## +## and set up your preferences. ## +############################################################## +# +##### directories ###### +## +## Directory for storing ncmpcpp related files. Changing it is useful if you +## want to store everything somewhere else and provide command line setting for +## alternative location to config file which defines that while launching +## ncmpcpp. +## +# +#ncmpcpp_directory = ~/.config/ncmpcpp +# +## +## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other +## MPD clients (eg. ncmpc) also use that location. +## +# +#lyrics_directory = ~/.lyrics +# +##### connection settings ##### +# +#mpd_host = localhost +# +#mpd_port = 6600 +# +#mpd_connection_timeout = 5 +# +## Needed for tag editor and file operations to work. +## +#mpd_music_dir = ~/music +# +#mpd_crossfade_time = 5 +# +# Exclude pattern for random song action +# http://www.boost.org/doc/libs/1_46_1/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html +#random_exclude_pattern = "^(temp|midi_songs).*" +# +##### music visualizer ##### +## +## In order to make music visualizer work with MPD you need to use the fifo +## output. Its format parameter has to be set to 44100:16:1 for mono +## visualization or 44100:16:2 for stereo visualization. As an example here is +## the relevant section for mpd.conf: +## +## audio_output { +## type "fifo" +## name "Visualizer feed" +## path "/tmp/mpd.fifo" +## format "44100:16:2" +## } +## +## If the visualization on occasion diverges from the audio output, please set +## 'buffer_time' parameter of your audio output in mpd.conf to '100000' (100ms) +## or less to prevent that from happening. +## +## Note: If you're using Mopidy, an address of a udpsink gstreamer's output is +## also accepted. For example, the following section in mopidy.conf: +## +## [audio] +## output = tee name=t ! queue ! autoaudiosink t. +## ! queue ! audio/x-raw,rate=44100,channels=2,format=S16LE +## ! udpsink host=localhost port=5555 +## +## will make localhost:5555 available as a source of data for the stereo +## visualizer. +## +# +#visualizer_data_source = /tmp/mpd.fifo +# +## +## Note: Below parameter is needed for ncmpcpp to determine which output +## provides data for visualizer and reset it at the beginning of visualization +## to synchronize with audio. +## +# +#visualizer_output_name = Visualizer feed +# +## +## If you set format to 44100:16:2, make it 'yes'. +## +#visualizer_in_stereo = yes +# +## +## Note: set below to >=10 only if you have synchronization issues with +## visualization and audio. +## +# +#visualizer_sync_interval = 0 +# +## +## Note: To enable spectrum frequency visualization you need to compile ncmpcpp +## with fftw3 support. +## +# +## Available values: spectrum, wave, wave_filled, ellipse. +## +#visualizer_type = spectrum +# +#visualizer_fps = 60 +# +#visualizer_autoscale = no +# +#visualizer_look = โ—โ–ฎ +# +#visualizer_color = blue, cyan, green, yellow, magenta, red +# +## Alternative subset of 256 colors for terminals that support it. +## +#visualizer_color = 47, 83, 119, 155, 191, 227, 221, 215, 209, 203, 197, 161 +# +## +## Note: The next few visualization options apply to the spectrum visualizer. +## +# +## Use unicode block characters for a smoother, more continuous look. +## This will override the visualizer_look option. With transparent terminals +## and visualizer_in_stereo set, artifacts may be visible on the bottom half of +## the visualization. +# +#visualizer_spectrum_smooth_look = yes +# +## A value between 1 and 5 inclusive. Specifying a larger value makes the +## visualizer look at a larger slice of time, which results in less jumpy +## visualizer output. +# +#visualizer_spectrum_dft_size = 2 +# +#visualizer_spectrum_gain = 10 +# +## Left-most frequency of visualizer in Hz, must be less than HZ MAX +# +#visualizer_spectrum_hz_min = 20 +# +## Right-most frequency of visualizer in Hz, must be greater than HZ MIN +# +#visualizer_spectrum_hz_max = 20000 +# +##### system encoding ##### +## +## ncmpcpp should detect your charset encoding but if it failed to do so, you +## can specify charset encoding you are using here. +## +## Note: You can see whether your ncmpcpp build supports charset detection by +## checking output of `ncmpcpp --version`. +## +## Note: Since MPD uses UTF-8 by default, setting this option makes sense only +## if your encoding is different. +## +# +#system_encoding = "" +# +##### delays ##### +# +## Time of inactivity (in seconds) after playlist highlighting will be disabled +## (0 = always on). +## +#playlist_disable_highlight_delay = 5 +# +## Defines how long messages are supposed to be visible. +## +#message_delay_time = 5 +# +##### song format ##### +## +## For a song format you can use: +## +## %l - length +## %f - filename +## %D - directory +## %a - artist +## %A - album artist +## %t - title +## %b - album +## %y - date +## %n - track number (01/12 -> 01) +## %N - full track info (01/12 -> 01/12) +## %g - genre +## %c - composer +## %p - performer +## %d - disc +## %C - comment +## %P - priority +## $R - begin right alignment +## +## If you want to make sure that a part of the format is displayed only when +## certain tags are present, you can archieve it by grouping them with brackets, +## e.g. '{%a - %t}' will be evaluated to 'ARTIST - TITLE' if both tags are +## present or '' otherwise. It is also possible to define a list of +## alternatives by providing several groups and separating them with '|', +## e.g. '{%t}|{%f}' will be evaluated to 'TITLE' or 'FILENAME' if the former is +## not present. +## +## Note: If you want to set limit on maximal length of a tag, just put the +## appropriate number between % and character that defines tag type, e.g. to +## make album take max. 20 terminal cells, use '%20b'. +## +## In addition, formats support markers used for text attributes. They are +## followed by character '$'. After that you can put: +## +## - 0 - default window color (discards all other colors) +## - 1 - black +## - 2 - red +## - 3 - green +## - 4 - yellow +## - 5 - blue +## - 6 - magenta +## - 7 - cyan +## - 8 - white +## - 9 - end of current color +## - b - bold text +## - u - underline text +## - r - reverse colors +## - a - use alternative character set +## +## If you don't want to use a non-color attribute anymore, just put it again, +## but this time insert character '/' between '$' and attribute character, +## e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag or filename with +## reversed colors. +## +## If you want to use 256 colors and/or background colors in formats (the naming +## scheme is described below in section about color definitions), it can be done +## with the syntax $(COLOR), e.g. to set the artist tag to one of the +## non-standard colors and make it have yellow background, you need to write +## $(197_yellow)%a$(end). Note that for standard colors this is interchangable +## with attributes listed above. +## +## Note: colors can be nested. +## +# +#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3%l$9} +# +#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f} +# +#song_library_format = {%n - }{%t}|{%f} +# +#alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b +# +#alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D} +# +#current_item_prefix = $(yellow)$r +# +#current_item_suffix = $/r$(end) +# +#current_item_inactive_column_prefix = $(white)$r +# +#current_item_inactive_column_suffix = $/r$(end) +# +#now_playing_prefix = $b +# +#now_playing_suffix = $/b +# +#browser_playlist_prefix = "$2playlist$9 " +# +#selected_item_prefix = $6 +# +#selected_item_suffix = $9 +# +#modified_item_prefix = $3> $9 +# +## +## Note: attributes are not supported for the following variables. +## +#song_window_title_format = {%a - }{%t}|{%f} +## +## Note: Below variables are used for sorting songs in browser. The sort mode +## determines how songs are sorted, and can be used in combination with a sort +## format to specify a custom sorting format. Available values for +## browser_sort_mode are "type", "name", "mtime", "format" and "none". +## +# +#browser_sort_mode = type +# +#browser_sort_format = {%a - }{%t}|{%f} {%l} +# +##### columns settings ##### +## +## syntax of song columns list format is "column column etc." +## +## - syntax for each column is: +## +## (width of the column)[color of the column]{displayed tag} +## +## Note: Width is by default in %, if you want a column to have fixed size, add +## 'f' after the value, e.g. (10)[white]{a} will be the column that take 10% of +## screen (so the real width will depend on actual screen size), whereas +## (10f)[white]{a} will take 10 terminal cells, no matter how wide the screen +## is. +## +## - color is optional (if you want the default one, leave the field empty). +## +## Note: You can give a column additional attributes by putting appropriate +## character after displayed tag character. Available attributes are: +## +## - r - column will be right aligned +## - E - if tag is empty, empty tag marker won't be displayed +## +## You can also: +## +## - give a column custom name by putting it after attributes, separated with +## character ':', e.g. {lr:Length} gives you right aligned column of lengths +## named "Length". +## +## - define sequence of tags, that have to be displayed in case predecessor is +## empty in a way similar to the one in classic song format, i.e. using '|' +## character, e.g. {a|c|p:Owner} creates column named "Owner" that tries to +## display artist tag and then composer and performer if previous ones are not +## available. +## +# +#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l} +# +##### various settings ##### +# +## +## Note: Custom command that will be executed each time song changes. Useful for +## notifications etc. +## +#execute_on_song_change = "" +# +## +## Note: Custom command that will be executed each time player state +## changes. The environment variable MPD_PLAYER_STATE is set to the current +## state (either unknown, play, pause, or stop) for its duration. +## +# +#execute_on_player_state_change = "" +# +#playlist_show_mpd_host = no +# +#playlist_show_remaining_time = no +# +#playlist_shorten_total_times = no +# +#playlist_separate_albums = no +# +## +## Note: Possible display modes: classic, columns. +## +#playlist_display_mode = columns +# +#browser_display_mode = classic +# +#search_engine_display_mode = classic +# +#playlist_editor_display_mode = classic +# +#discard_colors_if_item_is_selected = yes +# +#show_duplicate_tags = yes +# +#incremental_seeking = yes +# +#seek_time = 1 +# +#volume_change_step = 2 +# +#autocenter_mode = no +# +#centered_cursor = no +# +## +## Note: You can specify third character which will be used to build 'empty' +## part of progressbar. +## +#progressbar_look = => +# +## Available values: database, playlist. +## +#default_place_to_search_in = database +# +## Available values: classic, alternative. +## +#user_interface = classic +# +#data_fetching_delay = yes +# +## Available values: artist, album_artist, date, genre, composer, performer. +## +#media_library_primary_tag = artist +# +#media_library_albums_split_by_date = yes +# +#media_library_hide_album_dates = no +# +## Available values: wrapped, normal. +## +#default_find_mode = wrapped +# +#default_tag_editor_pattern = %n - %t +# +#header_visibility = yes +# +#statusbar_visibility = yes +# +## Show the "Connected to ..." message on startup +#connected_message_on_startup = yes +# +#titles_visibility = yes +# +#header_text_scrolling = yes +# +#cyclic_scrolling = no +# +#lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet +# +#follow_now_playing_lyrics = no +# +#fetch_lyrics_for_current_song_in_background = no +# +#store_lyrics_in_song_dir = no +# +#generate_win32_compatible_filenames = yes +# +#allow_for_physical_item_deletion = no +# +## +## Note: If you set this variable, ncmpcpp will try to get info from last.fm in +## language you set and if it fails, it will fall back to english. Otherwise it +## will use english the first time. +## +## Note: Language has to be expressed as an ISO 639 alpha-2 code. +## +#lastfm_preferred_language = en +# +#space_add_mode = add_remove +# +#show_hidden_files_in_local_browser = no +# +## +## How shall screen switcher work? +## +## - "previous" - switch between the current and previous screen. +## - "screen1,...,screenN" - switch between given sequence of screens. +## +## Screens available for use: help, playlist, browser, search_engine, +## media_library, playlist_editor, tag_editor, outputs, visualizer, clock, +## lyrics, last_fm. +## +#screen_switcher_mode = playlist, browser +# +## +## Note: You can define startup screen by choosing screen from the list above. +## +#startup_screen = playlist +# +## +## Note: You can define startup slave screen by choosing screen from the list +## above or an empty value for no slave screen. +## +#startup_slave_screen = "" +# +#startup_slave_screen_focus = no +# +## +## Default width of locked screen (in %). Acceptable values are from 20 to 80. +## +# +#locked_screen_width_part = 50 +# +#ask_for_locked_screen_width_part = yes +# +#jump_to_now_playing_song_at_start = yes +# +#ask_before_clearing_playlists = yes +# +#clock_display_seconds = no +# +#display_volume_level = yes +# +#display_bitrate = no +# +#display_remaining_time = no +# +## Available values: none, basic, extended, perl. +## +#regular_expressions = perl +# +## +## Note: if below is enabled, ncmpcpp will ignore leading "The" word while +## sorting items in browser, tags in media library, etc. +## +#ignore_leading_the = no +# +## +## Note: if below is enabled, ncmpcpp will ignore diacritics while searching and +## filtering lists. This takes an effect only if boost was compiled with ICU +## support. +## +#ignore_diacritics = no +# +#block_search_constraints_change_if_items_found = yes +# +#mouse_support = yes +# +#mouse_list_scroll_whole_page = no +# +#lines_scrolled = 5 +# +#empty_tag_marker = +# +#tags_separator = " | " +# +#tag_editor_extended_numeration = no +# +#media_library_sort_by_mtime = no +# +#enable_window_title = yes +# +## +## Note: You can choose default search mode for search engine. Available modes +## are: +## +## - 1 - use mpd built-in searching (no regexes, pattern matching) +## +## - 2 - use ncmpcpp searching (pattern matching with support for regexes, but +## if your mpd is on a remote machine, downloading big database to process +## it can take a while +## +## - 3 - match only exact values (this mode uses mpd function for searching in +## database and local one for searching in current playlist) +## +# +#search_engine_default_search_mode = 1 +# +#external_editor = nano +# +## Note: set to yes if external editor is a console application. +## +#use_console_editor = yes +# +##### colors definitions ##### +## +## It is possible to set a background color by setting a color value +## "_", e.g. red_black will set foregound color to red +## and background color to black. +## +## In addition, for terminals that support 256 colors it is possible to set one +## of them by using a number in range [1, 256] instead of color name, +## e.g. numerical value corresponding to red_black is 2_1. To find out if the +## terminal supports 256 colors, run ncmpcpp and check out the bottom of the +## help screen for list of available colors and their numerical values. +## +## What is more, there are two special values for the background color: +## "transparent" and "current". The first one explicitly sets the background to +## be transparent, while the second one allows you to preserve current +## background color and change only the foreground one. It's used implicitly +## when background color is not specified. +## +## Moreover, it is possible to attach format information to selected color +## variables by appending to their end a colon followed by one or more format +## flags, e.g. black:b or red:ur. The following variables support this syntax: +## visualizer_color, color1, color2, empty_tag_color, volume_color, +## state_line_color, state_flags_color, progressbar_color, +## progressbar_elapsed_color, player_state_color, statusbar_time_color, +## alternative_ui_separator_color. +## +## Note: due to technical limitations of older ncurses version, if 256 colors +## are used there is a possibility that you'll be able to use only colors with +## transparent background. +# +#colors_enabled = yes +# +#empty_tag_color = cyan +# +#header_window_color = default +# +#volume_color = default +# +#state_line_color = default +# +#state_flags_color = default:b +# +#main_window_color = yellow +# +#color1 = white +# +#color2 = green +# +#progressbar_color = black:b +# +#progressbar_elapsed_color = green:b +# +#statusbar_color = default +# +#statusbar_time_color = default:b +# +#player_state_color = default:b +# +#alternative_ui_separator_color = black:b +# +#window_border_color = green +# +#active_window_border = red +# diff --git a/config/common/ncmpcpp/error.log b/config/common/ncmpcpp/error.log new file mode 100644 index 0000000..e69de29 diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf new file mode 100755 index 0000000..7508667 --- /dev/null +++ b/config/common/tmux/tmux.conf @@ -0,0 +1,186 @@ +# +# By Nicholas Marriott. Public domain. +# but -now- me. +# + + +########################################################################### +################# MISC. ################################################### +########################################################################### +########################################################################### +# Some tweaks to the status line +set -g status-right "%H:%M" +set -g window-status-current-style "underscore" + +# If running inside (nested) tmux ($TMUX is set), then change the status line to red +%if #{TMUX} +set -g status-bg red +%endif + +# Enable RGB color if running in xterm +set-option -sa terminal-overrides ",xterm*:Tc" + +# Change the default $TERM to xterm-256color +# Necessary because vim ctrl arrows must be defined through TERM +set -g default-terminal "xterm-256color" +set-window-option -g xterm-keys on + +# No bells at all +set -g bell-action none + +# Keep windows around after they exit +set -g remain-on-exit off + +# More history lines +set -g history-limit 16384 + +# Base window is Numero Uno +set -g base-index 1 +set-window-option -g pane-base-index 1 + +# Set vi mode when copying +set-window-option -g mode-keys vi +# compatibility with vim for focus based events +set -g focus-events on + +########################################################################### +################# KEYBINDINGS ############################################# +########################################################################### +########################################################################### + + +# Reload config file +unbind r +bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf" + +########## CLIPBOARD ########## +unbind -T copy-mode-vi Space; #Default for begin-selection +unbind -T copy-mode-vi Enter; #Default for copy-selection +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard" +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard" + +# Unbind ESC +set -sg escape-time 0 + +# Toggle status bar +unbind t +bind t set-option status + +# Toggle monitoring window activity +bind m set monitor-activity\; display 'monitor-activity #{?monitor-activity,on,off}' + +bind M run-shell "tmux set monitor-silence #{?monitor-silence,0,10}"\; display "monitor-silence #{?monitor-silence,on,off}" + + + + +# if-shell "true" { +# if-shell "#{?monitor-silence,true,false}" { +# set monitor-silence 0 +# } +# if-shell "#{?monitor-silence,false,true}" { +# set monitor-silence 10 +# } +# display "monitor-silence #{?monitor-silence,on,off} #{monitor-silence}" +# } + +# Toggle synchronized panes (sending keys to every pane) +unbind y +bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}' + +# Paste from tmux buffer +unbind p +bind p paste-buffer + +# Kill all windows +bind x confirm -p "Kill Pane?" kill-pane +bind X confirm -p "Kill Window?" kill-window +bind M-x confirm -p "Kill Session?" kill-session +bind M-X confirm -p "Kill Server?" kill-server +# Restart pane +bind k run -C "respawn-pane -k; send-keys !! 'C-j'" + +########## SPLIT AND SWAP ########### +# Splitting +unbind v +bind v split-window -h -c "#{pane_current_path}" +unbind h +bind h split-window -v -c "#{pane_current_path}" +# Swapping left and right a la vim +unbind -n M-H +unbind -n M-L +bind -n M-H swap-pane -U +bind -n M-L swap-pane -D +## Resizing panes +bind -r C-H resize-pane -L 5 +bind -r C-J resize-pane -D 5 +bind -r C-K resize-pane -U 5 +bind -r C-L resize-pane -R 5 + +## Default keybindings for resizing +unbind C-Up +unbind C-Left +unbind C-Down +unbind C-Right +unbind M-Up +unbind M-Left +unbind M-Down +unbind M-Right + +# Join and break windows +unbind j +bind j command-prompt -1p "Take window:" "join-pane -s %%" +unbind J +bind J command-prompt -1p "Send to window:" "join-pane -t \:%% ; select-window -l" +# Break pane without losing focus +unbind b +bind b break-pane -t : +# Reset length and shit +unbind z +bind z select-layout main-vertical + +########## NAVIGATION ########## +# Pane navigating with h|j|k|l a la vim +unbind -n M-h +unbind -n M-j +unbind -n M-k +unbind -n M-l +bind -n -N "select leftwards pane" M-h select-pane -L +bind -n -N "select downwards pane" M-j select-pane -D +bind -n -N "select upwards pane" M-k select-pane -U +bind -n -N "select rightwards pane" M-l select-pane -R +# Window navigating with M-u|i +unbind -n M-u +unbind -n M-i +bind -n M-u previous-window +bind -n M-i next-window +# Session navigeting with S-M-u|i +unbind -n M-y +unbind -n M-o +bind -n M-U switch-client -p +bind -n M-I switch-client -n + +########## Windows ########## +# Rename window and open new window +unbind n # DEFAULT KEY: move to next window +unbind N +unbind w # DEFAULT KEY: change current window interactively aka choose-tree -zW +bind n command-prompt "rename-window '%%'" +bind N command-prompt "rename-session '%%'" +# Start new window where tmux started, will be home because of xmonad +bind w new-window -c "#{pane_current_path}" #-c "#{pane_current_path}" +bind W new-session -c "$HOME" + +# Show tree +unbind S +bind S choose-tree -Z + +# Turn the mouse on, but without copy mode dragging +# set -g mouse on +# unbind -n MouseDrag1Pane +# unbind -T copy-mode MouseDrag1Pane + +# Menu for mounting and ejecting devices. +unbind E +bind E display-menu -T "#[align=centre]#I:#W" -x W -y W '' Mount 0 "display-popup -E 'amount'" diff --git a/config/essentials/git/config b/config/essentials/git/config new file mode 100644 index 0000000..92bd6e5 --- /dev/null +++ b/config/essentials/git/config @@ -0,0 +1,5 @@ +[init] + defaultBranch = main +[user] + email = raymaekers.luca@gmail.com + name = Raymaekers Luca diff --git a/config/essentials/gnupg/gpg-agent.conf b/config/essentials/gnupg/gpg-agent.conf new file mode 100644 index 0000000..5ac350f --- /dev/null +++ b/config/essentials/gnupg/gpg-agent.conf @@ -0,0 +1,2 @@ +max-cache-ttl 60480000 +default-cache-ttl 60480000 diff --git a/config/essentials/nvim/after/plugin/colorizer.lua b/config/essentials/nvim/after/plugin/colorizer.lua new file mode 100644 index 0000000..6ca374f --- /dev/null +++ b/config/essentials/nvim/after/plugin/colorizer.lua @@ -0,0 +1,6 @@ +require 'colorizer'.setup { + '*'; + html = { + mode = 'foreground'; + } +} diff --git a/config/essentials/nvim/after/plugin/colors.lua b/config/essentials/nvim/after/plugin/colors.lua new file mode 100644 index 0000000..516f097 --- /dev/null +++ b/config/essentials/nvim/after/plugin/colors.lua @@ -0,0 +1,16 @@ +function ColorMyPencils(color) + color = color or "nord" + vim.cmd.colorscheme(color) + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + vim.cmd.highlight("SignColumn guibg=none") + + vim.g.nord_uniform_diff_background = true + vim.g.nord_contrast = true + vim.g.nord_borders = true + local highlights = require("nord").bufferline.highlights({ + italic = true, + bold = true, + }) +end +ColorMyPencils() diff --git a/config/essentials/nvim/after/plugin/fugitive.lua b/config/essentials/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/config/essentials/nvim/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/config/essentials/nvim/after/plugin/harpoon.lua b/config/essentials/nvim/after/plugin/harpoon.lua new file mode 100644 index 0000000..6f9c8ba --- /dev/null +++ b/config/essentials/nvim/after/plugin/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "ha", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "h1", function() ui.nav_file(1) end) +vim.keymap.set("n", "h2", function() ui.nav_file(2) end) +vim.keymap.set("n", "h3", function() ui.nav_file(3) end) +vim.keymap.set("n", "h4", function() ui.nav_file(4) end) diff --git a/config/essentials/nvim/after/plugin/telescope.lua b/config/essentials/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..7ea6db8 --- /dev/null +++ b/config/essentials/nvim/after/plugin/telescope.lua @@ -0,0 +1,8 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', 'ps', builtin.live_grep, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +-- symbols +vim.keymap.set("n", "tse", "lua require'telescope.builtin'.symbols{ sources = {'emoji', 'gitmoji'} }") +vim.keymap.set("n", "tsn", "lua require'telescope.builtin'.symbols{ sources = {'nerd'} }") +vim.keymap.set("n", "tsj", "lua require'telescope.builtin'.symbols{ sources = {'julia'} }") diff --git a/config/essentials/nvim/after/plugin/treesitter.lua b/config/essentials/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..f7f726f --- /dev/null +++ b/config/essentials/nvim/after/plugin/treesitter.lua @@ -0,0 +1,16 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = { "c", "lua", "vim", "help", "diff"}, + + sync_install = false, + auto_install = true, + + highlight = { + enable = true, + + additional_vim_regex_highlighting = false, + + autotag = { + enable = true, + } + } +} diff --git a/config/essentials/nvim/after/plugin/undotree.lua b/config/essentials/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/config/essentials/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/config/essentials/nvim/after/plugin/zk.lua b/config/essentials/nvim/after/plugin/zk.lua new file mode 100644 index 0000000..a11f6df --- /dev/null +++ b/config/essentials/nvim/after/plugin/zk.lua @@ -0,0 +1,6 @@ +vim.cmd("hi tklink ctermfg=72 guifg=#81a1c1 cterm=bold,underline gui=bold,underline") +vim.cmd("hi tkBrackets ctermfg=gray guifg=gray") +vim.cmd("hi tkHighlight ctermbg=yellow ctermfg=red cterm=bold guibg=#ebcb8b guifg=black gui=bold") +vim.cmd("hi link CalNavi CalRuler") +vim.cmd("hi tkTagSep ctermfg=gray guifg=gray") +vim.cmd("hi tkTag ctermfg=175 guifg=#d3869B") diff --git a/config/essentials/nvim/init.lua b/config/essentials/nvim/init.lua new file mode 100644 index 0000000..7772f90 --- /dev/null +++ b/config/essentials/nvim/init.lua @@ -0,0 +1 @@ +require("tlast") diff --git a/config/essentials/nvim/lua/tlast/aucommands.vim b/config/essentials/nvim/lua/tlast/aucommands.vim new file mode 100644 index 0000000..732985f --- /dev/null +++ b/config/essentials/nvim/lua/tlast/aucommands.vim @@ -0,0 +1,21 @@ +" Absolute numbers if window isn't focused +augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,WinEnter * if &nu | set rnu | endif + autocmd BufLeave,FocusLost,WinLeave * if &nu | set nornu | endif +augroup END + +" terminal specific layout +augroup neovim_terminal autocmd! + autocmd TermOpen * startinsert + autocmd TermOpen * :GitGutterBufferDisable + autocmd TermOpen * :set nonumber norelativenumber signcolumn=no + autocmd TermOpen * nnoremap i +augroup END + +" Return to last edit position +autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + diff --git a/config/essentials/nvim/lua/tlast/cmp/arduino.lua b/config/essentials/nvim/lua/tlast/cmp/arduino.lua new file mode 100755 index 0000000..777df8d --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/arduino.lua @@ -0,0 +1,3 @@ +require'lspconfig'.arduino_language_server.setup{ + cmd = {"arduino-language-server", "-cli-config", "~/.arduinoIDE/arduino-cli.yaml"} +} diff --git a/config/essentials/nvim/lua/tlast/cmp/clangd.lua b/config/essentials/nvim/lua/tlast/cmp/clangd.lua new file mode 100644 index 0000000..810aa42 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/clangd.lua @@ -0,0 +1,2 @@ +-- c cpp +require'lspconfig'.clangd.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/css.lua b/config/essentials/nvim/lua/tlast/cmp/css.lua new file mode 100644 index 0000000..07cb8bc --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/css.lua @@ -0,0 +1 @@ +require'lspconfig'.cssls.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/emmet.lua b/config/essentials/nvim/lua/tlast/cmp/emmet.lua new file mode 100644 index 0000000..3193727 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/emmet.lua @@ -0,0 +1 @@ +require'lspconfig'.emmet_ls.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/html.lua b/config/essentials/nvim/lua/tlast/cmp/html.lua new file mode 100644 index 0000000..69ed29d --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/html.lua @@ -0,0 +1,7 @@ +-- html +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +require'lspconfig'.html.setup { + capabilities = capabilities, +} diff --git a/config/essentials/nvim/lua/tlast/cmp/init.lua b/config/essentials/nvim/lua/tlast/cmp/init.lua new file mode 100644 index 0000000..90e6024 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/init.lua @@ -0,0 +1,10 @@ +require("tlast.cmp.setup") + +require("tlast.cmp.arduino") +require("tlast.cmp.clangd") +require("tlast.cmp.html") +require("tlast.cmp.css") +require("tlast.cmp.js") +require("tlast.cmp.emmet") +require("tlast.cmp.lua") +require("tlast.cmp.python") diff --git a/config/essentials/nvim/lua/tlast/cmp/js.lua b/config/essentials/nvim/lua/tlast/cmp/js.lua new file mode 100644 index 0000000..7188a22 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/js.lua @@ -0,0 +1 @@ +require'lspconfig'.tsserver.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/lua.lua b/config/essentials/nvim/lua/tlast/cmp/lua.lua new file mode 100644 index 0000000..e594870 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/lua.lua @@ -0,0 +1,20 @@ +-- lua +require'lspconfig'.lua_ls.setup { + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = {'vim'}, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, -- no prompt for luassert :) + }, + telemetry = { + enable = false, + }, + }, + }, +} diff --git a/config/essentials/nvim/lua/tlast/cmp/python.lua b/config/essentials/nvim/lua/tlast/cmp/python.lua new file mode 100644 index 0000000..aec86bd --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/python.lua @@ -0,0 +1 @@ +require'lspconfig'.jedi_language_server.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/setup.lua b/config/essentials/nvim/lua/tlast/cmp/setup.lua new file mode 100644 index 0000000..67baf9e --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/setup.lua @@ -0,0 +1,47 @@ +local cmp = require'cmp' +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lua' }, + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'luasnip' }, + { name = 'buffer'}, + }), +}) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, + { name = 'buffer' }, + }) +}) + +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + }, +}) +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' }, + { name = 'cmdline', keyword_length = 3 } + }), +}) diff --git a/config/essentials/nvim/lua/tlast/init.lua b/config/essentials/nvim/lua/tlast/init.lua new file mode 100644 index 0000000..9a9f387 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/init.lua @@ -0,0 +1,6 @@ +require("tlast.packer") +require("tlast.remap") +require("tlast.set") +require("tlast.cmp") +require("tlast.zk") +vim.cmd.source(vim.fn.stdpath("config") .. "/lua/tlast/aucommands.vim") diff --git a/config/essentials/nvim/lua/tlast/packer.lua b/config/essentials/nvim/lua/tlast/packer.lua new file mode 100644 index 0000000..8bc9e3b --- /dev/null +++ b/config/essentials/nvim/lua/tlast/packer.lua @@ -0,0 +1,68 @@ +return require('packer').startup(function(use) + use('wbthomason/packer.nvim') + + -- files + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} } + } + use('nvim-telescope/telescope-symbols.nvim') + use('theprimeagen/harpoon') + + -- colors + use('shaunsingh/nord.nvim') + use('folke/tokyonight.nvim') + use { + 'glepnir/dashboard-nvim', + event = 'VimEnter', + config = { + theme = 'hyper', + }, + requires = {'nvim-tree/nvim-web-devicons'} + } + use('norcalli/nvim-colorizer.lua') + + use('airblade/vim-gitgutter') + + use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use('nvim-treesitter/playground') + + use('mbbill/undotree') + + use('tpope/vim-capslock') + use('tpope/vim-commentary') + use('tpope/vim-endwise') + use('tpope/vim-fugitive') + use('tpope/vim-repeat') + use('tpope/vim-surround') + use('tpope/vim-vinegar') + + -- utils + use('godlygeek/tabular') + use('renerocksai/calendar-vim') + use('LordTlasT/live-server') + use('ojroques/vim-oscyank', {branch = "main"}) + + -- objects + use('michaeljsmith/vim-indent-object') + + -- completion + use('neovim/nvim-lspconfig') + use('hrsh7th/nvim-cmp') + use('hrsh7th/cmp-nvim-lua') + use('hrsh7th/cmp-nvim-lsp') + use('hrsh7th/cmp-buffer') + use('hrsh7th/cmp-path') + use('hrsh7th/cmp-cmdline') + + -- snippets + use('L3MON4D3/LuaSnip') + use('saadparwaiz1/cmp_luasnip') + + -- notes + use('renerocksai/telekasten.nvim') + use({ + "iamcco/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end, + }) +end) diff --git a/config/essentials/nvim/lua/tlast/remap.lua b/config/essentials/nvim/lua/tlast/remap.lua new file mode 100644 index 0000000..d87c9d0 --- /dev/null +++ b/config/essentials/nvim/lua/tlast/remap.lua @@ -0,0 +1,62 @@ +vim.g.mapleader = " " + +vim.keymap.set("n", "-", vim.cmd.Ex) + +-- moving +vim.keymap.set("i", "", "I") +vim.keymap.set("i", "", "A") + +-- add closing +vim.keymap.set("i", "\"", "\"\"") +vim.keymap.set("i", "'", "''") +vim.keymap.set("i", "(", "()") +vim.keymap.set("i", "[", "[]") +vim.keymap.set("i", "{", "{}") +vim.keymap.set("i", "{", "{}O") +vim.keymap.set("i", "{;", "{};O") + +-- buffers +vim.keymap.set("n", "gb", "buffers:buffer") +vim.keymap.set("n", "q", "q!") +vim.keymap.set("n", "Q", "qa!") + +-- Windows +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "", "h") +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "", "j") +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "", "k") +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "", "l") +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "", "o") + +-- move visual selection up/down wards +vim.keymap.set("v", "J", "m '>+1gv=gv") +vim.keymap.set("v", "K", "m '<-2gv=gv") + +-- Don't move! +vim.keymap.set("n", "J", "mzJ`z") + +-- clipboard +vim.keymap.set("n", "y", "\"+y") +vim.keymap.set("n", "o", "OSCYank") + +-- scripts +vim.keymap.set("n", "x", "!chmod +x %", { silent = true}) + +-- replace +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) + +-- templates +vim.keymap.set("n", "rt", ":r " .. vim.fn.stdpath("config") .. "/templates/") + +-- hide all +local s = {hidden_all = 0} +vim.keymap.set("n", "", function () + s.hidden_all = 1 - s.hidden_all + local opt = s.hidden_all == 0 + vim.opt.showmode = opt + vim.opt.ruler = opt + vim.opt.nu = opt + vim.opt.rnu = opt + vim.opt.showcmd = opt + vim.opt.laststatus = opt and 2 or 0 + vim.opt.signcolumn = opt and "yes" or "no" +end) diff --git a/config/essentials/nvim/lua/tlast/set.lua b/config/essentials/nvim/lua/tlast/set.lua new file mode 100644 index 0000000..ab582bb --- /dev/null +++ b/config/essentials/nvim/lua/tlast/set.lua @@ -0,0 +1,36 @@ +vim.opt.clipboard = "unnamed" + +vim.opt.termguicolors = true + +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.showmatch = true +vim.opt.matchtime = 0 +vim.opt.showcmd = true +vim.opt.cursorline = true +vim.opt.ruler = true + +vim.opt.wildmenu = true +vim.opt.incsearch = true + +vim.opt.mouse = "" + +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.backspace = "indent,eol,start" + +vim.opt.signcolumn = "yes" +vim.opt.updatetime = 100 +vim.opt.laststatus = 2 +vim.opt.history = 200 +vim.opt.encoding = "utf-8" + +vim.opt.smartindent = true +vim.opt.scrolloff = 8 +vim.opt.textwidth = 74 + +vim.opt.ignorecase = true +vim.opt.smartcase = true + +vim.opt.swapfile = false +vim.opt.backup = false diff --git a/config/essentials/nvim/lua/tlast/zk.lua b/config/essentials/nvim/lua/tlast/zk.lua new file mode 100644 index 0000000..104c51c --- /dev/null +++ b/config/essentials/nvim/lua/tlast/zk.lua @@ -0,0 +1,75 @@ +local home = vim.fn.expand("~/docs/zk") +require('telekasten').setup({ + home = home, + take_over_my_home = true, + auto_set_filetype = true, + auto_set_syntax = true, + dailies = home .. '/' .. 'daily', + weeklies = home .. '/' .. 'weekly', + templates = home .. '/' .. 'templates', + image_subdir = "img", + extension = ".md", + new_note_filename = "title", + uuid_type = "%Y%m%d%H%M", + uuid_sep = "-", + filename_space_subst = nil, + follow_creates_nonexisting = true, + dailies_create_nonexisting = true, + weeklies_create_nonexisting = true, + journal_auto_open = false, + template_new_note = home .. '/' .. 'templates/new_note.md', + template_new_daily = home .. '/' .. 'templates/daily.md', + template_new_weekly= home .. '/' .. 'templates/weekly.md', + image_link_style = "markdown", + sort = "filename", + plug_into_calendar = true, + calendar_opts = { + weeknm = 4, + calendar_monday = 1, + calendar_mark = 'left-fit', + }, + close_after_yanking = false, + insert_after_inserting = true, + tag_notation = "#tag", + command_palette_theme = "dropdown", + show_tags_theme = "ivy", + subdirs_in_links = true, + template_handling = "smart", + new_note_location = "smart", + rename_update_links = true, + vaults = { + cs = { + home = home .. '/' .. 'cs', + template_new_note = home .. '/' .. 'templates/new_note.md', + }, + }, + media_previewer = "telescope-media-files", + follow_url_fallback = nil, +}) + +vim.keymap.set("n", "z", require('telekasten').panel) +vim.keymap.set("n", "zC", "CalendarT") +vim.keymap.set("n", "zF", require('telekasten').find_friends) +vim.keymap.set("n", "zI", "lua require('telekasten').insert_img_link({ i=true })") +vim.keymap.set("n", "zN", require('telekasten').new_templated_note) +vim.keymap.set("n", "zT", require('telekasten').goto_today) +vim.keymap.set("n", "zW", require('telekasten').goto_thisweek) +vim.keymap.set("n", "za", require('telekasten').show_tags) +vim.keymap.set("n", "zb", require('telekasten').show_backlinks) +vim.keymap.set("n", "zc", require('telekasten').show_calendar) +vim.keymap.set("n", "zd", require('telekasten').find_daily_notes) +vim.keymap.set("n", "zf", require('telekasten').find_notes) +vim.keymap.set("n", "zg", require('telekasten').search_notes) +vim.keymap.set("n", "zi", require('telekasten').paste_img_and_link) +vim.keymap.set("n", "zm", require('telekasten').browse_media) +vim.keymap.set("n", "zn", require('telekasten').new_note) +vim.keymap.set("n", "zp", require('telekasten').preview_img) +vim.keymap.set("n", "zr", require('telekasten').rename_note) +vim.keymap.set("n", "zs", require('telekasten').switch_vault) +vim.keymap.set("n", "zt", require('telekasten').toggle_todo) +vim.keymap.set("n", "zt","lua require('telekasten').toggle_todo({ i=true })") +vim.keymap.set("n", "zw", require('telekasten').find_weekly_notes) +vim.keymap.set("n", "zy", require('telekasten').yank_notelink) +vim.keymap.set("n", "zz", require('telekasten').follow_link) +vim.keymap.set("n", "#", require('telekasten').show_tags) +vim.keymap.set("n", "[", "lua require('telekasten').insert_link({ i=true })") diff --git a/config/essentials/nvim/templates/cpp.make b/config/essentials/nvim/templates/cpp.make new file mode 100644 index 0000000..474cd78 --- /dev/null +++ b/config/essentials/nvim/templates/cpp.make @@ -0,0 +1,4 @@ +FILE = + +$(FILE): $(FILE).cpp + c++ -Wall -Werror -ggdb $(FILE).cpp -o $(FILE) diff --git a/config/essentials/nvim/templates/main.cpp b/config/essentials/nvim/templates/main.cpp new file mode 100644 index 0000000..3d4f0fb --- /dev/null +++ b/config/essentials/nvim/templates/main.cpp @@ -0,0 +1,6 @@ +#include +using namespace std; + +int main() { + return 0; +} diff --git a/config/essentials/zsh/aliases.zsh b/config/essentials/zsh/aliases.zsh new file mode 100644 index 0000000..1904c78 --- /dev/null +++ b/config/essentials/zsh/aliases.zsh @@ -0,0 +1,291 @@ +#!/bin/zsh +# s/alias \([^-]\)/alias -g \1 + +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + # alias ls='ls -h --color --group-directories-first' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' + alias ip='ip -color=auto' +fi + +alias -g l='ls -l' +alias -g ll='ls -la' +alias -g la='ls -aF' +alias -g lst='ls --tree' +alias -g lst1='ls --tree -L1' +alias -g lst2='ls --tree -L2' +alias -g lst3='ls --tree -L3' +alias ls.='ls -dl .*' +alias ls='exa --icons --sort extension --group-directories-first' + +alias nv='nvim' +alias -g vimp="vim -c 'PlugInstall'" +alias yay='pikaur' +alias dopac='doas pacman' +alias orpac='pacman -Qtdq | dopac -Rns - 2> /dev/null || echo "No orphans."' +alias pacup='dopac -Syu' +alias pacsi='pacman -Si' +alias pacss='pacman -Ss' +alias pacqs='pacman -Qs' +alias pacql='pacman -Ql' +alias dopacs='dopac -S' +# +# +# ----------------------------------------------------------- + +alias grub-update='doas grub-mkconfig -o /boot/grub/grub.cfg' + +alias -g xclipp='xclip -selection clipboard -r' +alias -g xclipo='xclip -o -selection clipboard -r' +alias -g xclippc='xclip -o -selection primary | xclip -selection clipboard -r' +alias -g xclipcp='xclip -o -selection clipboard | xclip' + +alias -g xrandr-rpgmaker='xrandr --auto --output VGA-1 --mode 1024x768 --left-of HDMI-1 && ~/.fehbg' +alias -g xrandr-default='xrandr --auto --output VGA-1 --mode 1920x1080 --left-of HDMI-1 --output HDMI-1 --mode 1920x1080 && ~/.fehbg' + +alias mv='mv -i' +alias df='df -h' +alias -g dud='du -d 1 -h | sort -h' +alias -g d='du --max-depth=0 -h' +alias df='df -h' +alias shred='shred -uz' +alias lsblk='lsblk -o name,type,fsused,size,fstype,label,mountpoint' +alias -g floc='doas find / -type "f" 2> /dev/null | grep' +alias -g dloc='doas find / -type "d" 2> /dev/null | grep' +alias lsblk='lsblk -o name,type,fsused,size,fstype,label,mountpoint' +alias -g fif='find . -type "f" | grep' +alias -g fid='find . -type "d" | grep' +alias scr='nv "${vimf:=/tmp/$(uuidgen)}" ; rm -f "$vimf"' +alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i' +alias whatsmyip='curl "ifconfig.me"' +alias icognito='unset HISTFILE' +alias penv='python -m venv' +alias ytclipo='yt-dlp "$(xclip -sel c -o)"' + +alias -g '...'='../..' +alias -g '....'='../../..' +alias -g bg='&; disown' +alias -g cx='chmod +x' +alias -g ch='chown ${USER}:${USER} -R' +alias -g hl='--help |& less -r' +alias -g pi='ping archlinux.org -c4' +alias -g sba='source bin/activate' +alias -g smc='systemctl' +alias -g smcu='systemctl --user' +alias -g sr='source ~/.zshrc && rehash' +alias -g wf='doas wipefs -a' + +# quick config +alias -g ez='$EDITOR ~/.zshrc' +alias -g eza='$EDITOR ~/.config/zsh/aliases.zsh' +alias -g eto='$EDITOR ~/sync/TODO' + +alias -g ff='`fzffile`' +alias -g fd='`fzfdir`' +alias -g fdf='`fzfdirfile`' + +alias -s conf="$EDITOR" +alias -s txt="$EDITOR" +alias -s c="$EDITOR" +alias -s z80="$EDITOR" +alias -s zip='unzip -l' +alias -s tar='tar tf' + +# oh-my-zsh git aliases +alias g='git' + +alias ga='git add' +alias gaa='git add --all' +alias gapa='git add --patch' +alias gau='git add --update' +alias gav='git add --verbose' +alias gap='git apply' +alias gapt='git apply --3way' + +alias gb='git branch' +alias gba='git branch --all' +alias gbd='git branch --delete' +alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null' +alias gbD='git branch --delete --force' +alias gbl='git blame -b -w' +alias gbnm='git branch --no-merged' +alias gbr='git branch --remote' +alias gbs='git bisect' +alias gbsb='git bisect bad' +alias gbsg='git bisect good' +alias gbsr='git bisect reset' +alias gbss='git bisect start' + +alias gc='git commit --verbose' +alias gc!='git commit --verbose --amend' +alias gcn!='git commit --verbose --no-edit --amend' +alias gca='git commit --verbose --all' +alias gca!='git commit --verbose --all --amend' +alias gcan!='git commit --verbose --all --no-edit --amend' +alias gcans!='git commit --verbose --all --signoff --no-edit --amend' +alias gcam='git commit --all --message' +alias gcsm='git commit --signoff --message' +alias gcas='git commit --all --signoff' +alias gcasm='git commit --all --signoff --message' +alias gcb='git checkout -b' +alias gcf='git config --list' + +alias gcl='git clone --recurse-submodules' +alias gclean='git clean --interactive -d' +alias gpristine='git reset --hard && git clean --force -dx' +alias gcm='git checkout $(git_main_branch)' +alias gcd='git checkout $(git_develop_branch)' +alias gcmsg='git commit --message' +alias gco='git checkout' +alias gcor='git checkout --recurse-submodules' +alias gcount='git shortlog --summary --numbered' +alias gcp='git cherry-pick' +alias gcpa='git cherry-pick --abort' +alias gcpc='git cherry-pick --continue' +alias gcs='git commit --gpg-sign' +alias gcss='git commit --gpg-sign --signoff' +alias gcssm='git commit --gpg-sign --signoff --message' + +alias gd='git diff' +alias gdca='git diff --cached' +alias gdcw='git diff --cached --word-diff' +alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' +alias gds='git diff --staged' +alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gdup='git diff @{upstream}' +alias gdw='git diff --word-diff' + +alias ggpur='ggu' +alias ggpull='git pull origin "$(git_current_branch)"' +alias ggpush='git push origin "$(git_current_branch)"' + +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' +alias gpsup='git push --set-upstream origin $(git_current_branch)' + +alias ghh='git help' + +alias gignore='git update-index --assume-unchanged' +alias gignored='git ls-files -v | grep "^[[:lower:]]"' +alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' + +alias gk='\gitk --all --branches &!' +alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!' + +alias gl='git pull' +alias glg='git log --stat' +alias glgp='git log --stat --patch' +alias glgg='git log --graph' +alias glgga='git log --graph --decorate --all' +alias glgm='git log --graph --max-count=10' +alias glo='git log --oneline --decorate' +alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'" +alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat" +alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" +alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short" +alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all" +alias glog='git log --oneline --decorate --graph' +alias gloga='git log --oneline --decorate --graph --all' +alias glp="_git_log_prettily" + +alias gm='git merge' +alias gmom='git merge origin/$(git_main_branch)' +alias gmtl='git mergetool --no-prompt' +alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' +alias gmum='git merge upstream/$(git_main_branch)' +alias gma='git merge --abort' + +alias gp='git push' +alias gpd='git push --dry-run' +alias gpf='git push --force-with-lease' +alias gpf!='git push --force' +alias gpoat='git push origin --all && git push origin --tags' +alias gpr='git pull --rebase' +alias gpu='git push upstream' +alias gpv='git push --verbose' + +alias gr='git remote' +alias gra='git remote add' +alias grb='git rebase' +alias grba='git rebase --abort' +alias grbc='git rebase --continue' +alias grbd='git rebase $(git_develop_branch)' +alias grbi='git rebase --interactive' +alias grbm='git rebase $(git_main_branch)' +alias grbom='git rebase origin/$(git_main_branch)' +alias grbo='git rebase --onto' +alias grbs='git rebase --skip' +alias grev='git revert' +alias grh='git reset' +alias grhh='git reset --hard' +alias groh='git reset origin/$(git_current_branch) --hard' +alias grm='git rm' +alias grmc='git rm --cached' +alias grmv='git remote rename' +alias grrm='git remote remove' +alias grs='git restore' +alias grset='git remote set-url' +alias grss='git restore --source' +alias grst='git restore --staged' +alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' +alias gru='git reset --' +alias grup='git remote update' +alias grv='git remote --verbose' + +alias gsb='git status --short --branch' +alias gsd='git svn dcommit' +alias gsh='git show' +alias gsi='git submodule init' +alias gsps='git show --pretty=short --show-signature' +alias gsr='git svn rebase' +alias gss='git status --short' +alias gst='git status' + +alias gsta='git stash push' +alias gstaa='git stash apply' +alias gstc='git stash clear' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsts='git stash show --text' +alias gstu='gsta --include-untracked' +alias gstall='git stash --all' +alias gsu='git submodule update' +alias gsw='git switch' +alias gswc='git switch --create' +alias gswm='git switch $(git_main_branch)' +alias gswd='git switch $(git_develop_branch)' + +alias gts='git tag --sign' +alias gtv='git tag | sort -V' +alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl' + +alias gunignore='git update-index --no-assume-unchanged' +alias gunwip='git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1' +alias gup='git pull --rebase' +alias gupv='git pull --rebase --verbose' +alias gupa='git pull --rebase --autostash' +alias gupav='git pull --rebase --autostash --verbose' +alias gupom='git pull --rebase origin $(git_main_branch)' +alias gupomi='git pull --rebase=interactive origin $(git_main_branch)' +alias glum='git pull upstream $(git_main_branch)' +alias gluc='git pull upstream $(git_current_branch)' + +alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' + +alias gwt='git worktree' +alias gwta='git worktree add' +alias gwtls='git worktree list' +alias gwtmv='git worktree move' +alias gwtrm='git worktree remove' + +alias gam='git am' +alias gamc='git am --continue' +alias gams='git am --skip' +alias gama='git am --abort' +alias gamscp='git am --show-current-patch' diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh new file mode 100644 index 0000000..a73ea15 --- /dev/null +++ b/config/essentials/zsh/functions.zsh @@ -0,0 +1,79 @@ +#!/bin/zsh + +vmp() { + col -b | \ + vim -MR \ + -c 'set ft=man nolist nonu nornu' +} +vimh() { vim -c "help $1" -c 'call feedkeys("\o")' } + +nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } +ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } + +# googoo +o () +{ + f="$(fzffile $1)" + test "$#" -gt 0 && shift + test -n "$f" && $EDITOR $@ "$f" +} +go () +{ + d="$(fzfdir $1)" + test -d "$d" && cd "$d" +} +ogo () +{ + d="$(fzfdirfile $1)" + test -d "$d" && cd "$d" +} + +ipc () +{ + if [[ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" == "UP" ]] + then + doas ip link set eno1 down + else + doas ip link set eno1 up + fi +} + +calc () { echo "$@" | bc -l } + +unique () { + f="/tmp/$(uuidgen)" + awk '!x[$0]++' "$1" > "$f" + mv "$f" "$1" +} + +clip () { echo -n "$@" | xclip -selection clipboard -rmlastnl } + +fzh () { + choice="$(tac $HOME/.config/zsh/histfile | fzf)" + test -z "${choice}" && return + echo "${choice}" >> "${HOME}/.config/zsh/histfile" + eval "${choice}" +} + +unzipp () { + file=$1 + shift + unzip $file $@ || exit 1 + rm $file +} + +# fix long waiting time +__git_files () { + _wanted files expl 'local files' _files +} + +# allows changing to parent dir of file +function cd () { + if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then + [[ ! -e ${1:h} ]] && return 1 + print "Correcting ${1} to ${1:h}" + builtin cd ${1:h} + else + builtin cd "$@" + fi +} diff --git a/config/essentials/zsh/variables.zsh b/config/essentials/zsh/variables.zsh new file mode 100644 index 0000000..fd8099a --- /dev/null +++ b/config/essentials/zsh/variables.zsh @@ -0,0 +1,27 @@ +#!/bin/zsh +# VARIABLES +export ZOT="${HOME}/zot" + +export EDITOR="nvim" +export VISUAL="nvim" + +# colored GCC warnings and errors +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# Prevent ranger from loading config twice +export RANGER_LOAD_DEFAULT_RC=FALSE + +# Color of zsh-suggestion +export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' +export STARSHIP_CONFIG="${HOME}/.config/starship/starship.toml" +export FUNCNEST=10000 +export fpath=($HOME/.config/zsh/completion/ $fpath) + +# Config files from .config +export XINITRC="$HOME/.config/x11/xinitrc" +export GNUPGHOME="$HOME/.config/gnupg" +export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" +# export VIMINIT="source ~/.config/vim/vimrc" + +export PASSWORD_STORE_CLIP_TIME=5 +export DISPLAY=:0 diff --git a/config/extra/kdeglobals b/config/extra/kdeglobals new file mode 100644 index 0000000..e1465b0 --- /dev/null +++ b/config/extra/kdeglobals @@ -0,0 +1,2 @@ +[$Version] +update_info=filepicker.upd:filepicker-remove-old-previews-entry diff --git a/config/extra/kitty/kitty.conf b/config/extra/kitty/kitty.conf new file mode 100644 index 0000000..9d9168b --- /dev/null +++ b/config/extra/kitty/kitty.conf @@ -0,0 +1,2128 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +font_family DejaVuSansMono +bold_font auto +italic_font auto +bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. To get a full list of supported fonts use the `kitty +#: +list-fonts` command. By default they are derived automatically, by +#: the OSes font system. When bold_font or bold_italic_font is set to +#: auto on macOS, the priority of bold fonts is semi-bold, bold, +#: heavy. Setting them manually is useful for font families that have +#: many weight variants like Book, Medium, Thick, etc. For example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +font_size 11.0 + +#: Font size (in pts) + +force_ltr no + +#: kitty does not support BIDI (bidirectional text), however, for RTL +#: scripts, words are automatically displayed in RTL. That is to say, +#: in an RTL script, the words "HELLO WORLD" display in kitty as +#: "WORLD HELLO", and if you try to select a substring of an RTL- +#: shaped string, you will get the character that would be there had +#: the the string been LTR. For example, assuming the Hebrew word +#: ื™ืจื•ืฉืœื™ื, selecting the character that on the screen appears to be ื +#: actually writes into the selection buffer the character ื™. kitty's +#: default behavior is useful in conjunction with a filter to reverse +#: the word order, however, if you wish to manipulate RTL glyphs, it +#: can be very challenging to work with, so this option is provided to +#: turn it off. Furthermore, this option can be used with the command +#: line program GNU FriBidi +#: to get BIDI +#: support, because it will force kitty to always treat the text as +#: LTR, which FriBidi expects for terminals. + +adjust_line_height 0 +adjust_column_width 0 + +#: Change the size of each character cell kitty renders. You can use +#: either numbers, which are interpreted as pixels or percentages +#: (number followed by %), which are interpreted as percentages of the +#: unmodified values. You can use negative pixels or percentages less +#: than 100% to reduce sizes (but this might cause rendering +#: artifacts). + +adjust_baseline 0 + +#: Adjust the vertical alignment of text (the height in the cell at +#: which text is positioned). You can use either numbers, which are +#: interpreted as pixels or percentages (number followed by %), which +#: are interpreted as the percentage of the line height. A positive +#: value moves the baseline up, and a negative value moves them down. +#: The underline and strikethrough positions are adjusted accordingly. + +# symbol_map + +#: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols + +#: Map the specified Unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each Unicode code +#: point is specified in the form `U+`. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. This option can be specified multiple times. +#: The syntax is:: + +#: symbol_map codepoints Font Family Name + +# narrow_symbols + +#: E.g. narrow_symbols U+E0A0-U+E0A3,U+E0C0-U+E0C7 1 + +#: Usually, for Private Use Unicode characters and some symbol/dingbat +#: characters, if the character is followed by one or more spaces, +#: kitty will use those extra cells to render the character larger, if +#: the character in the font has a wide aspect ratio. Using this +#: option you can force kitty to restrict the specified code points to +#: render in the specified number of cells (defaulting to one cell). +#: This option can be specified multiple times. The syntax is:: + +#: narrow_symbols codepoints [optionally the number of cells] + +disable_ligatures never + +#: Choose how you want to handle multi-character ligatures. The +#: default is to always render them. You can tell kitty to not render +#: them when the cursor is over them by using cursor to make editing +#: easier, or have kitty never render them at all by using always, if +#: you don't like them. The ligature strategy can be set per-window +#: either using the kitty remote control facility or by defining +#: shortcuts for it in kitty.conf, for example:: + +#: map alt+1 disable_ligatures_in active always +#: map alt+2 disable_ligatures_in all never +#: map alt+3 disable_ligatures_in tab cursor + +#: Note that this refers to programming ligatures, typically +#: implemented using the calt OpenType feature. For disabling general +#: ligatures, use the font_features option. + +# font_features + +#: E.g. font_features none + +#: Choose exactly which OpenType features to enable or disable. This +#: is useful as some fonts might have features worthwhile in a +#: terminal. For example, Fira Code includes a discretionary feature, +#: zero, which in that font changes the appearance of the zero (0), to +#: make it more easily distinguishable from ร˜. Fira Code also includes +#: other discretionary features known as Stylistic Sets which have the +#: tags ss01 through ss20. + +#: For the exact syntax to use for individual features, see the +#: HarfBuzz documentation . + +#: Note that this code is indexed by PostScript name, and not the font +#: family. This allows you to define very precise feature settings; +#: e.g. you can disable a feature in the italic font but not in the +#: regular font. + +#: On Linux, font features are first read from the FontConfig database +#: and then this option is applied, so they can be configured in a +#: single, central place. + +#: To get the PostScript name for a font, use `kitty +list-fonts +#: --psnames`: + +#: .. code-block:: sh + +#: $ kitty +list-fonts --psnames | grep Fira +#: Fira Code +#: Fira Code Bold (FiraCode-Bold) +#: Fira Code Light (FiraCode-Light) +#: Fira Code Medium (FiraCode-Medium) +#: Fira Code Regular (FiraCode-Regular) +#: Fira Code Retina (FiraCode-Retina) + +#: The part in brackets is the PostScript name. + +#: Enable alternate zero and oldstyle numerals:: + +#: font_features FiraCode-Retina +zero +onum + +#: Enable only alternate zero in the bold font:: + +#: font_features FiraCode-Bold +zero + +#: Disable the normal ligatures, but keep the calt feature which (in +#: this font) breaks up monotony:: + +#: font_features TT2020StyleB-Regular -liga +calt + +#: In conjunction with force_ltr, you may want to disable Arabic +#: shaping entirely, and only look at their isolated forms if they +#: show up in a document. You can do this with e.g.:: + +#: font_features UnifontMedium +isol -medi -fina -init + +box_drawing_scale 0.001, 1, 1.5, 2 + +#: The sizes of the lines used for the box drawing Unicode characters. +#: These values are in pts. They will be scaled by the monitor DPI to +#: arrive at a pixel value. There must be four values corresponding to +#: thin, normal, thick, and very thick lines. + +#: }}} + +#: Cursor customization {{{ + +cursor #cccccc + +#: Default cursor color. If set to the special value none the cursor +#: will be rendered with a "reverse video" effect. It's color will be +#: the color of the text in the cell it is over and the text will be +#: rendered with the background color of the cell. Note that if the +#: program running in the terminal sets a cursor color, this takes +#: precedence. Also, the cursor colors are modified if the cell +#: background and foreground colors have very low contrast. + +cursor_text_color #111111 + +#: The color of text under the cursor. If you want it rendered with +#: the background color of the cell underneath instead, use the +#: special keyword: background. Note that if cursor is set to none +#: then this option is ignored. + +cursor_shape block + +#: The cursor shape can be one of block, beam, underline. Note that +#: when reloading the config this will be changed only if the cursor +#: shape has not been set by the program running in the terminal. This +#: sets the default cursor shape, applications running in the terminal +#: can override it. In particular, shell integration +#: in kitty sets +#: the cursor shape to beam at shell prompts. You can avoid this by +#: setting shell_integration to no-cursor. + +cursor_beam_thickness 1.5 + +#: The thickness of the beam cursor (in pts). + +cursor_underline_thickness 2.0 + +#: The thickness of the underline cursor (in pts). + +cursor_blink_interval 0 + +#: The interval to blink the cursor (in seconds). Set to zero to +#: disable blinking. Negative values mean use system default. Note +#: that the minimum interval will be limited to repaint_delay. + +cursor_stop_blinking_after 0.0 + +#: Stop blinking cursor after the specified number of seconds of +#: keyboard inactivity. Set to zero to never stop blinking. + +#: }}} + +#: Scrollback {{{ + +scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended as it can slow down performance of the terminal and +#: also use large amounts of RAM. Instead, consider using +#: scrollback_pager_history_size. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. Similarly CURSOR_LINE and +#: CURSOR_COLUMN will be replaced by the current cursor position or +#: set to 0 if there is no cursor, for example, when showing the last +#: command output. + +scrollback_pager_history_size 0 + +#: Separate scrollback history size (in MB), used only for browsing +#: the scrollback buffer with pager. This separate buffer is not +#: available for interactive scrolling but will be piped to the pager +#: program when viewing scrollback buffer in a separate window. The +#: current implementation stores the data in UTF-8, so approximatively +#: 10000 lines per megabyte at 100 chars per line, for pure ASCII, +#: unformatted text. A value of zero or less disables this feature. +#: The maximum allowed size is 4GB. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +scrollback_fill_enlarged_window no + +#: Fill new space with lines from the scrollback buffer after +#: enlarging a window. + +wheel_scroll_multiplier 5.0 + +#: Multiplier for the number of lines scrolled by the mouse wheel. +#: Note that this is only used for low precision scrolling devices, +#: not for high precision scrolling devices on platforms such as macOS +#: and Wayland. Use negative numbers to change scroll direction. See +#: also wheel_scroll_min_lines. + +wheel_scroll_min_lines 1 + +#: The minimum number of lines scrolled by the mouse wheel. The scroll +#: multiplier only takes effect after it +#: reaches this number. Note that this is only used for low precision +#: scrolling devices like wheel mice that scroll by very small amounts +#: when using the wheel. With a negative number, the minimum number of +#: lines will always be added. + +touch_scroll_multiplier 1.0 + +#: Multiplier for the number of lines scrolled by a touchpad. Note +#: that this is only used for high precision scrolling devices on +#: platforms such as macOS and Wayland. Use negative numbers to change +#: scroll direction. + +#: }}} + +#: Mouse {{{ + +mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. +#: Set to a negative value to hide the mouse cursor immediately when +#: typing text. Disabled by default on macOS as getting it to work +#: robustly with the ever-changing sea of bugs that is Cocoa is too +#: much effort. + +url_color #0087bd +url_style curly + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, straight, double, curly, dotted, dashed. + +open_url_with default + +#: The program to open clicked URLs. The special value default means +#: to use the operating system's default URL handler (open on macOS +#: and xdg-open on Linux). + +url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty mailto news sftp ssh + +#: The set of URL prefixes to look for when detecting a URL under the +#: mouse cursor. + +detect_urls yes + +#: Detect URLs under the mouse. Detected URLs are highlighted with an +#: underline and the mouse cursor becomes a hand over them. Even if +#: this option is disabled, URLs are still clickable. + +# url_excluded_characters + +#: Additional characters to be disallowed from URLs, when detecting +#: URLs under the mouse cursor. By default, all characters that are +#: legal in URLs are allowed. + +copy_on_select no + +#: Copy to clipboard or a private buffer on select. With this set to +#: clipboard, selecting text with the mouse will cause the text to be +#: copied to clipboard. Useful on platforms such as macOS that do not +#: have the concept of primary selection. You can instead specify a +#: name such as a1 to copy to a private kitty buffer. Map a shortcut +#: with the paste_from_buffer action to paste from this private +#: buffer. For example:: + +#: copy_on_select a1 +#: map shift+cmd+v paste_from_buffer a1 + +#: Note that copying to the clipboard is a security risk, as all +#: programs, including websites open in your browser can read the +#: contents of the system clipboard. + +paste_actions quote-urls-at-prompt + +#: A comma separated list of actions to take when pasting text into +#: the terminal. The supported paste actions are: + +#: quote-urls-at-prompt: +#: If the text being pasted is a URL and the cursor is at a shell prompt, +#: automatically quote the URL (needs shell_integration). +#: confirm: +#: Confirm the paste if bracketed paste mode is not active or there is more +#: a large amount of text being pasted. +#: filter: +#: Run the filter_paste() function from the file paste-actions.py in +#: the kitty config directory on the pasted text. The text returned by the +#: function will be actually pasted. + +strip_trailing_spaces never + +#: Remove spaces at the end of lines when copying to clipboard. A +#: value of smart will do it when using normal selections, but not +#: rectangle selections. A value of always will always do it. + +select_by_word_characters @-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alphanumeric character in the Unicode database will be matched. + +# select_by_word_characters_forward + +#: Characters considered part of a word when extending the selection +#: forward on double clicking. In addition to these characters any +#: character that is marked as an alphanumeric character in the +#: Unicode database will be matched. + +#: If empty (default) select_by_word_characters will be used for both +#: directions. + +click_interval -1.0 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds). Negative numbers will use the system default +#: instead, if available, or fallback to 0.5. + +focus_follows_mouse no + +#: Set the active window to the window under the mouse when moving the +#: mouse around. + +pointer_shape_when_grabbed arrow + +#: The shape of the mouse pointer when the program running in the +#: terminal grabs the mouse. Valid values are: arrow, beam and hand. + +default_pointer_shape beam + +#: The default shape of the mouse pointer. Valid values are: arrow, +#: beam and hand. + +pointer_shape_when_dragging beam + +#: The default shape of the mouse pointer when dragging across text. +#: Valid values are: arrow, beam and hand. + +#: Mouse actions {{{ + +#: Mouse buttons can be mapped to perform arbitrary actions. The +#: syntax is: + +#: .. code-block:: none + +#: mouse_map button-name event-type modes action + +#: Where button-name is one of left, middle, right, b1 ... b8 with +#: added keyboard modifiers. For example: ctrl+shift+left refers to +#: holding the Ctrl+Shift keys while clicking with the left mouse +#: button. The value b1 ... b8 can be used to refer to up to eight +#: buttons on a mouse. + +#: event-type is one of press, release, doublepress, triplepress, +#: click, doubleclick. modes indicates whether the action is performed +#: when the mouse is grabbed by the program running in the terminal, +#: or not. The values are grabbed or ungrabbed or a comma separated +#: combination of them. grabbed refers to when the program running in +#: the terminal has requested mouse events. Note that the click and +#: double click events have a delay of click_interval to disambiguate +#: from double and triple presses. + +#: You can run kitty with the kitty --debug-input command line option +#: to see mouse events. See the builtin actions below to get a sense +#: of what is possible. + +#: If you want to unmap an action, map it to no_op. For example, to +#: disable opening of URLs with a plain click:: + +#: mouse_map left click ungrabbed no_op + +#: See all the mappable actions including mouse actions here +#: . + +#: .. note:: +#: Once a selection is started, releasing the button that started it will +#: automatically end it and no release event will be dispatched. + +clear_all_mouse_actions no + +#: Remove all mouse action definitions up to this point. Useful, for +#: instance, to remove the default mouse actions. + +#: Click the link under the mouse or move the cursor + +mouse_map left click ungrabbed mouse_handle_click selection link prompt + +#:: First check for a selection and if one exists do nothing. Then +#:: check for a link under the mouse cursor and if one exists, click +#:: it. Finally check if the click happened at the current shell +#:: prompt and if so, move the cursor to the click location. Note +#:: that this requires shell integration +#:: to work. + +#: Click the link under the mouse or move the cursor even when grabbed + +mouse_map shift+left click grabbed,ungrabbed mouse_handle_click selection link prompt + +#:: Same as above, except that the action is performed even when the +#:: mouse is grabbed by the program running in the terminal. + +#: Click the link under the mouse cursor + +mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_handle_click link + +#:: Variant with Ctrl+Shift is present because the simple click based +#:: version has an unavoidable delay of click_interval, to +#:: disambiguate clicks from double clicks. + +#: Discard press event for link click + +mouse_map ctrl+shift+left press grabbed discard_event + +#:: Prevent this press event from being sent to the program that has +#:: grabbed the mouse, as the corresponding release event is used to +#:: open a URL. + +#: Paste from the primary selection + +mouse_map middle release ungrabbed paste_from_selection + +#: Start selecting text + +mouse_map left press ungrabbed mouse_selection normal + +#: Start selecting text in a rectangle + +mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle + +#: Select a word + +mouse_map left doublepress ungrabbed mouse_selection word + +#: Select a line + +mouse_map left triplepress ungrabbed mouse_selection line + +#: Select line from point + +mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point + +#:: Select from the clicked point to the end of the line. + +#: Extend the current selection + +mouse_map right press ungrabbed mouse_selection extend + +#:: If you want only the end of the selection to be moved instead of +#:: the nearest boundary, use move-end instead of extend. + +#: Paste from the primary selection even when grabbed + +mouse_map shift+middle release ungrabbed,grabbed paste_selection +mouse_map shift+middle press grabbed discard_event + +#: Start selecting text even when grabbed + +mouse_map shift+left press ungrabbed,grabbed mouse_selection normal + +#: Start selecting text in a rectangle even when grabbed + +mouse_map ctrl+shift+alt+left press ungrabbed,grabbed mouse_selection rectangle + +#: Select a word even when grabbed + +mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word + +#: Select a line even when grabbed + +mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line + +#: Select line from point even when grabbed + +mouse_map ctrl+shift+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point + +#:: Select from the clicked point to the end of the line even when +#:: grabbed. + +#: Extend the current selection even when grabbed + +mouse_map shift+right press ungrabbed,grabbed mouse_selection extend + +#: Show clicked command output in pager + +mouse_map ctrl+shift+right press ungrabbed mouse_show_command_output + +#:: Requires shell integration +#:: to work. + +#: }}} + +#: }}} + +#: Performance tuning {{{ + +repaint_delay 10 + +#: Delay between screen updates (in milliseconds). Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS, you have to +#: either set sync_to_monitor to no or use a monitor with a high +#: refresh rate. Also, to minimize latency when there is pending input +#: to be processed, this option is ignored. + +input_delay 3 + +#: Delay before input from the program running in the terminal is +#: processed (in milliseconds). Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. + +sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents screen tearing +#: when scrolling. +#: However, it limits the rendering speed to the refresh rate of your +#: monitor. With a very high speed mouse/high keyboard repeat rate, +#: you may notice some slight input latency. If so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +enable_audio_bell now + +#: The audio bell. Useful to disable it in environments that require +#: silence. + +visual_bell_duration 0.0 + +#: The visual bell duration (in seconds). Flash the screen when a bell +#: occurs for the specified number of seconds. Set to zero to disable. + +visual_bell_color none + +#: The color used by visual bell. Set to none will fall back to +#: selection background color. If you feel that the visual bell is too +#: bright, you can set it to a darker color. + +window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on linux. + +bell_on_tab "๐Ÿ”” " + +#: Some text or a Unicode symbol to show on the tab if a window in the +#: tab that does not have focus has a bell. If you want to use leading +#: or trailing spaces, surround the text with quotes. See +#: tab_title_template for how this is rendered. + +#: For backwards compatibility, values of yes, y and true are +#: converted to the default bell symbol and no, n, false and none are +#: converted to the empty string. + +command_on_bell none + +#: Program to run when a bell occurs. The environment variable +#: KITTY_CHILD_CMDLINE can be used to get the program running in the +#: window in which the bell occurred. + +bell_path none + +#: Path to a sound file to play as the bell sound. If set to none, the +#: system default bell sound is used. Must be in a format supported by +#: the operating systems sound API, such as WAV or OGA on Linux +#: (libcanberra) or AIFF, MP3 or WAV on macOS (NSSound) + +#: }}} + +#: Window layout {{{ + +remember_window_size yes +initial_window_width 640 +initial_window_height 400 + +#: If enabled, the window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +enabled_layouts * + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. Default configuration is all +#: layouts in alphabetical order. For a list of available layouts, see +#: the layouts . + +window_resize_step_cells 2 +window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing kitty windows in a layout with the shortcut +#: start_resizing_window. The cells value is used for horizontal +#: resizing, and the lines value is used for vertical resizing. + +window_border_width 0.5pt + +#: The width of window borders. Can be either in pixels (px) or pts +#: (pt). Values in pts will be rounded to the nearest number of pixels +#: based on screen resolution. If not specified, the unit is assumed +#: to be pts. Note that borders are displayed only when more than one +#: window is visible. They are meant to separate multiple windows. + +draw_minimal_borders yes + +#: Draw only the minimum borders needed. This means that only the +#: borders that separate the inactive window from a neighbor are +#: drawn. Note that setting a non-zero window_margin_width overrides +#: this and causes all borders to be drawn. + +window_margin_width 0 + +#: The window margin (in pts) (blank area outside the border). A +#: single value sets all four sides. Two values set the vertical and +#: horizontal sides. Three values set top, horizontal and bottom. Four +#: values set top, right, bottom and left. + +single_window_margin_width -1 + +#: The window margin to use when only a single window is visible (in +#: pts). Negative values will cause the value of window_margin_width +#: to be used instead. A single value sets all four sides. Two values +#: set the vertical and horizontal sides. Three values set top, +#: horizontal and bottom. Four values set top, right, bottom and left. + +window_padding_width 0 + +#: The window padding (in pts) (blank area between the text and the +#: window border). A single value sets all four sides. Two values set +#: the vertical and horizontal sides. Three values set top, horizontal +#: and bottom. Four values set top, right, bottom and left. + +placement_strategy center + +#: When the window size is not an exact multiple of the cell size, the +#: cell area of the terminal window will have some extra padding on +#: the sides. You can control how that padding is distributed with +#: this option. Using a value of center means the cell area will be +#: placed centrally. A value of top-left means the padding will be +#: only at the bottom and right edges. + +active_border_color #00ff00 + +#: The color for the border of the active window. Set this to none to +#: not draw borders around the active window. + +inactive_border_color #cccccc + +#: The color for the border of inactive windows. + +bell_border_color #ff5a00 + +#: The color for the border of inactive windows in which a bell has +#: occurred. + +inactive_text_alpha 1.0 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +hide_window_decorations no + +#: Hide the window decorations (title-bar and window borders) with +#: yes. On macOS, titlebar-only can be used to only hide the titlebar. +#: Whether this works and exactly what effect it has depends on the +#: window manager/operating system. Note that the effects of changing +#: this option when reloading config are undefined. + +window_logo_path none + +#: Path to a logo image. Must be in PNG format. Relative paths are +#: interpreted relative to the kitty config directory. The logo is +#: displayed in a corner of every kitty window. The position is +#: controlled by window_logo_position. Individual windows can be +#: configured to have different logos either using the launch action +#: or the remote control facility. + +window_logo_position bottom-right + +#: Where to position the window logo in the window. The value can be +#: one of: top-left, top, top-right, left, center, right, bottom-left, +#: bottom, bottom-right. + +window_logo_alpha 0.5 + +#: The amount the logo should be faded into the background. With zero +#: being fully faded and one being fully opaque. + +resize_debounce_time 0.1 + +#: The time to wait before redrawing the screen when a resize event is +#: received (in seconds). On platforms such as macOS, where the +#: operating system sends events corresponding to the start and end of +#: a resize, this number is ignored. + +resize_draw_strategy static + +#: Choose how kitty draws a window while a resize is in progress. A +#: value of static means draw the current window contents, mostly +#: unchanged. A value of scale means draw the current window contents +#: scaled. A value of blank means draw a blank window. A value of size +#: means show the window size in cells. + +resize_in_steps no + +#: Resize the OS window in steps as large as the cells, instead of +#: with the usual pixel accuracy. Combined with initial_window_width +#: and initial_window_height in number of cells, this option can be +#: used to keep the margins as small as possible when resizing the OS +#: window. Note that this does not currently work on Wayland. + +visual_window_select_characters 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ + +#: The list of characters for visual window selection. For example, +#: for selecting a window to focus on with focus_visible_window. The +#: value should be a series of unique numbers or alphabets, case +#: insensitive, from the set [0-9A-Z]. Specify your preference as a +#: string of characters. + +confirm_os_window_close 0 + +#: Ask for confirmation when closing an OS window or a tab with at +#: least this number of kitty windows in it by window manager (e.g. +#: clicking the window close button or pressing the operating system +#: shortcut to close windows) or by the close_tab action. A value of +#: zero disables confirmation. This confirmation also applies to +#: requests to quit the entire application (all OS windows, via the +#: quit action). Negative values are converted to positive ones, +#: however, with shell_integration enabled, using negative values +#: means windows sitting at a shell prompt are not counted, only +#: windows where some command is currently running. Note that if you +#: want confirmation when closing individual windows, you can map the +#: close_window_with_confirmation action. + +#: }}} + +#: Tab bar {{{ + +tab_bar_edge bottom + +#: The edge to show the tab bar on, top or bottom. + +tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts). + +tab_bar_margin_height 0.0 0.0 + +#: The margin above and below the tab bar (in pts). The first number +#: is the margin between the edge of the OS Window and the tab bar. +#: The second number is the margin between the tab bar and the +#: contents of the current tab. + +tab_bar_style fade + +#: The tab bar style, can be one of: + +#: fade +#: Each tab's edges fade into the background color. (See also tab_fade) +#: slant +#: Tabs look like the tabs in a physical file. +#: separator +#: Tabs are separated by a configurable separator. (See also +#: tab_separator) +#: powerline +#: Tabs are shown as a continuous line with "fancy" separators. +#: (See also tab_powerline_style) +#: custom +#: A user-supplied Python function called draw_tab is loaded from the file +#: tab_bar.py in the kitty config directory. For examples of how to +#: write such a function, see the functions named draw_tab_with_* in +#: kitty's source code: kitty/tab_bar.py. See also +#: this discussion https://github.com/kovidgoyal/kitty/discussions/4447 +#: for examples from kitty users. +#: hidden +#: The tab bar is hidden. If you use this, you might want to create a mapping +#: for the select_tab action which presents you with a list of tabs and +#: allows for easy switching to a tab. + +tab_bar_align left + +#: The horizontal alignment of the tab bar, can be one of: left, +#: center, right. + +tab_bar_min_tabs 2 + +#: The minimum number of tabs that must exist before the tab bar is +#: shown. + +tab_switch_strategy previous + +#: The algorithm to use when switching to a tab when the current tab +#: is closed. The default of previous will switch to the last used +#: tab. A value of left will switch to the tab to the left of the +#: closed tab. A value of right will switch to the tab to the right of +#: the closed tab. A value of last will switch to the right-most tab. + +tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +tab_separator " โ”‡" + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +tab_powerline_style angled + +#: The powerline separator style between tabs in the tab bar when +#: using powerline as the tab_bar_style, can be one of: angled, +#: slanted, round. + +tab_activity_symbol none + +#: Some text or a Unicode symbol to show on the tab if a window in the +#: tab that does not have focus has some activity. If you want to use +#: leading or trailing spaces, surround the text with quotes. See +#: tab_title_template for how this is rendered. + +tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}" + +#: A template to render the tab title. The default just renders the +#: title with optional symbols for bell and activity. If you wish to +#: include the tab-index as well, use something like: {index}:{title}. +#: Useful if you have shortcuts mapped for goto_tab N. If you prefer +#: to see the index as a superscript, use {sup.index}. In addition you +#: can use {layout_name} for the current layout name, {num_windows} +#: for the number of windows in the tab and {num_window_groups} for +#: the number of window groups (not counting overlay windows) in the +#: tab. Note that formatting is done by Python's string formatting +#: machinery, so you can use, for instance, {layout_name[:2].upper()} +#: to show only the first two letters of the layout name, upper-cased. +#: If you want to style the text, you can use styling directives, for +#: example: +#: `{fmt.fg.red}red{fmt.fg.tab}normal{fmt.bg._00FF00}greenbg{fmt.bg.tab}`. +#: Similarly, for bold and italic: +#: `{fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}`. +#: Note that for backward compatibility, if {bell_symbol} or +#: {activity_symbol} are not present in the template, they are +#: prepended to it. + +active_tab_title_template none + +#: Template to use for active tabs. If not specified falls back to +#: tab_title_template. + +active_tab_foreground #000 +active_tab_background #eee +active_tab_font_style bold-italic +inactive_tab_foreground #444 +inactive_tab_background #999 +inactive_tab_font_style normal + +#: Tab bar colors and styles. + +tab_bar_background none + +#: Background color for the tab bar. Defaults to using the terminal +#: background color. + +tab_bar_margin_color none + +#: Color for the tab bar margin area. Defaults to using the terminal +#: background color. + +#: }}} + +#: Color scheme {{{ +include nord.conf + +#: The foreground and background colors. + +background_opacity 0.80 + +#: The opacity of the background. A number between zero and one, where +#: one is opaque and zero is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the background color's opacity in +#: cells that have the same background color as the default terminal +#: background, so that things like the status bar in vim, powerline +#: prompts, etc. still look good. But it means that if you use a color +#: theme with a background color in your editor, it will not be +#: rendered as transparent. Instead you should change the default +#: background color in your kitty config and not use a background +#: color in the editor color scheme. Or use the escape codes to set +#: the terminals default colors in a shell script to launch your +#: editor. Be aware that using a value less than 1.0 is a (possibly +#: significant) performance hit. If you want to dynamically change +#: transparency of windows, set dynamic_background_opacity to yes +#: (this is off by default as it has a performance cost). Changing +#: this option when reloading the config will only work if +#: dynamic_background_opacity was enabled in the original config. + +background_image none + +#: Path to a background image. Must be in PNG format. + +background_image_layout tiled + +#: Whether to tile, scale or clamp the background image. The value can +#: be one of tiled, mirror-tiled, scaled, clamped. + +background_image_linear no + +#: When background image is scaled, whether linear interpolation +#: should be used. + +dynamic_background_opacity no + +#: Allow changing of the background_opacity dynamically, using either +#: keyboard shortcuts (increase_background_opacity and +#: decrease_background_opacity) or the remote control facility. +#: Changing this option by reloading the config is not supported. + +background_tint 0.0 + +#: How much to tint the background image by the background color. The +#: tint is applied only under the text area, not margin/borders. This +#: option makes it easier to read the text. Tinting is done using the +#: current background color for each window. This option applies only +#: if background_opacity is set and transparent windows are supported +#: or background_image is set. + +dim_opacity 0.75 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +selection_foreground #000000 +selection_background #fffacd + +#: The foreground and background colors for text selected with the +#: mouse. Setting both of these to none will cause a "reverse video" +#: effect for selections, where the selection will be the cell text +#: color and the text will become the cell background color. Setting +#: only selection_foreground to none will cause the foreground color +#: to be used unchanged. Note that these colors can be overridden by +#: the program running in the terminal. + +#: The color table {{{ + +#: The 256 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version, for the first 16 colors. You can set the +#: remaining 240 colors as color16 to color255. + +#: white + +mark1_foreground black + +#: Color for marks of type 1 + +mark1_background #98d3cb + +#: Color for marks of type 1 (light steel blue) + +mark2_foreground black + +#: Color for marks of type 2 + +mark2_background #f2dcd3 + +#: Color for marks of type 1 (beige) + +mark3_foreground black + +#: Color for marks of type 3 + +mark3_background #f274bc + +#: Color for marks of type 3 (violet) + +#: }}} + +#: }}} + +#: Advanced {{{ + +shell . + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login and --interactive to ensure that the shell starts in +#: interactive mode and reads its startup rc files. + +editor . + +#: The terminal based text editor (such as vim or nano) to use when +#: editing the kitty config file or similar tasks. + +#: The default value of . means to use the environment variables +#: VISUAL and EDITOR in that order. If these variables aren't set, +#: kitty will run your shell ($SHELL -l -i -c env) to see if your +#: shell startup rc files set VISUAL or EDITOR. If that doesn't work, +#: kitty will cycle through various known editors (vim, emacs, etc.) +#: and take the first one that exists on your system. + +close_on_child_death no + +#: Close the window when the child process (shell) exits. With the +#: default value no, the terminal will remain open when the child +#: exits as long as there are still processes outputting to the +#: terminal (for example disowned or backgrounded processes). When +#: enabled with yes, the window will close as soon as the child +#: process exits. Note that setting it to yes means that any +#: background processes still using the terminal can fail silently +#: because their stdout/stderr/stdin no longer work. + +allow_remote_control no + +#: Allow other programs to control kitty. If you turn this on, other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over SSH +#: connections. You can choose to either allow any program running +#: within kitty to control it with yes, or only allow programs that +#: connect to the socket (specified with the listen_on config option +#: or kitty --listen-on command line option) with the value socket- +#: only. The latter is useful if you want to prevent programs running +#: on a remote computer over SSH from controlling kitty. Reloading the +#: config will not affect this option. + +listen_on none + +#: Listen to the specified UNIX socket for remote control connections. +#: Note that this will apply to all kitty instances. It can be +#: overridden by the kitty --listen-on command line option, which +#: supports listening on TCP socket. This option accepts only UNIX +#: sockets, such as unix:${TEMP}/mykitty or unix:@mykitty (on Linux). +#: Environment variables are expanded and relative paths are resolved +#: with respect to the temporary directory. If {kitty_pid} is present, +#: then it is replaced by the PID of the kitty process, otherwise the +#: PID of the kitty process is appended to the value, with a hyphen. +#: This option is ignored unless you also set allow_remote_control to +#: enable remote control. See the help for kitty --listen-on for more +#: details. Changing this option by reloading the config is not +#: supported. + +# env + +#: Specify the environment variables to be set in all child processes. +#: Using the name with an equal sign (e.g. env VAR=) will set it to +#: the empty string. Specifying only the name (e.g. env VAR) will +#: remove the variable from the child process' environment. Note that +#: environment variables are expanded recursively, for example:: + +#: env VAR1=a +#: env VAR2=${HOME}/${VAR1}/b + +#: The value of VAR2 will be /a/b. + +# watcher + +#: Path to python file which will be loaded for watchers +#: . Can be +#: specified more than once to load multiple watchers. The watchers +#: will be added to every kitty window. Relative paths are resolved +#: relative to the kitty config directory. Note that reloading the +#: config will only affect windows created after the reload. + +# exe_search_path + +#: Control where kitty finds the programs to run. The default search +#: order is: First search the system wide PATH, then ~/.local/bin and +#: ~/bin. If still not found, the PATH defined in the login shell +#: after sourcing all its startup files is tried. Finally, if present, +#: the PATH specified by the env option is tried. + +#: This option allows you to prepend, append, or remove paths from +#: this search order. It can be specified multiple times for multiple +#: paths. A simple path will be prepended to the search order. A path +#: that starts with the + sign will be append to the search order, +#: after ~/bin above. A path that starts with the - sign will be +#: removed from the entire search order. For example:: + +#: exe_search_path /some/prepended/path +#: exe_search_path +/some/appended/path +#: exe_search_path -/some/excluded/path + +update_check_interval 24 + +#: The interval to periodically check if an update to kitty is +#: available (in hours). If an update is found, a system notification +#: is displayed informing you of the available update. The default is +#: to check every 24 hours, set to zero to disable. Update checking is +#: only done by the official binary builds. Distro packages or source +#: builds do not do update checking. Changing this option by reloading +#: the config is not supported. + +startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session command line option for +#: individual instances. See sessions +#: in the +#: kitty documentation for details. Note that relative paths are +#: interpreted with respect to the kitty config directory. Environment +#: variables in the path are expanded. Changing this option by +#: reloading the config is not supported. + +clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: possible actions are: write-clipboard, read-clipboard, write- +#: primary, read-primary, read-clipboard-ask, read-primary-ask. The +#: default is to allow writing to the clipboard and primary selection +#: and to ask for permission when a program tries to read from the +#: clipboard. Note that disabling the read confirmation is a security +#: risk as it means that any program, even the ones running on a +#: remote server via SSH can read your clipboard. See also +#: clipboard_max_size. + +clipboard_max_size 64 + +#: The maximum size (in MB) of data from programs running in kitty +#: that will be stored for writing to the system clipboard. A value of +#: zero means no size limit is applied. See also clipboard_control. + +# file_transfer_confirmation_bypass + +#: The password that can be supplied to the file transfer kitten +#: to skip the +#: transfer confirmation prompt. This should only be used when +#: initiating transfers from trusted computers, over trusted networks +#: or encrypted transports, as it allows any programs running on the +#: remote machine to read/write to the local filesystem, without +#: permission. + +allow_hyperlinks yes + +#: Process hyperlink escape sequences (OSC 8). If disabled OSC 8 +#: escape sequences are ignored. Otherwise they become clickable +#: links, that you can click with the mouse or by using the hints +#: kitten . The +#: special value of ask means that kitty will ask before opening the +#: link when clicked. + +shell_integration no-cursor + +#: Enable shell integration on supported shells. This enables features +#: such as jumping to previous prompts, browsing the output of the +#: previous command in a pager, etc. on supported shells. Set to +#: disabled to turn off shell integration, completely. It is also +#: possible to disable individual features, set to a space separated +#: list of these values: no-rc, no-cursor, no-title, no-cwd, no- +#: prompt-mark, no-complete. See Shell integration +#: for details. + +allow_cloning ask + +#: Control whether programs running in the terminal can request new +#: windows to be created. The canonical example is clone-in-kitty +#: . +#: By default, kitty will ask for permission for each clone request. +#: Allowing cloning unconditionally gives programs running in the +#: terminal (including over SSH) permission to execute arbitrary code, +#: as the user who is running the terminal, on the computer that the +#: terminal is running on. + +clone_source_strategies venv,conda,env_var,path + +#: Control what shell code is sourced when running clone-in-kitty in +#: the newly cloned window. The supported strategies are: + +#: venv +#: Source the file $VIRTUAL_ENV/bin/activate. This is used by the +#: Python stdlib venv module and allows cloning venvs automatically. +#: conda +#: Run conda activate $CONDA_DEFAULT_ENV. This supports the virtual +#: environments created by conda. +#: env_var +#: Execute the contents of the environment variable +#: KITTY_CLONE_SOURCE_CODE with eval. +#: path +#: Source the file pointed to by the environment variable +#: KITTY_CLONE_SOURCE_PATH. + +#: This option must be a comma separated list of the above values. +#: This only source the first valid one in the above order. + +term xterm-kitty + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on "Stack Overflow" +#: to change it. The TERM variable is used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. Changing this option by reloading the config will only affect +#: newly created windows. + +#: }}} + +#: OS specific tweaks {{{ + +wayland_titlebar_color system + +#: The color of the kitty window's titlebar on Wayland systems with +#: client side window decorations such as GNOME. A value of system +#: means to use the default system color, a value of background means +#: to use the background color of the currently active window and +#: finally you can use an arbitrary color, such as #12af59 or red. + +macos_titlebar_color system + +#: The color of the kitty window's titlebar on macOS. A value of +#: system means to use the default system color, light or dark can +#: also be used to set it explicitly. A value of background means to +#: use the background color of the currently active window and finally +#: you can use an arbitrary color, such as #12af59 or red. WARNING: +#: This option works by using a hack when arbitrary color (or +#: background) is configured, as there is no proper Cocoa API for it. +#: It sets the background color of the entire window and makes the +#: titlebar transparent. As such it is incompatible with +#: background_opacity. If you want to use both, you are probably +#: better off just hiding the titlebar with hide_window_decorations. + +macos_option_as_alt no + +#: Use the Option key as an Alt key on macOS. With this set to no, +#: kitty will use the macOS native Option+Key to enter Unicode +#: character behavior. This will break any Alt+Key keyboard shortcuts +#: in your terminal programs, but you can use the macOS Unicode input +#: technique. You can use the values: left, right or both to use only +#: the left, right or both Option keys as Alt, instead. Note that +#: kitty itself always treats Option the same as Alt. This means you +#: cannot use this option to configure different kitty shortcuts for +#: Option+Key vs. Alt+Key. Also, any kitty shortcuts using +#: Option/Alt+Key will take priority, so that any such key presses +#: will not be passed to terminal programs running inside kitty. +#: Changing this option by reloading the config is not supported. + +macos_hide_from_tasks no + +#: Hide the kitty window from running tasks on macOS (โŒ˜+Tab and the +#: Dock). Changing this option by reloading the config is not +#: supported. + +macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed on macOS. +#: By default, kitty will stay running, even with no open windows, as +#: is the expected behavior on macOS. + +macos_window_resizable yes + +#: Disable this if you want kitty top-level OS windows to not be +#: resizable on macOS. Changing this option by reloading the config +#: will only affect newly created OS windows. + +macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes on macOS. For example, a +#: value of 0.75 will result in rendering that looks similar to sub- +#: pixel antialiasing at common font sizes. + +macos_traditional_fullscreen no + +#: Use the macOS traditional full-screen transition, that is faster, +#: but less pretty. + +macos_show_window_title_in all + +#: Control where the window title is displayed on macOS. A value of +#: window will show the title of the currently active window at the +#: top of the macOS window. A value of menubar will show the title of +#: the currently active window in the macOS global menu bar, making +#: use of otherwise wasted space. A value of all will show the title +#: in both places, and none hides the title. See +#: macos_menubar_title_max_length for how to control the length of the +#: title in the menu bar. + +macos_menubar_title_max_length 0 + +#: The maximum number of characters from the window title to show in +#: the macOS global menu bar. Values less than one means that there is +#: no maximum limit. + +macos_custom_beam_cursor no + +#: Use a custom mouse cursor for macOS that is easier to see on both +#: light and dark backgrounds. Nowadays, the default macOS cursor +#: already comes with a white border. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. Changing this option +#: by reloading the config is not supported. + +macos_colorspace srgb + +#: The colorspace in which to interpret terminal colors. The default +#: of srgb will cause colors to match those seen in web browsers. The +#: value of default will use whatever the native colorspace of the +#: display is. The value of displayp3 will use Apple's special +#: snowflake display P3 color space, which will result in over +#: saturated (brighter) colors with some color shift. Reloading +#: configuration will change this value only for newly created OS +#: windows. + +linux_display_server auto + +#: Choose between Wayland and X11 backends. By default, an appropriate +#: backend based on the system state is chosen automatically. Set it +#: to x11 or wayland to force the choice. Changing this option by +#: reloading the config is not supported. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: Keys are identified simply by their lowercase Unicode characters. +#: For example: a for the A key, [ for the left square bracket key, +#: etc. For functional keys, such as Enter or Escape, the names are +#: present at Functional key definitions +#: . For modifier keys, the names are ctrl (control, โŒƒ), +#: shift (โ‡ง), alt (opt, option, โŒฅ), super (cmd, command, โŒ˜). See also: +#: GLFW mods + +#: On Linux you can also use XKB key names to bind keys that are not +#: supported by GLFW. See XKB keys +#: for a list of key names. The name to use is the part +#: after the XKB_KEY_ prefix. Note that you can only use an XKB key +#: name for keys that are not known as GLFW keys. + +#: Finally, you can use raw system key codes to map keys, again only +#: for keys that are not known as GLFW keys. To see the system key +#: code for a key, start kitty with the kitty --debug-input option, +#: kitty will output some debug text for every key event. In that text +#: look for native_code, the value of that becomes the key name in the +#: shortcut. For example: + +#: .. code-block:: none + +#: on_key_input: glfw key: 0x61 native_code: 0x61 action: PRESS mods: none text: 'a' + +#: Here, the key name for the A key is 0x61 and you can use it with:: + +#: map ctrl+0x61 something + +#: to map Ctrl+A to something. + +#: You can use the special action no_op to unmap a keyboard shortcut +#: that is assigned in the default configuration:: + +#: map kitty_mod+space no_op + +#: If you would like kitty to completely ignore a key event, not even +#: sending it to the program running in the terminal, map it to +#: discard_event:: + +#: map kitty_mod+f1 discard_event + +#: You can combine multiple actions to be triggered by a single +#: shortcut with combine action, using the syntax below:: + +#: map key combine action1 action2 action3 ... + +#: For example:: + +#: map kitty_mod+e combine : new_window : next_layout + +#: This will create a new window and switch to the next available +#: layout. + +#: You can use multi-key shortcuts with the syntax shown below:: + +#: map key1>key2>key3 action + +#: For example:: + +#: map ctrl+f>2 set_font_size 20 + +#: The full list of actions that can be mapped to key presses is +#: available here . + +kitty_mod ctrl+shift + +#: Special modifier key alias for default shortcuts. You can change +#: the value of this option to alter all default shortcuts that use +#: kitty_mod. + +clear_all_shortcuts no + +#: Remove all shortcut definitions up to this point. Useful, for +#: instance, to remove the default shortcuts. + +# action_alias + +#: E.g. action_alias launch_tab launch --type=tab --cwd=current + +#: Define action aliases to avoid repeating the same options in +#: multiple mappings. Aliases can be defined for any action and will +#: be expanded recursively. For example, the above alias allows you to +#: create mappings to launch a new tab in the current working +#: directory without duplication:: + +#: map f1 launch_tab vim +#: map f2 launch_tab emacs + +#: Similarly, to alias kitten invocation:: + +#: action_alias hints kitten hints --hints-offset=0 + +# kitten_alias + +#: E.g. kitten_alias hints hints --hints-offset=0 + +#: Like action_alias above, but specifically for kittens. Generally, +#: prefer to use action_alias. This option is a legacy version, +#: present for backwards compatibility. It causes all invocations of +#: the aliased kitten to be substituted. So the example above will +#: cause all invocations of the hints kitten to have the --hints- +#: offset=0 option applied. + +#: Clipboard {{{ + +#: Copy to clipboard + +map kitty_mod+c copy_to_clipboard +map cmd+c copy_to_clipboard + +#:: There is also a copy_or_interrupt action that can be optionally +#:: mapped to Ctrl+C. It will copy only if there is a selection and +#:: send an interrupt otherwise. Similarly, +#:: copy_and_clear_or_interrupt will copy and clear the selection or +#:: send an interrupt if there is no selection. + +#: Paste from clipboard + +map kitty_mod+v paste_from_clipboard +map cmd+v paste_from_clipboard + +#: Paste from selection + +map kitty_mod+s paste_from_selection +map shift+insert paste_from_selection + +#: Pass selection to program + +map kitty_mod+o pass_selection_to_program + +#:: You can also pass the contents of the current selection to any +#:: program with pass_selection_to_program. By default, the system's +#:: open program is used, but you can specify your own, the selection +#:: will be passed as a command line argument to the program. For +#:: example:: + +#:: map kitty_mod+o pass_selection_to_program firefox + +#:: You can pass the current selection to a terminal program running +#:: in a new kitty window, by using the @selection placeholder:: + +#:: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +#: Scroll line up + +map kitty_mod+up scroll_line_up +map kitty_mod+k scroll_line_up +map opt+cmd+page_up scroll_line_up +map cmd+up scroll_line_up + +#: Scroll line down + +map kitty_mod+down scroll_line_down +map kitty_mod+j scroll_line_down +map opt+cmd+page_down scroll_line_down +map cmd+down scroll_line_down + +#: Scroll page up + +map kitty_mod+page_up scroll_page_up +map cmd+page_up scroll_page_up + +#: Scroll page down + +map kitty_mod+page_down scroll_page_down +map cmd+page_down scroll_page_down + +#: Scroll to top + +map kitty_mod+home scroll_home +map cmd+home scroll_home + +#: Scroll to bottom + +map kitty_mod+end scroll_end +map cmd+end scroll_end + +#: Scroll to previous shell prompt + +map kitty_mod+z scroll_to_prompt -1 + +#:: Use a parameter of 0 for scroll_to_prompt to scroll to the last +#:: jumped to or the last clicked position. Requires shell +#:: integration +#:: to work. + +#: Scroll to next shell prompt + +map kitty_mod+x scroll_to_prompt 1 + +#: Browse scrollback buffer in pager + +map kitty_mod+h show_scrollback + +#:: You can pipe the contents of the current screen and history +#:: buffer as STDIN to an arbitrary program using launch --stdin- +#:: source. For example, the following opens the scrollback buffer in +#:: less in an overlay window:: + +#:: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R + +#:: For more details on piping screen and buffer contents to external +#:: programs, see launch . + +#: Browse output of the last shell command in pager + +map kitty_mod+g show_last_command_output + +#:: You can also define additional shortcuts to get the command +#:: output. For example, to get the first command output on screen:: + +#:: map f1 show_first_command_output_on_screen + +#:: To get the command output that was last accessed by a keyboard +#:: action or mouse action:: + +#:: map f1 show_last_visited_command_output + +#:: You can pipe the output of the last command run in the shell +#:: using the launch action. For example, the following opens the +#:: output in less in an overlay window:: + +#:: map f1 launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay less +G -R + +#:: To get the output of the first command on the screen, use +#:: @first_cmd_output_on_screen. To get the output of the last jumped +#:: to command, use @last_visited_cmd_output. + +#:: Requires shell integration +#:: to work. + +#: }}} + +#: Window management {{{ + +#: New window + +map kitty_mod+enter new_window +map cmd+enter new_window + +#:: You can open a new kitty window running an arbitrary program, for +#:: example:: + +#:: map kitty_mod+y launch mutt + +#:: You can open a new window with the current working directory set +#:: to the working directory of the current window using:: + +#:: map ctrl+alt+enter launch --cwd=current + +#:: You can open a new window that is allowed to control kitty via +#:: the kitty remote control facility with launch --allow-remote- +#:: control. Any programs running in that window will be allowed to +#:: control kitty. For example:: + +#:: map ctrl+enter launch --allow-remote-control some_program + +#:: You can open a new window next to the currently active window or +#:: as the first window, with:: + +#:: map ctrl+n launch --location=neighbor +#:: map ctrl+f launch --location=first + +#:: For more details, see launch +#:: . + +#: New OS window + +map kitty_mod+n new_os_window +map cmd+n new_os_window + +#:: Works like new_window above, except that it opens a top-level OS +#:: window. In particular you can use new_os_window_with_cwd to open +#:: a window with the current working directory. + +#: Close window + +map kitty_mod+w close_window +map shift+cmd+d close_window + +#: Next window + +map kitty_mod+] next_window + +#: Previous window + +map kitty_mod+[ previous_window + +#: Move window forward + +map kitty_mod+f move_window_forward + +#: Move window backward + +map kitty_mod+b move_window_backward + +#: Move window to top + +map kitty_mod+` move_window_to_top + +#: Start resizing window + +map kitty_mod+r start_resizing_window +map cmd+r start_resizing_window + +#: First window + +map kitty_mod+1 first_window +map cmd+1 first_window + +#: Second window + +map kitty_mod+2 second_window +map cmd+2 second_window + +#: Third window + +map kitty_mod+3 third_window +map cmd+3 third_window + +#: Fourth window + +map kitty_mod+4 fourth_window +map cmd+4 fourth_window + +#: Fifth window + +map kitty_mod+5 fifth_window +map cmd+5 fifth_window + +#: Sixth window + +map kitty_mod+6 sixth_window +map cmd+6 sixth_window + +#: Seventh window + +map kitty_mod+7 seventh_window +map cmd+7 seventh_window + +#: Eight window + +map kitty_mod+8 eighth_window +map cmd+8 eighth_window + +#: Ninth window + +map kitty_mod+9 ninth_window +map cmd+9 ninth_window + +#: Tenth window + +map kitty_mod+0 tenth_window + +#: Visually select and focus window + +map kitty_mod+f7 focus_visible_window + +#:: Display overlay numbers and alphabets on the window, and switch +#:: the focus to the window when you press the key. When there are +#:: only two windows, the focus will be switched directly without +#:: displaying the overlay. You can change the overlay characters and +#:: their order with option visual_window_select_characters. + +#: Visually swap window with another + +map kitty_mod+f8 swap_with_window + +#:: Works like focus_visible_window above, but swaps the window. + +#: }}} + +#: Tab management {{{ + +#: Next tab + +map kitty_mod+right next_tab +map shift+cmd+] next_tab +map ctrl+tab next_tab + +#: Previous tab + +map kitty_mod+left previous_tab +map shift+cmd+[ previous_tab +map ctrl+shift+tab previous_tab + +#: New tab + +map kitty_mod+t new_tab +map cmd+t new_tab + +#: Close tab + +map kitty_mod+q close_tab +map cmd+w close_tab + +#: Close OS window + +map shift+cmd+w close_os_window + +#: Move tab forward + +map kitty_mod+. move_tab_forward + +#: Move tab backward + +map kitty_mod+, move_tab_backward + +#: Set tab title + +map kitty_mod+alt+t set_tab_title +map shift+cmd+i set_tab_title + + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab, 2 the second tab and -1 being the previously active +#: tab, and any number larger than the last tab being the last tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and new_tab_with_cwd. +#: Finally, if you want the new tab to open next to the current tab +#: rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +#: Next layout + +map kitty_mod+l next_layout + + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout + +#: There is also a toggle_layout action that switches to the named +#: layout or back to the previous layout if in the named layout. +#: Useful to temporarily "zoom" the active window by switching to the +#: stack layout:: + +#: map ctrl+alt+z toggle_layout stack +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty OS windows at +#: a time or only the current one. + +#: Increase font size + +map kitty_mod+equal change_font_size all +2.0 +map kitty_mod+plus change_font_size all +2.0 +map kitty_mod+kp_add change_font_size all +2.0 +map cmd+plus change_font_size all +2.0 +map cmd+equal change_font_size all +2.0 +map shift+cmd+equal change_font_size all +2.0 + +#: Decrease font size + +map kitty_mod+minus change_font_size all -2.0 +map kitty_mod+kp_subtract change_font_size all -2.0 +map cmd+minus change_font_size all -2.0 +map shift+cmd+minus change_font_size all -2.0 + +#: Reset font size + +map kitty_mod+backspace change_font_size all 0 +map cmd+0 change_font_size all 0 + + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current OS window's font +#: size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +#: Open URL + +map kitty_mod+e open_url_with_hints + +#:: Open a currently visible URL using the keyboard. The program used +#:: to open the URL is specified in open_url_with. + +#: Insert selected path + +map kitty_mod+p>f kitten hints --type path --program - + +#:: Select a path/filename and insert it into the terminal. Useful, +#:: for instance to run git commands on a filename output from a +#:: previous git command. + +#: Open selected path + +map kitty_mod+p>shift+f kitten hints --type path + +#:: Select a path/filename and open it with the default open program. + +#: Insert selected line + +map kitty_mod+p>l kitten hints --type line --program - + +#:: Select a line of text and insert it into the terminal. Useful for +#:: the output of things like: `ls -1`. + +#: Insert selected word + +map kitty_mod+p>w kitten hints --type word --program - + +#:: Select words and insert into terminal. + +#: Insert selected hash + +map kitty_mod+p>h kitten hints --type hash --program - + +#:: Select something that looks like a hash and insert it into the +#:: terminal. Useful with git, which uses SHA1 hashes to identify +#:: commits. + +#: Open the selected file at the selected line + +map kitty_mod+p>n kitten hints --type linenum + +#:: Select something that looks like filename:linenum and open it in +#:: vim at the specified line number. + +#: Open the selected hyperlink + +map kitty_mod+p>y kitten hints --type hyperlink + +#:: Select a hyperlink (i.e. a URL that has been marked as such by +#:: the terminal program, for example, by `ls --hyperlink=auto`). + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see hints kitten +#: . +#: }}} + +#: Miscellaneous {{{ + +#: Toggle fullscreen + +map kitty_mod+f11 toggle_fullscreen +map ctrl+cmd+f toggle_fullscreen + +#: Toggle maximized + +map kitty_mod+f10 toggle_maximized + +#: Toggle macOS secure keyboard entry + +map opt+cmd+s toggle_macos_secure_keyboard_entry + +#: Unicode input + +map kitty_mod+u kitten unicode_input +map ctrl+cmd+space kitten unicode_input + +#: Edit config file + +map kitty_mod+f2 edit_config_file +map cmd+, edit_config_file + +#: Open the kitty command shell + +map kitty_mod+escape kitty_shell window + +#:: Open the kitty shell in a new window / tab / overlay / os_window +#:: to control kitty using commands. + +#: Increase background opacity + +map kitty_mod+a>m set_background_opacity +0.1 + +#: Decrease background opacity + +map kitty_mod+a>l set_background_opacity -0.1 + +#: Make background fully opaque + +map kitty_mod+a>1 set_background_opacity 1 + +#: Reset background opacity + +map kitty_mod+a>d set_background_opacity default + +#: Reset the terminal + +map kitty_mod+delete clear_terminal reset active +map opt+cmd+r clear_terminal reset active + +#:: You can create shortcuts to clear/reset the terminal. For +#:: example:: + +#:: # Reset the terminal +#:: map f1 clear_terminal reset active +#:: # Clear the terminal screen by erasing all contents +#:: map f1 clear_terminal clear active +#:: # Clear the terminal scrollback by erasing it +#:: map f1 clear_terminal scrollback active +#:: # Scroll the contents of the screen into the scrollback +#:: map f1 clear_terminal scroll active +#:: # Clear everything up to the line with the cursor +#:: map f1 clear_terminal to_cursor active + +#:: If you want to operate on all kitty windows instead of just the +#:: current one, use all instead of active. + +#:: It is also possible to remap Ctrl+L to both scroll the current +#:: screen contents into the scrollback buffer and clear the screen, +#:: instead of just clearing the screen, for example, for ZSH add the +#:: following to ~/.zshrc: + +#:: .. code-block:: zsh + +#:: scroll-and-clear-screen() { +#:: printf '\n%.0s' {1..$LINES} +#:: zle clear-screen +#:: } +#:: zle -N scroll-and-clear-screen +#:: bindkey '^l' scroll-and-clear-screen + +#: Clear up to cursor line + +map cmd+k clear_terminal to_cursor active + +#: Reload kitty.conf + +map kitty_mod+f5 load_config_file +map ctrl+cmd+, load_config_file + +#:: Reload kitty.conf, applying any changes since the last time it +#:: was loaded. Note that a handful of options cannot be dynamically +#:: changed and require a full restart of kitty. Particularly, when +#:: changing shortcuts for actions located on the macOS global menu +#:: bar, a full restart is needed. You can also map a keybinding to +#:: load a different config file, for example:: + +#:: map f5 load_config /path/to/alternative/kitty.conf + +#:: Note that all options from the original kitty.conf are discarded, +#:: in other words the new configuration *replace* the old ones. + +#: Debug kitty configuration + +map kitty_mod+f6 debug_config +map opt+cmd+, debug_config + +#:: Show details about exactly what configuration kitty is running +#:: with and its host environment. Useful for debugging issues. + +#: Send arbitrary text on key presses + +#:: E.g. map ctrl+shift+alt+h send_text all Hello World + +#:: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#:: client program when pressing specified shortcut keys. For +#:: example:: + +#:: map ctrl+alt+a send_text all Special text + +#:: This will send "Special text" when you press the Ctrl+Alt+A key +#:: combination. The text to be sent is a python string literal so +#:: you can use escapes like \x1b to send control codes or \u21fb to +#:: send Unicode characters (or you can just input the Unicode +#:: characters directly as UTF-8 text). You can use `kitty +kitten +#:: show_key` to get the key escape codes you want to emulate. + +#:: The first argument to send_text is the keyboard modes in which to +#:: activate the shortcut. The possible values are normal, +#:: application, kitty or a comma separated combination of them. The +#:: modes normal and application refer to the DECCKM cursor key mode +#:: for terminals, and kitty refers to the kitty extended keyboard +#:: protocol. The special value all means all of them. + +#:: Some more examples:: + +#:: # Output a word and move the cursor to the start of the line (like typing and pressing Home) +#:: map ctrl+alt+a send_text normal Word\x1b[H +#:: map ctrl+alt+a send_text application Word\x1bOH +#:: # Run a command at a shell prompt (like typing the command and pressing Enter) +#:: map ctrl+alt+a send_text normal,application some command with arguments\r + +#: Open kitty Website + +map shift+cmd+/ open_url https://sw.kovidgoyal.net/kitty/ + +#: }}} + +#: }}} + diff --git a/config/extra/kitty/nord.conf b/config/extra/kitty/nord.conf new file mode 100644 index 0000000..54f3a96 --- /dev/null +++ b/config/extra/kitty/nord.conf @@ -0,0 +1,43 @@ +# Nord Colorscheme for Kitty +# Based on: +# - https://gist.github.com/marcusramberg/64010234c95a93d953e8c79fdaf94192 +# - https://github.com/arcticicestudio/nord-hyper + +foreground #D8DEE9 +background #2E3440 +selection_foreground #000000 +selection_background #FFFACD +url_color #0087BD +cursor #81A1C1 + +# black +color0 #3B4252 +color8 #4C566A + +# red +color1 #BF616A +color9 #BF616A + +# green +color2 #A3BE8C +color10 #A3BE8C + +# yellow +color3 #EBCB8B +color11 #EBCB8B + +# blue +color4 #81A1C1 +color12 #81A1C1 + +# magenta +color5 #B48EAD +color13 #B48EAD + +# cyan +color6 #88C0D0 +color14 #8FBCBB + +# white +color7 #E5E9F0 +color15 #ECEFF4 diff --git a/config/extra/ktouch2rc b/config/extra/ktouch2rc new file mode 100644 index 0000000..b483696 --- /dev/null +++ b/config/extra/ktouch2rc @@ -0,0 +1,5 @@ +[Session] +LastUsedProfileId=1 + +[Training] +ShowKeyboard=false diff --git a/config/extra/mutt/configs/raymaekers.luca@gmail.com b/config/extra/mutt/configs/raymaekers.luca@gmail.com new file mode 100644 index 0000000..5dded3d --- /dev/null +++ b/config/extra/mutt/configs/raymaekers.luca@gmail.com @@ -0,0 +1,18 @@ +set from = "raymaekers.luca@gmail.com" +set realname = "Raymaekers Luca" +set my_pass = "`pass tokens/raymaekers.luca@gmail.com`" + +# IMAP settings +set imap_user = "raymaekers.luca@gmail.com" +set imap_pass = $my_pass + +# SMTP settings +set smtp_url = "smtps://raymaekers.luca@smtp.gmail.com" +set smtp_pass = $my_pass + +# Remote Gmail folders +set folder = "imaps://imap.gmail.com/" +set spoolfile = "+INBOX" +set postponed = "+[Gmail]/Drafts" +set record = "+[Gmail]/Sent Mail" +set trash = "+[Gmail]/Trash" diff --git a/config/extra/mutt/configs/tlast723@gmail.com b/config/extra/mutt/configs/tlast723@gmail.com new file mode 100644 index 0000000..d646673 --- /dev/null +++ b/config/extra/mutt/configs/tlast723@gmail.com @@ -0,0 +1,18 @@ +set from = "tlast723@gmail.com" +set realname = "Raymaekers Luca" +set my_pass = "`pass tokens/tlast723@gmail.com`" + +# IMAP settings +set imap_user = "tlast723@gmail.com" +set imap_pass = $my_pass + +# SMTP settings +set smtp_url = "smtps://tlast723@smtp.gmail.com" +set smtp_pass = $my_pass + +# Remote Gmail folders +set folder = "imaps://imap.gmail.com/" +set spoolfile = "+INBOX" +set postponed = "+[Gmail]/Drafts" +set record = "+[Gmail]/Sent Mail" +set trash = "+[Gmail]/Trash" diff --git a/config/extra/mutt/configs/tlast@murena.io b/config/extra/mutt/configs/tlast@murena.io new file mode 100644 index 0000000..1f59296 --- /dev/null +++ b/config/extra/mutt/configs/tlast@murena.io @@ -0,0 +1,11 @@ +set my_user = "tlast@murena.io" +set my_pass = "`pass tokens/tlast@murena.io`" + +set smtp_url = "smtp://$my_user:$my_pass@mail.ecloud.global:587/" +set imap_user = $my_user +set imap_pass = $my_pass +set folder = "imaps://mail.ecloud.global:993" +set smtp_authenticators = "login" +set ssl_starttls=yes +set ssl_force_tls=yes +set spoolfile = "+INBOX" diff --git a/config/extra/neofetch/config.conf b/config/extra/neofetch/config.conf new file mode 100644 index 0000000..20856a8 --- /dev/null +++ b/config/extra/neofetch/config.conf @@ -0,0 +1,864 @@ +# See this wiki page for more info: +# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info +print_info() { + info title + info underline + + info "OS" distro + info "Host" model + info "Kernel" kernel + info "Uptime" uptime + info "Packages" packages + info "Shell" shell + info "Resolution" resolution + info "DE" de + info "WM" wm + info "WM Theme" wm_theme + # info "Theme" theme + # info "Icons" icons + info "Terminal" term + info "Terminal Font" term_font + info "CPU" cpu + info "GPU" gpu + info "Memory" memory + + # info "GPU Driver" gpu_driver # Linux/macOS only + # info "CPU Usage" cpu_usage + # info "Disk" disk + # info "Battery" battery + # info "Font" font + # info "Song" song + # [[ "$player" ]] && prin "Music Player" "$player" + # info "Local IP" local_ip + # info "Public IP" public_ip + # info "Users" users + # info "Locale" locale # This only works on glibc systems. + + info cols +} + +# Title + + +# Hide/Show Fully qualified domain name. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --title_fqdn +title_fqdn="off" + + +# Kernel + + +# Shorten the output of the kernel function. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --kernel_shorthand +# Supports: Everything except *BSDs (except PacBSD and PC-BSD) +# +# Example: +# on: '4.8.9-1-ARCH' +# off: 'Linux 4.8.9-1-ARCH' +kernel_shorthand="on" + + +# Distro + + +# Shorten the output of the distro function +# +# Default: 'off' +# Values: 'on', 'tiny', 'off' +# Flag: --distro_shorthand +# Supports: Everything except Windows and Haiku +distro_shorthand="off" + +# Show/Hide OS Architecture. +# Show 'x86_64', 'x86' and etc in 'Distro:' output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --os_arch +# +# Example: +# on: 'Arch Linux x86_64' +# off: 'Arch Linux' +os_arch="on" + + +# Uptime + + +# Shorten the output of the uptime function +# +# Default: 'on' +# Values: 'on', 'tiny', 'off' +# Flag: --uptime_shorthand +# +# Example: +# on: '2 days, 10 hours, 3 mins' +# tiny: '2d 10h 3m' +# off: '2 days, 10 hours, 3 minutes' +uptime_shorthand="on" + + +# Memory + + +# Show memory pecentage in output. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --memory_percent +# +# Example: +# on: '1801MiB / 7881MiB (22%)' +# off: '1801MiB / 7881MiB' +memory_percent="off" + +# Change memory output unit. +# +# Default: 'mib' +# Values: 'kib', 'mib', 'gib' +# Flag: --memory_unit +# +# Example: +# kib '1020928KiB / 7117824KiB' +# mib '1042MiB / 6951MiB' +# gib: ' 0.98GiB / 6.79GiB' +memory_unit="mib" + + +# Packages + + +# Show/Hide Package Manager names. +# +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' +# Flag: --package_managers +# +# Example: +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="on" + + +# Shell + + +# Show the path to $SHELL +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --shell_path +# +# Example: +# on: '/bin/bash' +# off: 'bash' +shell_path="off" + +# Show $SHELL version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --shell_version +# +# Example: +# on: 'bash 4.4.5' +# off: 'bash' +shell_version="on" + + +# CPU + + +# CPU speed type +# +# Default: 'bios_limit' +# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. +# Flag: --speed_type +# Supports: Linux with 'cpufreq' +# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. +speed_type="bios_limit" + +# CPU speed shorthand +# +# Default: 'off' +# Values: 'on', 'off'. +# Flag: --speed_shorthand +# NOTE: This flag is not supported in systems with CPU speed less than 1 GHz +# +# Example: +# on: 'i7-6500U (4) @ 3.1GHz' +# off: 'i7-6500U (4) @ 3.100GHz' +speed_shorthand="off" + +# Enable/Disable CPU brand in output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_brand +# +# Example: +# on: 'Intel i7-6500U' +# off: 'i7-6500U (4)' +cpu_brand="on" + +# CPU Speed +# Hide/Show CPU speed. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_speed +# +# Example: +# on: 'Intel i7-6500U (4) @ 3.1GHz' +# off: 'Intel i7-6500U (4)' +cpu_speed="on" + +# CPU Cores +# Display CPU cores in output +# +# Default: 'logical' +# Values: 'logical', 'physical', 'off' +# Flag: --cpu_cores +# Support: 'physical' doesn't work on BSD. +# +# Example: +# logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) +# physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) +# off: 'Intel i7-6500U @ 3.1GHz' +cpu_cores="logical" + +# CPU Temperature +# Hide/Show CPU temperature. +# Note the temperature is added to the regular CPU function. +# +# Default: 'off' +# Values: 'C', 'F', 'off' +# Flag: --cpu_temp +# Supports: Linux, BSD +# NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable +# coretemp kernel module. This only supports newer Intel processors. +# +# Example: +# C: 'Intel i7-6500U (4) @ 3.1GHz [27.2ยฐC]' +# F: 'Intel i7-6500U (4) @ 3.1GHz [82.0ยฐF]' +# off: 'Intel i7-6500U (4) @ 3.1GHz' +cpu_temp="off" + + +# GPU + + +# Enable/Disable GPU Brand +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gpu_brand +# +# Example: +# on: 'AMD HD 7950' +# off: 'HD 7950' +gpu_brand="on" + +# Which GPU to display +# +# Default: 'all' +# Values: 'all', 'dedicated', 'integrated' +# Flag: --gpu_type +# Supports: Linux +# +# Example: +# all: +# GPU1: AMD HD 7950 +# GPU2: Intel Integrated Graphics +# +# dedicated: +# GPU1: AMD HD 7950 +# +# integrated: +# GPU1: Intel Integrated Graphics +gpu_type="all" + + +# Resolution + + +# Display refresh rate next to each monitor +# Default: 'off' +# Values: 'on', 'off' +# Flag: --refresh_rate +# Supports: Doesn't work on Windows. +# +# Example: +# on: '1920x1080 @ 60Hz' +# off: '1920x1080' +refresh_rate="off" + + +# Gtk Theme / Icons / Font + + +# Shorten output of GTK Theme / Icons / Font +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --gtk_shorthand +# +# Example: +# on: 'Numix, Adwaita' +# off: 'Numix [GTK2], Adwaita [GTK3]' +gtk_shorthand="off" + + +# Enable/Disable gtk2 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk2 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Adwaita [GTK3]' +gtk2="on" + +# Enable/Disable gtk3 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk3 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Numix [GTK2]' +gtk3="on" + + +# IP Address + + +# Website to ping for the public IP +# +# Default: 'http://ident.me' +# Values: 'url' +# Flag: --ip_host +public_ip_host="http://ident.me" + +# Public IP timeout. +# +# Default: '2' +# Values: 'int' +# Flag: --ip_timeout +public_ip_timeout=2 + + +# Desktop Environment + + +# Show Desktop Environment version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --de_version +de_version="on" + + +# Disk + + +# Which disks to display. +# The values can be any /dev/sdXX, mount point or directory. +# NOTE: By default we only show the disk info for '/'. +# +# Default: '/' +# Values: '/', '/dev/sdXX', '/path/to/drive'. +# Flag: --disk_show +# +# Example: +# disk_show=('/' '/dev/sdb1'): +# 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 823G / 893G (93%)' +# +# disk_show=('/'): +# 'Disk (/): 74G / 118G (66%)' +# +disk_show=('/') + +# Disk subtitle. +# What to append to the Disk subtitle. +# +# Default: 'mount' +# Values: 'mount', 'name', 'dir', 'none' +# Flag: --disk_subtitle +# +# Example: +# name: 'Disk (/dev/sda1): 74G / 118G (66%)' +# 'Disk (/dev/sdb2): 74G / 118G (66%)' +# +# mount: 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Local Disk): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 74G / 118G (66%)' +# +# dir: 'Disk (/): 74G / 118G (66%)' +# 'Disk (Local Disk): 74G / 118G (66%)' +# 'Disk (Videos): 74G / 118G (66%)' +# +# none: 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +disk_subtitle="mount" + +# Disk percent. +# Show/Hide disk percent. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --disk_percent +# +# Example: +# on: 'Disk (/): 74G / 118G (66%)' +# off: 'Disk (/): 74G / 118G' +disk_percent="on" + + +# Song + + +# Manually specify a music player. +# +# Default: 'auto' +# Values: 'auto', 'player-name' +# Flag: --music_player +# +# Available values for 'player-name': +# +# amarok +# audacious +# banshee +# bluemindo +# clementine +# cmus +# deadbeef +# deepin-music +# dragon +# elisa +# exaile +# gnome-music +# gmusicbrowser +# gogglesmm +# guayadeque +# io.elementary.music +# iTunes +# juk +# lollypop +# mocp +# mopidy +# mpd +# muine +# netease-cloud-music +# olivia +# playerctl +# pogo +# pragha +# qmmp +# quodlibet +# rhythmbox +# sayonara +# smplayer +# spotify +# strawberry +# tauonmb +# tomahawk +# vlc +# xmms2d +# xnoise +# yarock +music_player="auto" + +# Format to display song information. +# +# Default: '%artist% - %album% - %title%' +# Values: '%artist%', '%album%', '%title%' +# Flag: --song_format +# +# Example: +# default: 'Song: Jet - Get Born - Sgt Major' +song_format="%artist% - %album% - %title%" + +# Print the Artist, Album and Title on separate lines +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --song_shorthand +# +# Example: +# on: 'Artist: The Fratellis' +# 'Album: Costello Music' +# 'Song: Chelsea Dagger' +# +# off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' +song_shorthand="off" + +# 'mpc' arguments (specify a host, password etc). +# +# Default: '' +# Example: mpc_args=(-h HOST -P PASSWORD) +mpc_args=() + + +# Text Colors + + +# Text Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --colors +# +# Each number represents a different part of the text in +# this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' +# +# Example: +# colors=(distro) - Text is colored based on Distro colors. +# colors=(4 6 1 8 8 6) - Text is colored in the order above. +colors=(distro) + + +# Text Options + + +# Toggle bold text +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bold +bold="on" + +# Enable/Disable Underline +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --underline +underline_enabled="on" + +# Underline character +# +# Default: '-' +# Values: 'string' +# Flag: --underline_char +underline_char="-" + + +# Info Separator +# Replace the default separator with the specified string. +# +# Default: ':' +# Flag: --separator +# +# Example: +# separator="->": 'Shell-> bash' +# separator=" =": 'WM = dwm' +separator=":" + + +# Color Blocks + + +# Color block range +# The range of colors to print. +# +# Default: '0', '15' +# Values: 'num' +# Flag: --block_range +# +# Example: +# +# Display colors 0-7 in the blocks. (8 colors) +# neofetch --block_range 0 7 +# +# Display colors 0-15 in the blocks. (16 colors) +# neofetch --block_range 0 15 +block_range=(0 15) + +# Toggle color blocks +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --color_blocks +color_blocks="on" + +# Color block width in spaces +# +# Default: '3' +# Values: 'num' +# Flag: --block_width +block_width=3 + +# Color block height in lines +# +# Default: '1' +# Values: 'num' +# Flag: --block_height +block_height=1 + +# Color Alignment +# +# Default: 'auto' +# Values: 'auto', 'num' +# Flag: --col_offset +# +# Number specifies how far from the left side of the terminal (in spaces) to +# begin printing the columns, in case you want to e.g. center them under your +# text. +# Example: +# col_offset="auto" - Default behavior of neofetch +# col_offset=7 - Leave 7 spaces then print the colors +col_offset="auto" + +# Progress Bars + + +# Bar characters +# +# Default: '-', '=' +# Values: 'string', 'string' +# Flag: --bar_char +# +# Example: +# neofetch --bar_char 'elapsed' 'total' +# neofetch --bar_char '-' '=' +bar_char_elapsed="-" +bar_char_total="=" + +# Toggle Bar border +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bar_border +bar_border="on" + +# Progress bar length in spaces +# Number of chars long to make the progress bars. +# +# Default: '15' +# Values: 'num' +# Flag: --bar_length +bar_length=15 + +# Progress bar colors +# When set to distro, uses your distro's logo colors. +# +# Default: 'distro', 'distro' +# Values: 'distro', 'num' +# Flag: --bar_colors +# +# Example: +# neofetch --bar_colors 3 4 +# neofetch --bar_colors distro 5 +bar_color_elapsed="distro" +bar_color_total="distro" + + +# Info display +# Display a bar with the info. +# +# Default: 'off' +# Values: 'bar', 'infobar', 'barinfo', 'off' +# Flags: --cpu_display +# --memory_display +# --battery_display +# --disk_display +# +# Example: +# bar: '[---=======]' +# infobar: 'info [---=======]' +# barinfo: '[---=======] info' +# off: 'info' +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" + + +# Backend Settings + + +# Image backend. +# +# Default: 'ascii' +# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', +# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' +# Flag: --backend +image_backend="ascii" + +# Image Source +# +# Which image or ascii file to display. +# +# Default: 'auto' +# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' +# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' +# Flag: --source +# +# NOTE: 'auto' will pick the best image source for whatever image backend is used. +# In ascii mode, distro ascii art will be used and in an image mode, your +# wallpaper will be used. +image_source="auto" + + +# Ascii Options + + +# Ascii distro +# Which distro's ascii art to display. +# +# Default: 'auto' +# Values: 'auto', 'distro_name' +# Flag: --ascii_distro +# NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", +# "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, +# ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, +# Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, +# BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, +# Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, +# Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, +# DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, +# EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, +# FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, +# gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, +# Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, +# Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, +# LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, +# Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, +# Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, +# NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, +# OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, +# Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, +# popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, +# Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, +# Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, +# Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, +# SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, +# openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, +# Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, +# Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, +# and IRIX have ascii logos +# NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. +# Use '{distro name}_old' to use the old logos. +# NOTE: Ubuntu has flavor variants. +# Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, +# Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. +# NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, +# CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, +# Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, +# Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, +# Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, +# postmarketOS, and Void have a smaller logo variant. +# Use '{distro name}_small' to use the small variants. +ascii_distro="auto" + +# Ascii Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --ascii_colors +# +# Example: +# ascii_colors=(distro) - Ascii is colored based on Distro colors. +# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. +ascii_colors=(distro) + +# Bold ascii logo +# Whether or not to bold the ascii logo. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --ascii_bold +ascii_bold="on" + + +# Image Options + + +# Image loop +# Setting this to on will make neofetch redraw the image constantly until +# Ctrl+C is pressed. This fixes display issues in some terminal emulators. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --loop +image_loop="off" + +# Thumbnail directory +# +# Default: '~/.cache/thumbnails/neofetch' +# Values: 'dir' +thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" + +# Crop mode +# +# Default: 'normal' +# Values: 'normal', 'fit', 'fill' +# Flag: --crop_mode +# +# See this wiki page to learn about the fit and fill options. +# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F +crop_mode="normal" + +# Crop offset +# Note: Only affects 'normal' crop mode. +# +# Default: 'center' +# Values: 'northwest', 'north', 'northeast', 'west', 'center' +# 'east', 'southwest', 'south', 'southeast' +# Flag: --crop_offset +crop_offset="center" + +# Image size +# The image is half the terminal width by default. +# +# Default: 'auto' +# Values: 'auto', '00px', '00%', 'none' +# Flags: --image_size +# --size +image_size="auto" + +# Gap between image and text +# +# Default: '3' +# Values: 'num', '-num' +# Flag: --gap +gap=3 + +# Image offsets +# Only works with the w3m backend. +# +# Default: '0' +# Values: 'px' +# Flags: --xoffset +# --yoffset +yoffset=0 +xoffset=0 + +# Image background color +# Only works with the w3m backend. +# +# Default: '' +# Values: 'color', 'blue' +# Flag: --bg_color +background_color= + + +# Misc Options + +# Stdout mode +# Turn off all colors and disables image backend (ASCII/Image). +# Useful for piping into another command. +# Default: 'off' +# Values: 'on', 'off' +stdout="off" diff --git a/config/extra/pikaur.conf b/config/extra/pikaur.conf new file mode 100644 index 0000000..3dad848 --- /dev/null +++ b/config/extra/pikaur.conf @@ -0,0 +1,50 @@ +[sync] +alwaysshowpkgorigin = no +develpkgsexpiration = -1 +upgradesorting = versiondiff +showdownloadsize = no +ignoreoutofdateaurupgrades = no + +[build] +keepbuilddir = no +keepdevbuilddir = yes +keepbuilddeps = no +gpgdir = +skipfailedbuild = no +alwaysusedynamicusers = no +ignorearch = no + +[review] +noedit = no +donteditbydefault = no +nodiff = no +gitdiffargs = --ignore-space-change,--ignore-all-space +diffpager = auto +hidedifffiles = .SRCINFO + +[colors] +version = 10 +versiondiffold = 11 +versiondiffnew = 9 + +[ui] +requireenterconfirm = yes +printcommands = no +aursearchsorting = hottest +displaylastupdated = no +groupbyrepository = yes +reversesearchsorting = no +warnaboutpackageupdates = + +[misc] +sudoloopinterval = 59 +pacmanpath = pacman +privilegeescalationtool = sudo + +[network] +aururl = https://aur.archlinux.org +newsurl = https://www.archlinux.org/feeds/news/ +socks5proxy = +aurhttpproxy = +aurhttpsproxy = + diff --git a/config/old/cmus/playlists/default b/config/old/cmus/playlists/default new file mode 100755 index 0000000..e69de29 diff --git a/config/old/cmus/rc b/config/old/cmus/rc new file mode 100755 index 0000000..b73000a --- /dev/null +++ b/config/old/cmus/rc @@ -0,0 +1,194 @@ +# colors from solarized: http://ethanschoonover.com/solarized +# default text color +set color_win_fg=default + +# overall background color +set color_win_bg=default + +# command-line colors +set color_cmdline_bg=default +set color_cmdline_fg=default +set color_error=160 +set color_info=136 +set color_separator=240 + +# bottom status line +set color_statusline_bg=0 +set color_statusline_fg=37 + +# bottom title line +set color_titleline_bg=0 +set color_titleline_fg=136 + +# top title area +set color_win_title_bg=0 +set color_win_title_fg=64 +##### playing file colors ###################################################### +# unselected currently playing track's text +set color_win_cur=33 + +# active selection for currently playing track +set color_win_cur_sel_bg=0 +set color_win_cur_sel_fg=33 + +# inactive selection for currently playing track +set color_win_inactive_cur_sel_bg=default +set color_win_inactive_cur_sel_fg=125 + +##### non-playing file colors ################################################## +# active selection +set color_win_sel_bg=0 +set color_win_sel_fg=166 + +# inactive selection +set color_win_inactive_sel_bg=default +set color_win_inactive_sel_fg=125 + +##### file browser view colors ################################################# +# directory listing color +set color_win_dir=33 + +##### KEYBINDINGS ################################################# + +# playback + +# bind common b player-next +# bind common c player-pause +# bind common x player-play +# bind common z player-prev +# bind common v player-stop +# +# bind common ] vol +0 +1% +# bind common [ vol +1% +0 +# bind common + vol +10% +# bind common = vol +10% +# bind common } vol -0 -1% +# bind common { vol -1% -0 +# bind common - vol -10% +# +bind -f common , seek -5 +bind -f common . seek +5 +bind -f common 0 vol +2% +bind -f common 9 vol -2% +# +# bind common h seek -5 +# bind common l seek +5 +# +# bind common left seek -5 +# bind common right seek +5 +# +# bind common mlb_click_bar player-pause +# bind common mouse_scroll_up_bar seek +5 +# bind common mouse_scroll_down_bar seek -5 +# +# # setting toggles +# +# bind common m toggle aaa_mode +# bind common c toggle continue +# bind common m toggle play_library +# bind common o toggle play_sorted +# bind common r toggle repeat +# bind common ^r toggle repeat_current +# bind common t toggle show_remaining_time +# bind common s toggle shuffle +# bind common f toggle follow + +# commands + +unbind common q +bind -f common q quit +# bind common ^c echo type :quit to exit cmus. +# bind common i echo {} +# +# # note: the single space at the end is intentional +# bind common ! push shell +# +# # view/window navigation +# +# bind common 1 view tree +# bind common 2 view sorted +# bind common 3 view playlist +# bind common 4 view queue +# bind common 5 view browser +# bind common 6 view filters +# bind common 7 view settings +# +# bind common mouse_scroll_up_title left-view +# bind common mouse_scroll_down_title right-view +# +# bind common tab win-next +# +# bind common ^l refresh +# +# # navigation +# +# bind common ^y win-scroll-up +# bind common ^e win-scroll-down +# bind common ^b win-page-up +# bind common ^f win-page-down +# bind common ^u win-half-page-up +# bind common ^d win-half-page-down +# +# bind common k win-up +# bind common j win-down +# bind common g win-top +# bind common g win-bottom +# +# bind common up win-up +# bind common down win-down +# bind common home win-top +# bind common end win-bottom +# bind common page_up win-page-up +# bind common page_down win-page-down +# +# bind common mouse_scroll_up win-up +# bind common mouse_scroll_down win-down +# +# # selection +# +# bind common i win-sel-cur +# bind common enter win-activate +# bind common mlb_click_selected win-activate +# +# bind common space win-toggle +# bind common d win-remove +# bind common delete win-remove +# bind common p win-mv-after +# bind common p win-mv-before +# +# bind common e win-add-q +# bind common a win-add-l +# bind common y win-add-p +# bind common e win-add-q +# +# bind common u update-cache +# bind common u win-update-cache +# +# # filters +# +# bind common / search-start +# bind common ? search-b-start +# bind common n search-next +# bind common n search-prev +# +# # note: the single space at the end is intentional +# bind common f push filter +# bind common l push live-filter + +fset 90s=date>=1990&date<2000 +fset classical=genre="classical" +fset unheard=play_count=0 +fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1) +fset mp3=filename="*.mp3" +fset ogg=filename="*.ogg" +fset ogg-or-mp3=ogg|mp3 + +# file browser +unbind common l +bind -f common l win-activate +unbind -f common h +bind -f browser h browser-up +# bind browser space win-activate +# bind browser i toggle show_hidden +# bind browser u win-update + diff --git a/config/old/code/Code b/config/old/code/Code new file mode 120000 index 0000000..dfb09b2 --- /dev/null +++ b/config/old/code/Code @@ -0,0 +1 @@ +Code - OSS \ No newline at end of file diff --git a/config/old/code/Code - OSS/User/keybindings.json b/config/old/code/Code - OSS/User/keybindings.json new file mode 100644 index 0000000..70c97d7 --- /dev/null +++ b/config/old/code/Code - OSS/User/keybindings.json @@ -0,0 +1,32 @@ +// Place your key bindings in this file to override the defaultsauto[] +[ + { + "key": "ctrl+j", + "command": "-workbench.action.togglePanel" + }, + { + "key": "ctrl+j", + "command": "-extension.vim_ctrl+j", + "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" + }, + { + "key": "ctrl+alt+j", + "command": "selectNextSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + }, + { + "key": "ctrl+down", + "command": "-selectNextSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + }, + { + "key": "ctrl+alt+k", + "command": "selectPrevSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + }, + { + "key": "ctrl+up", + "command": "-selectPrevSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + } +] diff --git a/config/old/code/Code - OSS/User/settings.json b/config/old/code/Code - OSS/User/settings.json new file mode 100644 index 0000000..42b715c --- /dev/null +++ b/config/old/code/Code - OSS/User/settings.json @@ -0,0 +1,21 @@ +{ + "workbench.colorTheme": "Default Dark+", + "terminal.integrated.fontFamily": "mononoki Nerd Font Mono", + "terminal.integrated.fontWeight": "bold", + "keyboard.dispatch": "keyCode", + "files.autoSave": "onFocusChange", + "vim.useSystemClipboard": true, + "editor.cursorBlinking": "solid", + "editor.lineNumbers": "relative", + "git.autorefresh": false, + "debug.onTaskErrors": "abort", + "editor.smoothScrolling": true, + "C_Cpp.intelliSenseEngine": "disabled", + "extensions.ignoreRecommendations": true, + "liveServer.settings.donotShowInfoMsg": true, + "window.menuBarVisibility": "toggle", + "explorer.confirmDelete": false, + "workbench.startupEditor": "none", + "git.confirmSync": false, + "liveServer.settings.NoBrowser": true +} diff --git a/config/old/qutebrowser/autoconfig.yml b/config/old/qutebrowser/autoconfig.yml new file mode 100644 index 0000000..443b1fa --- /dev/null +++ b/config/old/qutebrowser/autoconfig.yml @@ -0,0 +1,10 @@ +# If a config.py file exists, this file is ignored unless it's explicitly loaded +# via config.load_autoconfig(). For more information, see: +# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml +# DO NOT edit this file by hand, qutebrowser will overwrite it. +# Instead, create a config.py - see :help for details. + +config_version: 2 +settings: + colors.webpage.darkmode.enabled: + global: false diff --git a/config/old/qutebrowser/bookmarks/urls b/config/old/qutebrowser/bookmarks/urls new file mode 100644 index 0000000..e69de29 diff --git a/config/old/qutebrowser/quickmarks b/config/old/qutebrowser/quickmarks new file mode 100644 index 0000000..e69de29 diff --git a/config/old/spotifyd/spotifyd.conf b/config/old/spotifyd/spotifyd.conf new file mode 100644 index 0000000..cb80dca --- /dev/null +++ b/config/old/spotifyd/spotifyd.conf @@ -0,0 +1,13 @@ +[global] +username = "lordtlast" +device_name = "ArchiDesktop" +bitrate = 160 +cache_path = "/home/aluc/.cache/spotifyd" +max_cache_size = 1000000000 +no_audio_cache = false +initial_volume = "70" +volume_normalisation = true +normalisation_pregain = -10 +autoplay = true +zeroconf_port = 1234 +device_type = "computer" diff --git a/config/old/starship/starship.toml b/config/old/starship/starship.toml new file mode 100644 index 0000000..e70d49d --- /dev/null +++ b/config/old/starship/starship.toml @@ -0,0 +1,24 @@ +# Don't print a new line at the start of the prompt +add_newline = false + +# makes prompt a single line +[line_break] +disabled = true + +# Disable the package module, hiding it from the prompt completely +[package] +disabled = true + +[cmd_duration] +min_time = 10_000 # Show command duration over 10,000 milliseconds (= 10 sec) +format = "took [$duration]($style)" + +[character] +error_symbol = "[X](bold red) " + +# Clear visibility for exit codes +[status] +style = "red" +symbol = "๏‡ข " +format = '[\[$symbol$status\]]($style) ' +disabled = false diff --git a/config/old/tridactyl/tridactylrc b/config/old/tridactyl/tridactylrc new file mode 100644 index 0000000..d95acd0 --- /dev/null +++ b/config/old/tridactyl/tridactylrc @@ -0,0 +1,211 @@ +" General Settings +set update.lastchecktime 1674671186214 +set update.nag true +set update.nagwait 7 +set update.lastnaggedversion 1.14.0 +set update.checkintervalsecs 86400 +set configversion 2.0 +set newtab craftmenners.men +set searchengine duckduckgo +set searchurls.wi https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s +set searchurls.g https://www.google.com/search?q=%s +set searchurls.y https://www.youtube.com/results?search_query=%s +set searchurls.gm https://www.google.com/maps?q=%s +set searchurls.aw https://wiki.archlinux.org/title/%s +set searchurls.aur https://aur.archlinux.org/packages?O=0&K=%s +set searchurls.tw https://tweakers.net/zoeken/?keyword=%s +set searchurls.im https://www.imdb.com/find?q=%s +set searchurls.1x https://www.1377x.to/search/%s/1 +set searchurls.am https://www.amazon.com.be/s?k=%s +set searchurls.pyp https://pypi.org/search/?q=%s +set searchurls.mc https://minecraft.fandom.com/wiki/%s +set searchurls.mcf https://www.curseforge.com/minecraft/mc-mods/search?search=%s +set searchurls.mcm https://modrinth.com/mods?q=%s +set searchurls.dhu https://hub.docker.com/search?q=%s +set searchurls.plu https://app.pluralsight.com/search/?q=%s +set searchurls.google https://www.google.com/search?q= +set searchurls.googlelucky https://www.google.com/search?btnI=I'm+Feeling+Lucky&q= +set searchurls.scholar https://scholar.google.com/scholar?q= +set searchurls.googleuk https://www.google.co.uk/search?q= +set searchurls.bing https://www.bing.com/search?q= +set searchurls.duckduckgo https://duckduckgo.com/?q= +set searchurls.yahoo https://search.yahoo.com/search?p= +set searchurls.twitter https://twitter.com/search?q= +set searchurls.wikipedia https://en.wikipedia.org/wiki/Special:Search/ +set searchurls.youtube https://www.youtube.com/results?search_query= +set searchurls.amazon https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords= +set searchurls.amazonuk https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords= +set searchurls.startpage https://startpage.com/do/search?language=english&cat=web&query= +set searchurls.github https://github.com/search?utf8=โœ“&q= +set searchurls.searx https://searx.me/?category_general=on&q= +set searchurls.cnrtl http://www.cnrtl.fr/lexicographie/ +set searchurls.osm https://www.openstreetmap.org/search?query= +set searchurls.mdn https://developer.mozilla.org/en-US/search?q= +set searchurls.gentoo_wiki https://wiki.gentoo.org/index.php?title=Special%3ASearch&profile=default&fulltext=Search&search= +set searchurls.qwant https://www.qwant.com/?q= + +" Binds +bind J tabnext +bind K tabprev +unbind i +bind ;x hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + window.devicePixelRatio * pos.x + " " + window.devicePixelRatio * pos.y + "; xdotool click 1")} +bind ;X hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + window.devicePixelRatio * pos.x + " " + window.devicePixelRatio * pos.y + "; xdotool keydown ctrl+shift; xdotool click 1; xdotool keyup ctrl+shift")} +bind pin +bind mute toggle +bind help +bind o fillcmdline open +bind O current_url open +bind w fillcmdline winopen +bind W current_url winopen +bind t fillcmdline tabopen +bind ]] followpage next +bind [[ followpage prev +bind [c urlincrement -1 +bind ]c urlincrement 1 +bind urlincrement -1 +bind urlincrement 1 +bind T current_url tabopen +bind yy clipboard yank +bind ys clipboard yankshort +bind yc clipboard yankcanon +bind ym clipboard yankmd +bind yo clipboard yankorg +bind yt clipboard yanktitle +bind gh home +bind gH home true +bind p clipboard open +bind P clipboard tabopen +bind j scrollline 10 +bind scrollline 10 +bind k scrollline -10 +bind scrollline -10 +bind h scrollpx -50 +bind l scrollpx 50 +bind G scrollto 100 +bind gg scrollto 0 +bind scrollpage -0.5 +bind scrollpage 0.5 +bind scrollpage 1 +bind scrollpage -1 +bind nmode ignore 1 mode normal +bind $ scrollto 100 x +bind ^ scrollto 0 x +bind H back +bind L forward +bind jumpprev +bind jumpnext +bind d tabclose +bind D composite tabprev; tabclose # +bind gx0 tabclosealltoleft +bind gx$ tabclosealltoright +bind << tabmove -1 +bind >> tabmove +1 +bind u undo +bind U undo window +bind r reload +bind R reloadhard +bind x stop +bind gi focusinput -l +bind g? rot13 +bind g! jumble +bind g; changelistjump -1 +bind gt tabnext_gt +bind gT tabprev +bind g^ tabfirst +bind g0 tabfirst +bind g$ tablast +bind ga tabaudio +bind gr reader +bind gu urlparent +bind gU urlroot +bind gf viewsource +bind : fillcmdline_notrail +bind s fillcmdline open search +bind S fillcmdline tabopen search +bind M gobble 1 quickmark +bind B fillcmdline taball +bind b fillcmdline tab +bind ZZ qall +bind f hint +bind F hint -b +bind gF hint -qb +bind ;i hint -i +bind ;b hint -b +bind ;o hint +bind ;I hint -I +bind ;k hint -k +bind ;K hint -K +bind ;y hint -y +bind ;Y hint -cF img i => tri.excmds.yankimage(tri.urlutils.getAbsoluteURL(i.src)) +bind ;p hint -p +bind ;h hint -h +bind v hint -h +bind ;P hint -P +bind ;r hint -r +bind ;s hint -s +bind ;S hint -S +bind ;a hint -a +bind ;A hint -A +bind ;; hint -; * +bind ;# hint -# +bind ;v hint -W mpvsafe +bind ;V hint -V +bind ;w hint -w +bind ;t hint -W tabopen +bind ;O hint -W fillcmdline_notrail open +bind ;W hint -W fillcmdline_notrail winopen +bind ;T hint -W fillcmdline_notrail tabopen +bind ;z hint -z +bind ;m composite hint -Jpipe img src | open images.google.com/searchbyimage?image_url= +bind ;M composite hint -Jpipe img src | tabopen images.google.com/searchbyimage?image_url= +bind ;gi hint -qi +bind ;gI hint -qI +bind ;gk hint -qk +bind ;gy hint -qy +bind ;gp hint -qp +bind ;gP hint -qP +bind ;gr hint -qr +bind ;gs hint -qs +bind ;gS hint -qS +bind ;ga hint -qa +bind ;gA hint -qA +bind ;g; hint -q; +bind ;g# hint -q# +bind ;gv hint -qW mpvsafe +bind ;gw hint -qw +bind ;gb hint -qb +bind ;gF hint -qb +bind ;gf hint -q +bind mode ignore +bind mode ignore +bind mode ignore +bind mode ignore +bind composite mode normal ; hidecmdline +bind composite mode normal ; hidecmdline +bind a current_url bmark +bind A bmark +bind zi zoom 0.1 true +bind zo zoom -0.1 true +bind zm zoom 0.5 true +bind zr zoom -0.5 true +bind zM zoom 0.5 true +bind zR zoom -0.5 true +bind zz zoom 1 +bind zI zoom 3 +bind zO zoom 0.3 +bind . repeat +bind ba open https://www.youtube.com/watch?v=M3iOROuTuMA +bind m gobble 1 markadd +bind ` gobble 1 markjump +bind gna tabopen moz-extension://7cf2fd76-6055-4053-bb4b-f518030f6240/static/docs/classes/_src_lib_config_.default_config.html +bind goa open moz-extension://7cf2fd76-6055-4053-bb4b-f518030f6240/static/docs/classes/_src_lib_config_.default_config.html +bind gwa winopen moz-extension://7cf2fd76-6055-4053-bb4b-f518030f6240/static/docs/classes/_src_lib_config_.default_config.html +bind gnc tabopen https://chat.openai.com/chat +bind goc open https://chat.openai.com/chat +bind gwc winopen https://chat.openai.com/chat +bind gnp tabopen https://github.com/Siilwyn/awesome-pixel-art#tutorials +bind gop open https://github.com/Siilwyn/awesome-pixel-art#tutorials +bind gwp winopen https://github.com/Siilwyn/awesome-pixel-art#tutorials + +" For syntax highlighting see https://github.com/tridactyl/vim-tridactyl +" vim: set filetype=tridactyl diff --git a/config/old/vim/.VimballRecord b/config/old/vim/.VimballRecord new file mode 100644 index 0000000..25f335d --- /dev/null +++ b/config/old/vim/.VimballRecord @@ -0,0 +1 @@ +Colorizer-0.10.vmb: call delete('/home/aluc/.vim/plugin/ColorizerPlugin.vim')|call delete('/home/aluc/.vim/doc/Colorizer.txt')|call delete('/home/aluc/.vim/autoload/Colorizer.vim') diff --git a/config/old/vim/autoload/Colorizer.vim b/config/old/vim/autoload/Colorizer.vim new file mode 100644 index 0000000..d92e87d --- /dev/null +++ b/config/old/vim/autoload/Colorizer.vim @@ -0,0 +1,2397 @@ +" Plugin: Highlight Colornames and Values +" Maintainer: Christian Brabandt +" URL: http://www.github.com/chrisbra/color_highlight +" Last Change: Thu, 27 Mar 2014 23:12:43 +0100 +" Licence: Vim License (see :h License) +" Version: 0.10 +" GetLatestVimScripts: 3963 10 :AutoInstall: Colorizer.vim +" +" This plugin was inspired by the css_color.vim plugin from Nikolaus Hofer. +" Changes made: - make terminal colors work more reliably and with all +" color terminals +" - performance improvements, coloring is almost instantenously +" - detect rgb colors like this: rgb(R,G,B) +" - detect hvl coloring: hvl(H,V,L) +" - fix small bugs +" - Color ANSI Term values and hide terminal escape sequences + +" Init some variables "{{{1 +let s:cpo_save = &cpo +set cpo&vim + +let s:debug = 0 +" the 6 value iterations in the xterm color cube "{{{2 +let s:valuerange6 = [ 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF ] + +"" the 4 value iterations in the 88 color xterm cube "{{{2 +let s:valuerange4 = [ 0x00, 0x8B, 0xCD, 0xFF ] +" +"" 16 basic colors "{{{2 +let s:basic16 = [ + \ [ 0x00, 0x00, 0x00 ], + \ [ 0xCD, 0x00, 0x00 ], + \ [ 0x00, 0xCD, 0x00 ], + \ [ 0xCD, 0xCD, 0x00 ], + \ [ 0x00, 0x00, 0xEE ], + \ [ 0xCD, 0x00, 0xCD ], + \ [ 0x00, 0xCD, 0xCD ], + \ [ 0xE5, 0xE5, 0xE5 ], + \ [ 0x7F, 0x7F, 0x7F ], + \ [ 0xFF, 0x00, 0x00 ], + \ [ 0x00, 0xFF, 0x00 ], + \ [ 0xFF, 0xFF, 0x00 ], + \ [ 0x5C, 0x5C, 0xFF ], + \ [ 0xFF, 0x00, 0xFF ], + \ [ 0x00, 0xFF, 0xFF ], + \ [ 0xFF, 0xFF, 0xFF ] + \ ] + +" Cygwin / Window console / ConEmu has different color codes +if (expand("$ComSpec") =~# '^\%(command\.com\|cmd\.exe\)$' && + \ !has("gui_running")) || + \ (exists("$ConEmuPID") && + \ expand("$ConEmuANSI") ==# "OFF") || + \ (expand("$TERM") ==# 'cygwin' && &t_Co == 16) " Cygwin terminal + + " command.com/ConEmu Color Cube (currently only supports 16 colors) + let s:basic16 = [ + \ [ 0x00, 0x00, 0x00 ], + \ [ 0x00, 0x00, 0x80 ], + \ [ 0x00, 0x80, 0x00 ], + \ [ 0x00, 0x80, 0x80 ], + \ [ 0x80, 0x00, 0x00 ], + \ [ 0x80, 0x00, 0x80 ], + \ [ 0xFF, 0xFF, 0x00 ], + \ [ 0xFF, 0xFF, 0xFF ], + \ [ 0xC0, 0xC0, 0xC0 ], + \ [ 0x00, 0x00, 0xFF ], + \ [ 0x00, 0xFF, 0x00 ], + \ [ 0x00, 0xFF, 0xFF ], + \ [ 0xFF, 0x00, 0x00 ], + \ [ 0xFF, 0x00, 0xFF ], + \ [ 0xFF, 0xFF, 0x00 ], + \ [ 0xFF, 0xFF, 0xFF ] + \ ] + let &t_Co=16 +endif + +" xterm-8 colors "{{{2 +let s:xterm_8colors = { +\ 'black': '#000000', +\ 'darkblue': '#00008B', +\ 'darkgreen': '#00CD00', +\ 'darkcyan': '#00CDCD', +\ 'darkred': '#CD0000', +\ 'darkmagenta': '#8B008B', +\ 'brown': '#CDCD00', +\ 'darkyellow': '#CDCD00', +\ 'lightgrey': '#E5E5E5', +\ 'lightgray': '#E5E5E5', +\ 'gray': '#E5E5E5', +\ 'grey': '#E5E5E5' +\ } + +" xterm-16 colors "{{{2 +let s:xterm_16colors = { +\ 'darkgrey': '#7F7F7F', +\ 'darkgray': '#7F7F7F', +\ 'blue': '#5C5CFF', +\ 'lightblue': '#5C5CFF', +\ 'green': '#00FF00', +\ 'lightgreen': '#00FF00', +\ 'cyan': '#00FFFF', +\ 'lightcyan': '#00FFFF', +\ 'red': '#FF0000', +\ 'lightred': '#FF0000', +\ 'magenta': '#FF00FF', +\ 'lightmagenta': '#FF00FF', +\ 'yellow': '#FFFF00', +\ 'lightyellow': '#FFFF00', +\ 'white': '#FFFFFF', +\ } +" add the items from the 8 color xterm variable to the 16 color xterm +call extend(s:xterm_16colors, s:xterm_8colors) + +" W3C Colors "{{{2 +let s:w3c_color_names = { +\ 'aliceblue': '#F0F8FF', +\ 'antiquewhite': '#FAEBD7', +\ 'aqua': '#00FFFF', +\ 'aquamarine': '#7FFFD4', +\ 'azure': '#F0FFFF', +\ 'beige': '#F5F5DC', +\ 'bisque': '#FFE4C4', +\ 'black': '#000000', +\ 'blanchedalmond': '#FFEBCD', +\ 'blue': '#0000FF', +\ 'blueviolet': '#8A2BE2', +\ 'brown': '#A52A2A', +\ 'burlywood': '#DEB887', +\ 'cadetblue': '#5F9EA0', +\ 'chartreuse': '#7FFF00', +\ 'chocolate': '#D2691E', +\ 'coral': '#FF7F50', +\ 'cornflowerblue': '#6495ED', +\ 'cornsilk': '#FFF8DC', +\ 'crimson': '#DC143C', +\ 'cyan': '#00FFFF', +\ 'darkblue': '#00008B', +\ 'darkcyan': '#008B8B', +\ 'darkgoldenrod': '#B8860B', +\ 'darkgray': '#A9A9A9', +\ 'darkgreen': '#006400', +\ 'darkkhaki': '#BDB76B', +\ 'darkmagenta': '#8B008B', +\ 'darkolivegreen': '#556B2F', +\ 'darkorange': '#FF8C00', +\ 'darkorchid': '#9932CC', +\ 'darkred': '#8B0000', +\ 'darksalmon': '#E9967A', +\ 'darkseagreen': '#8FBC8F', +\ 'darkslateblue': '#483D8B', +\ 'darkslategray': '#2F4F4F', +\ 'darkturquoise': '#00CED1', +\ 'darkviolet': '#9400D3', +\ 'deeppink': '#FF1493', +\ 'deepskyblue': '#00BFFF', +\ 'dimgray': '#696969', +\ 'dodgerblue': '#1E90FF', +\ 'firebrick': '#B22222', +\ 'floralwhite': '#FFFAF0', +\ 'forestgreen': '#228B22', +\ 'fuchsia': '#FF00FF', +\ 'gainsboro': '#DCDCDC', +\ 'ghostwhite': '#F8F8FF', +\ 'gold': '#FFD700', +\ 'goldenrod': '#DAA520', +\ 'gray': '#808080', +\ 'green': '#008000', +\ 'greenyellow': '#ADFF2F', +\ 'honeydew': '#F0FFF0', +\ 'hotpink': '#FF69B4', +\ 'indianred': '#CD5C5C', +\ 'indigo': '#4B0082', +\ 'ivory': '#FFFFF0', +\ 'khaki': '#F0E68C', +\ 'lavender': '#E6E6FA', +\ 'lavenderblush': '#FFF0F5', +\ 'lawngreen': '#7CFC00', +\ 'lemonchiffon': '#FFFACD', +\ 'lightblue': '#ADD8E6', +\ 'lightcoral': '#F08080', +\ 'lightcyan': '#E0FFFF', +\ 'lightgoldenrodyellow': '#FAFAD2', +\ 'lightgray': '#D3D3D3', +\ 'lightgreen': '#90EE90', +\ 'lightpink': '#FFB6C1', +\ 'lightsalmon': '#FFA07A', +\ 'lightseagreen': '#20B2AA', +\ 'lightskyblue': '#87CEFA', +\ 'lightslategray': '#778899', +\ 'lightsteelblue': '#B0C4DE', +\ 'lightyellow': '#FFFFE0', +\ 'lime': '#00FF00', +\ 'limegreen': '#32CD32', +\ 'linen': '#FAF0E6', +\ 'magenta': '#FF00FF', +\ 'maroon': '#800000', +\ 'mediumaquamarine': '#66CDAA', +\ 'mediumblue': '#0000CD', +\ 'mediumorchid': '#BA55D3', +\ 'mediumpurple': '#9370D8', +\ 'mediumseagreen': '#3CB371', +\ 'mediumslateblue': '#7B68EE', +\ 'mediumspringgreen': '#00FA9A', +\ 'mediumturquoise': '#48D1CC', +\ 'mediumvioletred': '#C71585', +\ 'midnightblue': '#191970', +\ 'mintcream': '#F5FFFA', +\ 'mistyrose': '#FFE4E1', +\ 'moccasin': '#FFE4B5', +\ 'navajowhite': '#FFDEAD', +\ 'navy': '#000080', +\ 'oldlace': '#FDF5E6', +\ 'olive': '#808000', +\ 'olivedrab': '#6B8E23', +\ 'orange': '#FFA500', +\ 'orangered': '#FF4500', +\ 'orchid': '#DA70D6', +\ 'palegoldenrod': '#EEE8AA', +\ 'palegreen': '#98FB98', +\ 'paleturquoise': '#AFEEEE', +\ 'palevioletred': '#D87093', +\ 'papayawhip': '#FFEFD5', +\ 'peachpuff': '#FFDAB9', +\ 'peru': '#CD853F', +\ 'pink': '#FFC0CB', +\ 'plum': '#DDA0DD', +\ 'powderblue': '#B0E0E6', +\ 'purple': '#800080', +\ 'red': '#FF0000', +\ 'rosybrown': '#BC8F8F', +\ 'royalblue': '#4169E1', +\ 'saddlebrown': '#8B4513', +\ 'salmon': '#FA8072', +\ 'sandybrown': '#F4A460', +\ 'seagreen': '#2E8B57', +\ 'seashell': '#FFF5EE', +\ 'sienna': '#A0522D', +\ 'silver': '#C0C0C0', +\ 'skyblue': '#87CEEB', +\ 'slateblue': '#6A5ACD', +\ 'slategray': '#708090', +\ 'snow': '#FFFAFA', +\ 'springgreen': '#00FF7F', +\ 'steelblue': '#4682B4', +\ 'tan': '#D2B48C', +\ 'teal': '#008080', +\ 'thistle': '#D8BFD8', +\ 'tomato': '#FF6347', +\ 'turquoise': '#40E0D0', +\ 'violet': '#EE82EE', +\ 'wheat': '#F5DEB3', +\ 'white': '#FFFFFF', +\ 'whitesmoke': '#F5F5F5', +\ 'yellow': '#FFFF00', +\ 'yellowgreen': '#9ACD32' +\ } + +" X11 color names taken from "{{{2 +" http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/programs/rgb/rgb.txt?rev=1.2 +let s:x11_color_names = { +\ 'snow': '#FFFAFA', +\ 'ghostwhite': '#F8F8FF', +\ 'whitesmoke': '#F5F5F5', +\ 'gainsboro': '#DCDCDC', +\ 'floralwhite': '#FFFAF0', +\ 'oldlace': '#FDF5E6', +\ 'linen': '#FAF0E6', +\ 'antiquewhite': '#FAEBD7', +\ 'papayawhip': '#FFEFD5', +\ 'blanchedalmond': '#FFEBCD', +\ 'bisque': '#FFE4C4', +\ 'peachpuff': '#FFDAB9', +\ 'navajowhite': '#FFDEAD', +\ 'moccasin': '#FFE4B5', +\ 'cornsilk': '#FFF8DC', +\ 'ivory': '#FFFFF0', +\ 'lemonchiffon': '#FFFACD', +\ 'seashell': '#FFF5EE', +\ 'honeydew': '#F0FFF0', +\ 'mintcream': '#F5FFFA', +\ 'azure': '#F0FFFF', +\ 'aliceblue': '#F0F8FF', +\ 'lavender': '#E6E6FA', +\ 'lavenderblush': '#FFF0F5', +\ 'mistyrose': '#FFE4E1', +\ 'white': '#FFFFFF', +\ 'black': '#000000', +\ 'darkslategray': '#2F4F4F', +\ 'darkslategrey': '#2F4F4F', +\ 'dimgray': '#696969', +\ 'dimgrey': '#696969', +\ 'slategray': '#708090', +\ 'slategrey': '#708090', +\ 'lightslategray': '#778899', +\ 'lightslategrey': '#778899', +\ 'gray': '#BEBEBE', +\ 'grey': '#BEBEBE', +\ 'lightgrey': '#D3D3D3', +\ 'lightgray': '#D3D3D3', +\ 'midnightblue': '#191970', +\ 'navy': '#000080', +\ 'navyblue': '#000080', +\ 'cornflowerblue': '#6495ED', +\ 'darkslateblue': '#483D8B', +\ 'slateblue': '#6A5ACD', +\ 'mediumslateblue': '#7B68EE', +\ 'lightslateblue': '#8470FF', +\ 'mediumblue': '#0000CD', +\ 'royalblue': '#4169E1', +\ 'blue': '#0000FF', +\ 'dodgerblue': '#1E90FF', +\ 'deepskyblue': '#00BFFF', +\ 'skyblue': '#87CEEB', +\ 'lightskyblue': '#87CEFA', +\ 'steelblue': '#4682B4', +\ 'lightsteelblue': '#B0C4DE', +\ 'lightblue': '#ADD8E6', +\ 'powderblue': '#B0E0E6', +\ 'paleturquoise': '#AFEEEE', +\ 'darkturquoise': '#00CED1', +\ 'mediumturquoise': '#48D1CC', +\ 'turquoise': '#40E0D0', +\ 'cyan': '#00FFFF', +\ 'lightcyan': '#E0FFFF', +\ 'cadetblue': '#5F9EA0', +\ 'mediumaquamarine': '#66CDAA', +\ 'aquamarine': '#7FFFD4', +\ 'darkgreen': '#006400', +\ 'darkolivegreen': '#556B2F', +\ 'darkseagreen': '#8FBC8F', +\ 'seagreen': '#2E8B57', +\ 'mediumseagreen': '#3CB371', +\ 'lightseagreen': '#20B2AA', +\ 'palegreen': '#98FB98', +\ 'springgreen': '#00FF7F', +\ 'lawngreen': '#7CFC00', +\ 'green': '#00FF00', +\ 'chartreuse': '#7FFF00', +\ 'mediumspringgreen': '#00FA9A', +\ 'greenyellow': '#ADFF2F', +\ 'limegreen': '#32CD32', +\ 'yellowgreen': '#9ACD32', +\ 'forestgreen': '#228B22', +\ 'olivedrab': '#6B8E23', +\ 'darkkhaki': '#BDB76B', +\ 'khaki': '#F0E68C', +\ 'palegoldenrod': '#EEE8AA', +\ 'lightgoldenrodyellow': '#FAFAD2', +\ 'lightyellow': '#FFFFE0', +\ 'yellow': '#FFFF00', +\ 'gold': '#FFD700', +\ 'lightgoldenrod': '#EEDD82', +\ 'goldenrod': '#DAA520', +\ 'darkgoldenrod': '#B8860B', +\ 'rosybrown': '#BC8F8F', +\ 'indianred': '#CD5C5C', +\ 'saddlebrown': '#8B4513', +\ 'sienna': '#A0522D', +\ 'peru': '#CD853F', +\ 'burlywood': '#DEB887', +\ 'beige': '#F5F5DC', +\ 'wheat': '#F5DEB3', +\ 'sandybrown': '#F4A460', +\ 'tan': '#D2B48C', +\ 'chocolate': '#D2691E', +\ 'firebrick': '#B22222', +\ 'brown': '#A52A2A', +\ 'darksalmon': '#E9967A', +\ 'salmon': '#FA8072', +\ 'lightsalmon': '#FFA07A', +\ 'orange': '#FFA500', +\ 'darkorange': '#FF8C00', +\ 'coral': '#FF7F50', +\ 'lightcoral': '#F08080', +\ 'tomato': '#FF6347', +\ 'orangered': '#FF4500', +\ 'red': '#FF0000', +\ 'hotpink': '#FF69B4', +\ 'deeppink': '#FF1493', +\ 'pink': '#FFC0CB', +\ 'lightpink': '#FFB6C1', +\ 'palevioletred': '#DB7093', +\ 'maroon': '#B03060', +\ 'mediumvioletred': '#C71585', +\ 'violetred': '#D02090', +\ 'magenta': '#FF00FF', +\ 'violet': '#EE82EE', +\ 'plum': '#DDA0DD', +\ 'orchid': '#DA70D6', +\ 'mediumorchid': '#BA55D3', +\ 'darkorchid': '#9932CC', +\ 'darkviolet': '#9400D3', +\ 'blueviolet': '#8A2BE2', +\ 'purple': '#A020F0', +\ 'mediumpurple': '#9370DB', +\ 'thistle': '#D8BFD8', +\ 'snow1': '#FFFAFA', +\ 'snow2': '#EEE9E9', +\ 'snow3': '#CDC9C9', +\ 'snow4': '#8B8989', +\ 'seashell1': '#FFF5EE', +\ 'seashell2': '#EEE5DE', +\ 'seashell3': '#CDC5BF', +\ 'seashell4': '#8B8682', +\ 'antiquewhite1': '#FFEFDB', +\ 'antiquewhite2': '#EEDFCC', +\ 'antiquewhite3': '#CDC0B0', +\ 'antiquewhite4': '#8B8378', +\ 'bisque1': '#FFE4C4', +\ 'bisque2': '#EED5B7', +\ 'bisque3': '#CDB79E', +\ 'bisque4': '#8B7D6B', +\ 'peachpuff1': '#FFDAB9', +\ 'peachpuff2': '#EECBAD', +\ 'peachpuff3': '#CDAF95', +\ 'peachpuff4': '#8B7765', +\ 'navajowhite1': '#FFDEAD', +\ 'navajowhite2': '#EECFA1', +\ 'navajowhite3': '#CDB38B', +\ 'navajowhite4': '#8B795E', +\ 'lemonchiffon1': '#FFFACD', +\ 'lemonchiffon2': '#EEE9BF', +\ 'lemonchiffon3': '#CDC9A5', +\ 'lemonchiffon4': '#8B8970', +\ 'cornsilk1': '#FFF8DC', +\ 'cornsilk2': '#EEE8CD', +\ 'cornsilk3': '#CDC8B1', +\ 'cornsilk4': '#8B8878', +\ 'ivory1': '#FFFFF0', +\ 'ivory2': '#EEEEE0', +\ 'ivory3': '#CDCDC1', +\ 'ivory4': '#8B8B83', +\ 'honeydew1': '#F0FFF0', +\ 'honeydew2': '#E0EEE0', +\ 'honeydew3': '#C1CDC1', +\ 'honeydew4': '#838B83', +\ 'lavenderblush1': '#FFF0F5', +\ 'lavenderblush2': '#EEE0E5', +\ 'lavenderblush3': '#CDC1C5', +\ 'lavenderblush4': '#8B8386', +\ 'mistyrose1': '#FFE4E1', +\ 'mistyrose2': '#EED5D2', +\ 'mistyrose3': '#CDB7B5', +\ 'mistyrose4': '#8B7D7B', +\ 'azure1': '#F0FFFF', +\ 'azure2': '#E0EEEE', +\ 'azure3': '#C1CDCD', +\ 'azure4': '#838B8B', +\ 'slateblue1': '#836FFF', +\ 'slateblue2': '#7A67EE', +\ 'slateblue3': '#6959CD', +\ 'slateblue4': '#473C8B', +\ 'royalblue1': '#4876FF', +\ 'royalblue2': '#436EEE', +\ 'royalblue3': '#3A5FCD', +\ 'royalblue4': '#27408B', +\ 'blue1': '#0000FF', +\ 'blue2': '#0000EE', +\ 'blue3': '#0000CD', +\ 'blue4': '#00008B', +\ 'dodgerblue1': '#1E90FF', +\ 'dodgerblue2': '#1C86EE', +\ 'dodgerblue3': '#1874CD', +\ 'dodgerblue4': '#104E8B', +\ 'steelblue1': '#63B8FF', +\ 'steelblue2': '#5CACEE', +\ 'steelblue3': '#4F94CD', +\ 'steelblue4': '#36648B', +\ 'deepskyblue1': '#00BFFF', +\ 'deepskyblue2': '#00B2EE', +\ 'deepskyblue3': '#009ACD', +\ 'deepskyblue4': '#00688B', +\ 'skyblue1': '#87CEFF', +\ 'skyblue2': '#7EC0EE', +\ 'skyblue3': '#6CA6CD', +\ 'skyblue4': '#4A708B', +\ 'lightskyblue1': '#B0E2FF', +\ 'lightskyblue2': '#A4D3EE', +\ 'lightskyblue3': '#8DB6CD', +\ 'lightskyblue4': '#607B8B', +\ 'slategray1': '#C6E2FF', +\ 'slategray2': '#B9D3EE', +\ 'slategray3': '#9FB6CD', +\ 'slategray4': '#6C7B8B', +\ 'lightsteelblue1': '#CAE1FF', +\ 'lightsteelblue2': '#BCD2EE', +\ 'lightsteelblue3': '#A2B5CD', +\ 'lightsteelblue4': '#6E7B8B', +\ 'lightblue1': '#BFEFFF', +\ 'lightblue2': '#B2DFEE', +\ 'lightblue3': '#9AC0CD', +\ 'lightblue4': '#68838B', +\ 'lightcyan1': '#E0FFFF', +\ 'lightcyan2': '#D1EEEE', +\ 'lightcyan3': '#B4CDCD', +\ 'lightcyan4': '#7A8B8B', +\ 'paleturquoise1': '#BBFFFF', +\ 'paleturquoise2': '#AEEEEE', +\ 'paleturquoise3': '#96CDCD', +\ 'paleturquoise4': '#668B8B', +\ 'cadetblue1': '#98F5FF', +\ 'cadetblue2': '#8EE5EE', +\ 'cadetblue3': '#7AC5CD', +\ 'cadetblue4': '#53868B', +\ 'turquoise1': '#00F5FF', +\ 'turquoise2': '#00E5EE', +\ 'turquoise3': '#00C5CD', +\ 'turquoise4': '#00868B', +\ 'cyan1': '#00FFFF', +\ 'cyan2': '#00EEEE', +\ 'cyan3': '#00CDCD', +\ 'cyan4': '#008B8B', +\ 'darkslategray1': '#97FFFF', +\ 'darkslategray2': '#8DEEEE', +\ 'darkslategray3': '#79CDCD', +\ 'darkslategray4': '#528B8B', +\ 'aquamarine1': '#7FFFD4', +\ 'aquamarine2': '#76EEC6', +\ 'aquamarine3': '#66CDAA', +\ 'aquamarine4': '#458B74', +\ 'darkseagreen1': '#C1FFC1', +\ 'darkseagreen2': '#B4EEB4', +\ 'darkseagreen3': '#9BCD9B', +\ 'darkseagreen4': '#698B69', +\ 'seagreen1': '#54FF9F', +\ 'seagreen2': '#4EEE94', +\ 'seagreen3': '#43CD80', +\ 'seagreen4': '#2E8B57', +\ 'palegreen1': '#9AFF9A', +\ 'palegreen2': '#90EE90', +\ 'palegreen3': '#7CCD7C', +\ 'palegreen4': '#548B54', +\ 'springgreen1': '#00FF7F', +\ 'springgreen2': '#00EE76', +\ 'springgreen3': '#00CD66', +\ 'springgreen4': '#008B45', +\ 'green1': '#00FF00', +\ 'green2': '#00EE00', +\ 'green3': '#00CD00', +\ 'green4': '#008B00', +\ 'chartreuse1': '#7FFF00', +\ 'chartreuse2': '#76EE00', +\ 'chartreuse3': '#66CD00', +\ 'chartreuse4': '#458B00', +\ 'olivedrab1': '#C0FF3E', +\ 'olivedrab2': '#B3EE3A', +\ 'olivedrab3': '#9ACD32', +\ 'olivedrab4': '#698B22', +\ 'darkolivegreen1': '#CAFF70', +\ 'darkolivegreen2': '#BCEE68', +\ 'darkolivegreen3': '#A2CD5A', +\ 'darkolivegreen4': '#6E8B3D', +\ 'khaki1': '#FFF68F', +\ 'khaki2': '#EEE685', +\ 'khaki3': '#CDC673', +\ 'khaki4': '#8B864E', +\ 'lightgoldenrod1': '#FFEC8B', +\ 'lightgoldenrod2': '#EEDC82', +\ 'lightgoldenrod3': '#CDBE70', +\ 'lightgoldenrod4': '#8B814C', +\ 'lightyellow1': '#FFFFE0', +\ 'lightyellow2': '#EEEED1', +\ 'lightyellow3': '#CDCDB4', +\ 'lightyellow4': '#8B8B7A', +\ 'yellow1': '#FFFF00', +\ 'yellow2': '#EEEE00', +\ 'yellow3': '#CDCD00', +\ 'yellow4': '#8B8B00', +\ 'gold1': '#FFD700', +\ 'gold2': '#EEC900', +\ 'gold3': '#CDAD00', +\ 'gold4': '#8B7500', +\ 'goldenrod1': '#FFC125', +\ 'goldenrod2': '#EEB422', +\ 'goldenrod3': '#CD9B1D', +\ 'goldenrod4': '#8B6914', +\ 'darkgoldenrod1': '#FFB90F', +\ 'darkgoldenrod2': '#EEAD0E', +\ 'darkgoldenrod3': '#CD950C', +\ 'darkgoldenrod4': '#8B6508', +\ 'rosybrown1': '#FFC1C1', +\ 'rosybrown2': '#EEB4B4', +\ 'rosybrown3': '#CD9B9B', +\ 'rosybrown4': '#8B6969', +\ 'indianred1': '#FF6A6A', +\ 'indianred2': '#EE6363', +\ 'indianred3': '#CD5555', +\ 'indianred4': '#8B3A3A', +\ 'sienna1': '#FF8247', +\ 'sienna2': '#EE7942', +\ 'sienna3': '#CD6839', +\ 'sienna4': '#8B4726', +\ 'burlywood1': '#FFD39B', +\ 'burlywood2': '#EEC591', +\ 'burlywood3': '#CDAA7D', +\ 'burlywood4': '#8B7355', +\ 'wheat1': '#FFE7BA', +\ 'wheat2': '#EED8AE', +\ 'wheat3': '#CDBA96', +\ 'wheat4': '#8B7E66', +\ 'tan1': '#FFA54F', +\ 'tan2': '#EE9A49', +\ 'tan3': '#CD853F', +\ 'tan4': '#8B5A2B', +\ 'chocolate1': '#FF7F24', +\ 'chocolate2': '#EE7621', +\ 'chocolate3': '#CD661D', +\ 'chocolate4': '#8B4513', +\ 'firebrick1': '#FF3030', +\ 'firebrick2': '#EE2C2C', +\ 'firebrick3': '#CD2626', +\ 'firebrick4': '#8B1A1A', +\ 'brown1': '#FF4040', +\ 'brown2': '#EE3B3B', +\ 'brown3': '#CD3333', +\ 'brown4': '#8B2323', +\ 'salmon1': '#FF8C69', +\ 'salmon2': '#EE8262', +\ 'salmon3': '#CD7054', +\ 'salmon4': '#8B4C39', +\ 'lightsalmon1': '#FFA07A', +\ 'lightsalmon2': '#EE9572', +\ 'lightsalmon3': '#CD8162', +\ 'lightsalmon4': '#8B5742', +\ 'orange1': '#FFA500', +\ 'orange2': '#EE9A00', +\ 'orange3': '#CD8500', +\ 'orange4': '#8B5A00', +\ 'darkorange1': '#FF7F00', +\ 'darkorange2': '#EE7600', +\ 'darkorange3': '#CD6600', +\ 'darkorange4': '#8B4500', +\ 'coral1': '#FF7256', +\ 'coral2': '#EE6A50', +\ 'coral3': '#CD5B45', +\ 'coral4': '#8B3E2F', +\ 'tomato1': '#FF6347', +\ 'tomato2': '#EE5C42', +\ 'tomato3': '#CD4F39', +\ 'tomato4': '#8B3626', +\ 'orangered1': '#FF4500', +\ 'orangered2': '#EE4000', +\ 'orangered3': '#CD3700', +\ 'orangered4': '#8B2500', +\ 'red1': '#FF0000', +\ 'red2': '#EE0000', +\ 'red3': '#CD0000', +\ 'red4': '#8B0000', +\ 'deeppink1': '#FF1493', +\ 'deeppink2': '#EE1289', +\ 'deeppink3': '#CD1076', +\ 'deeppink4': '#8B0A50', +\ 'hotpink1': '#FF6EB4', +\ 'hotpink2': '#EE6AA7', +\ 'hotpink3': '#CD6090', +\ 'hotpink4': '#8B3A62', +\ 'pink1': '#FFB5C5', +\ 'pink2': '#EEA9B8', +\ 'pink3': '#CD919E', +\ 'pink4': '#8B636C', +\ 'lightpink1': '#FFAEB9', +\ 'lightpink2': '#EEA2AD', +\ 'lightpink3': '#CD8C95', +\ 'lightpink4': '#8B5F65', +\ 'palevioletred1': '#FF82AB', +\ 'palevioletred2': '#EE799F', +\ 'palevioletred3': '#CD6889', +\ 'palevioletred4': '#8B475D', +\ 'maroon1': '#FF34B3', +\ 'maroon2': '#EE30A7', +\ 'maroon3': '#CD2990', +\ 'maroon4': '#8B1C62', +\ 'violetred1': '#FF3E96', +\ 'violetred2': '#EE3A8C', +\ 'violetred3': '#CD3278', +\ 'violetred4': '#8B2252', +\ 'magenta1': '#FF00FF', +\ 'magenta2': '#EE00EE', +\ 'magenta3': '#CD00CD', +\ 'magenta4': '#8B008B', +\ 'orchid1': '#FF83FA', +\ 'orchid2': '#EE7AE9', +\ 'orchid3': '#CD69C9', +\ 'orchid4': '#8B4789', +\ 'plum1': '#FFBBFF', +\ 'plum2': '#EEAEEE', +\ 'plum3': '#CD96CD', +\ 'plum4': '#8B668B', +\ 'mediumorchid1': '#E066FF', +\ 'mediumorchid2': '#D15FEE', +\ 'mediumorchid3': '#B452CD', +\ 'mediumorchid4': '#7A378B', +\ 'darkorchid1': '#BF3EFF', +\ 'darkorchid2': '#B23AEE', +\ 'darkorchid3': '#9A32CD', +\ 'darkorchid4': '#68228B', +\ 'purple1': '#9B30FF', +\ 'purple2': '#912CEE', +\ 'purple3': '#7D26CD', +\ 'purple4': '#551A8B', +\ 'mediumpurple1': '#AB82FF', +\ 'mediumpurple2': '#9F79EE', +\ 'mediumpurple3': '#8968CD', +\ 'mediumpurple4': '#5D478B', +\ 'thistle1': '#FFE1FF', +\ 'thistle2': '#EED2EE', +\ 'thistle3': '#CDB5CD', +\ 'thistle4': '#8B7B8B', +\ 'gray0': '#000000', +\ 'grey0': '#000000', +\ 'gray1': '#030303', +\ 'grey1': '#030303', +\ 'gray2': '#050505', +\ 'grey2': '#050505', +\ 'gray3': '#080808', +\ 'grey3': '#080808', +\ 'gray4': '#0A0A0A', +\ 'grey4': '#0A0A0A', +\ 'gray5': '#0D0D0D', +\ 'grey5': '#0D0D0D', +\ 'gray6': '#0F0F0F', +\ 'grey6': '#0F0F0F', +\ 'gray7': '#121212', +\ 'grey7': '#121212', +\ 'gray8': '#141414', +\ 'grey8': '#141414', +\ 'gray9': '#171717', +\ 'grey9': '#171717', +\ 'gray10': '#1A1A1A', +\ 'grey10': '#1A1A1A', +\ 'gray11': '#1C1C1C', +\ 'grey11': '#1C1C1C', +\ 'gray12': '#1F1F1F', +\ 'grey12': '#1F1F1F', +\ 'gray13': '#212121', +\ 'grey13': '#212121', +\ 'gray14': '#242424', +\ 'grey14': '#242424', +\ 'gray15': '#262626', +\ 'grey15': '#262626', +\ 'gray16': '#292929', +\ 'grey16': '#292929', +\ 'gray17': '#2B2B2B', +\ 'grey17': '#2B2B2B', +\ 'gray18': '#2E2E2E', +\ 'grey18': '#2E2E2E', +\ 'gray19': '#303030', +\ 'grey19': '#303030', +\ 'gray20': '#333333', +\ 'grey20': '#333333', +\ 'gray21': '#363636', +\ 'grey21': '#363636', +\ 'gray22': '#383838', +\ 'grey22': '#383838', +\ 'gray23': '#3B3B3B', +\ 'grey23': '#3B3B3B', +\ 'gray24': '#3D3D3D', +\ 'grey24': '#3D3D3D', +\ 'gray25': '#404040', +\ 'grey25': '#404040', +\ 'gray26': '#424242', +\ 'grey26': '#424242', +\ 'gray27': '#454545', +\ 'grey27': '#454545', +\ 'gray28': '#474747', +\ 'grey28': '#474747', +\ 'gray29': '#4A4A4A', +\ 'grey29': '#4A4A4A', +\ 'gray30': '#4D4D4D', +\ 'grey30': '#4D4D4D', +\ 'gray31': '#4F4F4F', +\ 'grey31': '#4F4F4F', +\ 'gray32': '#525252', +\ 'grey32': '#525252', +\ 'gray33': '#545454', +\ 'grey33': '#545454', +\ 'gray34': '#575757', +\ 'grey34': '#575757', +\ 'gray35': '#595959', +\ 'grey35': '#595959', +\ 'gray36': '#5C5C5C', +\ 'grey36': '#5C5C5C', +\ 'gray37': '#5E5E5E', +\ 'grey37': '#5E5E5E', +\ 'gray38': '#616161', +\ 'grey38': '#616161', +\ 'gray39': '#636363', +\ 'grey39': '#636363', +\ 'gray40': '#666666', +\ 'grey40': '#666666', +\ 'gray41': '#696969', +\ 'grey41': '#696969', +\ 'gray42': '#6B6B6B', +\ 'grey42': '#6B6B6B', +\ 'gray43': '#6E6E6E', +\ 'grey43': '#6E6E6E', +\ 'gray44': '#707070', +\ 'grey44': '#707070', +\ 'gray45': '#737373', +\ 'grey45': '#737373', +\ 'gray46': '#757575', +\ 'grey46': '#757575', +\ 'gray47': '#787878', +\ 'grey47': '#787878', +\ 'gray48': '#7A7A7A', +\ 'grey48': '#7A7A7A', +\ 'gray49': '#7D7D7D', +\ 'grey49': '#7D7D7D', +\ 'gray50': '#7F7F7F', +\ 'grey50': '#7F7F7F', +\ 'gray51': '#828282', +\ 'grey51': '#828282', +\ 'gray52': '#858585', +\ 'grey52': '#858585', +\ 'gray53': '#878787', +\ 'grey53': '#878787', +\ 'gray54': '#8A8A8A', +\ 'grey54': '#8A8A8A', +\ 'gray55': '#8C8C8C', +\ 'grey55': '#8C8C8C', +\ 'gray56': '#8F8F8F', +\ 'grey56': '#8F8F8F', +\ 'gray57': '#919191', +\ 'grey57': '#919191', +\ 'gray58': '#949494', +\ 'grey58': '#949494', +\ 'gray59': '#969696', +\ 'grey59': '#969696', +\ 'gray60': '#999999', +\ 'grey60': '#999999', +\ 'gray61': '#9C9C9C', +\ 'grey61': '#9C9C9C', +\ 'gray62': '#9E9E9E', +\ 'grey62': '#9E9E9E', +\ 'gray63': '#A1A1A1', +\ 'grey63': '#A1A1A1', +\ 'gray64': '#A3A3A3', +\ 'grey64': '#A3A3A3', +\ 'gray65': '#A6A6A6', +\ 'grey65': '#A6A6A6', +\ 'gray66': '#A8A8A8', +\ 'grey66': '#A8A8A8', +\ 'gray67': '#ABABAB', +\ 'grey67': '#ABABAB', +\ 'gray68': '#ADADAD', +\ 'grey68': '#ADADAD', +\ 'gray69': '#B0B0B0', +\ 'grey69': '#B0B0B0', +\ 'gray70': '#B3B3B3', +\ 'grey70': '#B3B3B3', +\ 'gray71': '#B5B5B5', +\ 'grey71': '#B5B5B5', +\ 'gray72': '#B8B8B8', +\ 'grey72': '#B8B8B8', +\ 'gray73': '#BABABA', +\ 'grey73': '#BABABA', +\ 'gray74': '#BDBDBD', +\ 'grey74': '#BDBDBD', +\ 'gray75': '#BFBFBF', +\ 'grey75': '#BFBFBF', +\ 'gray76': '#C2C2C2', +\ 'grey76': '#C2C2C2', +\ 'gray77': '#C4C4C4', +\ 'grey77': '#C4C4C4', +\ 'gray78': '#C7C7C7', +\ 'grey78': '#C7C7C7', +\ 'gray79': '#C9C9C9', +\ 'grey79': '#C9C9C9', +\ 'gray80': '#CCCCCC', +\ 'grey80': '#CCCCCC', +\ 'gray81': '#CFCFCF', +\ 'grey81': '#CFCFCF', +\ 'gray82': '#D1D1D1', +\ 'grey82': '#D1D1D1', +\ 'gray83': '#D4D4D4', +\ 'grey83': '#D4D4D4', +\ 'gray84': '#D6D6D6', +\ 'grey84': '#D6D6D6', +\ 'gray85': '#D9D9D9', +\ 'grey85': '#D9D9D9', +\ 'gray86': '#DBDBDB', +\ 'grey86': '#DBDBDB', +\ 'gray87': '#DEDEDE', +\ 'grey87': '#DEDEDE', +\ 'gray88': '#E0E0E0', +\ 'grey88': '#E0E0E0', +\ 'gray89': '#E3E3E3', +\ 'grey89': '#E3E3E3', +\ 'gray90': '#E5E5E5', +\ 'grey90': '#E5E5E5', +\ 'gray91': '#E8E8E8', +\ 'grey91': '#E8E8E8', +\ 'gray92': '#EBEBEB', +\ 'grey92': '#EBEBEB', +\ 'gray93': '#EDEDED', +\ 'grey93': '#EDEDED', +\ 'gray94': '#F0F0F0', +\ 'grey94': '#F0F0F0', +\ 'gray95': '#F2F2F2', +\ 'grey95': '#F2F2F2', +\ 'gray96': '#F5F5F5', +\ 'grey96': '#F5F5F5', +\ 'gray97': '#F7F7F7', +\ 'grey97': '#F7F7F7', +\ 'gray98': '#FAFAFA', +\ 'grey98': '#FAFAFA', +\ 'gray99': '#FCFCFC', +\ 'grey99': '#FCFCFC', +\ 'gray100': '#FFFFFF', +\ 'grey100': '#FFFFFF', +\ 'darkgrey': '#A9A9A9', +\ 'darkgray': '#A9A9A9', +\ 'darkblue': '#00008B', +\ 'darkcyan': '#008B8B', +\ 'darkmagenta': '#8B008B', +\ 'darkred': '#8B0000', +\ 'lightgreen': '#90EE90' +\ } + +function! s:IsInComment() "{{{1 + return s:skip_comments && + \ synIDattr(synIDtrans(synID(line('.'), col('.'),1)), 'name') == "Comment" +endfu + +function! s:PreviewColorName(color) "{{{1 + let name=tolower(a:color) + let clr = s:colors[name] + " Skip color-name, e.g. white-space property + call s:SetMatcher('-\@\c-\@!', {'bg': clr[1:]}) +endfu + +function! s:PreviewColorHex(match) "{{{1 + if IsInComment() + " skip coloring comments + return + endif + let color = (a:match[0] == '#' ? a:match[1:] : a:match) + let pattern = color + if len(color) == 3 + let color = substitute(color, '.', '&&', 'g') + endif + if &t_Co == 8 && !has("gui_running") + " The first 12 color names, can be displayed by 8 color terminals + let list = values(s:xterm_8colors) + let idx = match(list, a:match) + if idx == -1 + " Color can't be displayed by 8 color terminal + return + else + let color = list[idx] + endif + endif + call s:SetMatcher(s:hex_pattern[0]. pattern. s:hex_pattern[2], {'bg': color}) +endfunction + +function! s:PreviewColorTerm(pre, text, post) "{{{1 + " a:pre: Ansi-Sequences determining the highlighting + " a:text: Text to color + " a:post: Ansi-Sequences resetting the coloring (might be empty) + let color = s:Ansi2Color(a:pre) + let clr_Dict = {} + + if &t_Co == 8 && !has("gui_running") + " The first 12 color names, can be displayed by 8 color terminals + let i = 0 + for clr in color + let list = values(s:xterm_8colors) + let idx = match(list, clr) + if idx == -1 + " Color can't be displayed by 8 color terminal + let color[i] = NONE + else + let color[i] = list[idx] + endif + let i+=1 + endfor + endif + let clr_Dict.fg = color[0] + let clr_Dict.bg = color[1] + let pattern = '\%('. a:pre. '\)\@<='.escape(a:text, '\^$.*~[]'). '\('.a:post.'\)\@=' + call s:SetMatcher(pattern, clr_Dict) +endfunction + +function! s:PreviewTaskWarriorColors(submatch) "{{{1 + " a:submatch is something like 'black on rgb141' + + " this highlighting should overrule e.g. colorname highlighting + let s:default_match_priority += 1 + let color = ['', 'NONE', 'NONE'] + let color_Dict = {} + " The submatch is everything after the first equalsign! + let tpat = '\(inverse\|underline\|bright\|bold\)\?\%(\s*\)\(\S\{3,}\)'. + \ '\?\%(\s*\)\?\%(on\s\+'. + \ '\%(inverse\|underline\|bright\|bold\)\?\%(\s*\)\(\S\{3,}\)\)\?' + let colormatch = matchlist(a:submatch, tpat) + try + if !empty(colormatch) && !empty(colormatch[0]) + let i=-1 + for m in colormatch[1:3] + let i+=1 + if i == 0 + if (!empty(colormatch[1])) + let color_Dict.special=colormatch[1] + else + continue + endif + endif + if match(keys(s:colors), '\<'.m.'\>') > -1 + if i == 1 + let color_Dict.fg = s:colors[m][1:] " skip the # sign + elseif i == 2 + let color_Dict.bg = s:colors[m][1:] " skip the # sign + endif + continue + elseif match(m, '^rgb...') > -1 + let color[i] = m[3] * 36 + m[4] * 6 + m[5] + 16 " (start at index 16) + if color[i] > 231 + " invalid color + return + endif + elseif match(m, '^color') > -1 + let color[i] = matchstr(m, '\d\+')+0 + if color[i] > 231 + " invalid color + return + endif + elseif match(m, '^gray') > -1 + let color[i] = matchstr(m, '\d\+') + 232 + if color[i] > 231 + " invalid color + return + endif + endif + if i == 1 + let color_Dict.ctermfg = color[i] + elseif i == 2 + let color_Dict.ctermbg = color[i] + endif + endfor + + let cname = get(color_Dict, 'fg', 'NONE') + if cname ==# 'NONE' && get(color_Dict, 'ctermfg') + let cname = s:Term2RGB(color_Dict.ctermfg) + endif + call s:SetMatcher('=\s*\zs\<'.a:submatch.'\>$', color_Dict) + endif + finally + let s:default_match_priority -= 1 + endtry +endfunction + +function! s:PreviewVimColors(submatch) "{{{1 + " a:submatch is something like 'black on rgb141' + + " this highlighting should overrule e.g. colorname highlighting + let s:default_match_priority += 1 + if !exists("s:x11_color_pattern") + let s:x11_color_pattern = s:GetColorPattern(keys(s:x11_color_names)) + endif + let color_Dict = {} + let pat1 = '\%(\(cterm[fb]g\)\s*=\s*\)\@<=\<\(\d\+\)\>' + let pat2 = '\%(\(gui[fb]g\)\s*=\s*\)\@<=#\(\x\{6}\)\>' + let pat3 = '\%#=1\%(\(gui[fb]g\)\s*=\s*\)\@<=\('.s:x11_color_pattern.'\)' + + let cterm = matchlist(a:submatch, pat1) + let gui = matchlist(a:submatch, pat2) + if (!empty(gui) && (gui[2] ==# 'bg' || + \ gui[2] ==# 'fg' || + \ gui[2] ==# 'foreground' || + \ gui[2] ==# 'background')) + let gui=[] + endif + if empty(gui) + let gui = matchlist(a:submatch, pat3) + endif + try + if !empty(cterm) + let color_Dict.ctermbg = cterm[2] + elseif !empty(gui) + let color_Dict.bg = gui[2] + endif + + if empty(gui) && empty(cterm) + return + endif + + call s:SetMatcher('\<'.a:submatch.'\>', color_Dict) + finally + let s:default_match_priority -= 1 + endtry +endfunction + +function! s:PreviewVimHighlightDump(match) "{{{1 + " highlights dumps of :hi + " e.g + "SpecialKey xxx term=bold cterm=bold ctermfg=124 guifg=Cyan + let s:default_match_priority += 1 + let dict = {} + try + let match = split(a:match, '\_s\+') + if a:match =~# 'cleared' + " ipaddr xxx cleared + return + elseif a:match =~# 'links to' + " try to find a non-cleared group + let c1 = SynID(match[0]) + let group = match[0] + if empty(c1) + let group = match[-1] + endif + call s:SetMatch('Color_'.group, '^'.s:GetPatternLiteral(a:match), {}) + else + let dict.name = 'Color_'.match[0] + call remove(match, 0, 1) + let dict = s:DictFromList(dict, match) + call s:SetMatcher(s:GetPatternLiteral(a:match), dict) + endif + finally + let s:default_match_priority -= 1 + " other highlighting functions shouldn't run anymore + let s:stop = 1 + endtry +endfunction + +function! s:PreviewVimHighlight(match) "{{{1 + " like colorhighlight plugin, + " colorizer highlight statements in .vim files + let tmatch = a:match + let def = [] + let dict = {} + try + if a:match =~ '^\s*hi\%[ghlight]\s\+clear' + " highlight clear lines, don't colorize! + return + endif + " HtmlHiLink / HiLink line? + let match = matchlist(tmatch, '\C\%[Html\]HiLink\s\+\(\w\+\)\s\+\(\w\+\)') + " Hopefully tmatch[1] has already been defined ;( + if len(match) + call s:SetMatch('Color_'.match[1], '^\V'.escape(a:match, '\\'), {}) + return + endif + let tmatch = substitute(tmatch, '^\c\s*hi\%[ghlight]\(\s*def\%[ault]\)\?', '', '') + let match = map(split(tmatch), 'substitute(v:val, ''^\s\+\|\s\+$'', "", "g")') + if len(match) < 2 + return + else + let dict.name = 'Color_'.get(match, 0) + let dict = s:DictFromList(dict, match) + call s:SetMatcher(s:GetPatternLiteral(a:match), dict) + endif + endtry +endfunction + +function! s:DictFromList(dict, list) "{{{1 + let dict = copy(a:dict) + let match = filter(a:list, 'v:val =~# ''=''') + for item in match + let [t1, t2] = split(item, '=') + let dict[t1] = t2 + endfor + return dict +endfunction + +function! s:GetPatternLiteral(pat) "{{{1 + return '\V'. substitute(escape(a:pat, '\\'), "\n", '\\n', 'g') +endfu +function! s:Term2RGB(index) "{{{1 + " Return index in colortable in RRGGBB form + return join(map(copy(s:colortable[a:index]), 'printf("%02X", v:val)'),'') +endfu + +function! s:ColorInit(...) "{{{1 + let s:force_hl = !empty(a:1) + + let s:stop = 0 + + " default matchadd priority + let s:default_match_priority = -2 + + " pattern/function dict + " Needed for s:ColorMatchingLines(), disabled, as this is too slow. + "let s:pat_func = {'#\x\{3,6\}': function('PreviewColorHex'), + " \ 'rgba\=(\s*\%(\d\+%\?\D*\)\{3,4})': + " \ function('ColorRGBValues'), + " \ 'hsla\=(\s*\%(\d\+%\?\D*\)\{3,4})': + " \ function('s:ColorHSLValues')} + + " Cache old values + if !exists("s:old_tCo") + let s:old_tCo = &t_Co + endif + + if !exists("s:swap_fg_bg") + let s:swap_fg_bg = 0 + endif + + if !exists("s:round") + let s:round = 0 + endif + + let s:keeppatterns = v:version > 704 || v:version == 704 && has("patch38") + + " Enable Autocommands + if exists("g:colorizer_auto_color") + call Colorizer#AutoCmds(g:colorizer_auto_color) + endif + + " Debugging + let s:debug = get(g:, 'colorizer_debug', 0) + + " Don't highlight comment? + let s:skip_comments = get(g:, 'colorizer_skip_comments', 0) + + " foreground / background contrast + let s:predefined_fgcolors = {} + let s:predefined_fgcolors['dark'] = ['444444', '222222', '000000'] + let s:predefined_fgcolors['light'] = ['bbbbbb', 'dddddd', 'ffffff'] + if !exists('g:colorizer_fgcontrast') + " Default to black / white + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 + elseif g:colorizer_fgcontrast >= len(s:predefined_fgcolors['dark']) + call s:Warn("g:colorizer_fgcontrast value invalid, using default") + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 + endif + + if !exists("s:old_fgcontrast") + " if the value was changed since last time, + " be sure to clear the old highlighting. + let s:old_fgcontrast = g:colorizer_fgcontrast + endif + + if exists("g:colorizer_swap_fgbg") + if s:swap_fg_bg != g:colorizer_swap_fgbg + let s:force_hl = 1 + endif + let s:swap_fg_bg = g:colorizer_swap_fgbg + endif + + if exists("g:colorizer_colornames") + if exists("s:color_names") && + \ s:color_names != g:colorizer_colornames + let s:force_hl = 1 + endif + let s:color_names = g:colorizer_colornames + else + let s:color_names = 1 + endif + + let s:color_syntax = get(g:, 'colorizer_syntax', 0) + if get(g:, 'colorizer_only_unfolded', 0) && exists(":foldd") == 1 + let s:color_unfolded = 'foldd ' + else + let s:color_unfolded = '' + endif + + if !s:force_hl && s:old_fgcontrast != g:colorizer_fgcontrast + \ && s:swap_fg_bg == 0 + " Doesn't work with swapping fg bg colors + let s:force_hl = 1 + let s:old_fgcontrast = g:colorizer_fgcontrast + endif + + " User manually changed the &t_Co option, so reset it + if s:old_tCo != &t_Co + unlet! s:colortable + endif + + if !exists("s:init_css") || !exists("s:colortable") || + \ empty(s:colortable) + " Only calculate the colortable when running + if &t_Co == 8 + let s:colortable = map(range(0,7), 's:Xterm2rgb16(v:val)') + elseif &t_Co == 16 + let s:colortable = map(range(0,15), 's:Xterm2rgb16(v:val)') + elseif &t_Co == 88 + let s:colortable = map(range(0,87), 's:Xterm2rgb88(v:val)') + " terminal with 256 colors or gVim + elseif &t_Co == 256 || empty(&t_Co) + let s:colortable = map(range(0,255), 's:Xterm2rgb256(v:val)') + endif + if s:debug && exists("s:colortable") + let g:colortable = s:colortable + endif + let s:init_css = 1 + elseif s:force_hl + call Colorizer#ColorOff() + endif + if !exists("s:conceal") && has("conceal") + let s:conceal = [&l:cole, &l:cocu] + endif + + let s:hex_pattern = get(g:, 'colorizer_hex_pattern', + \ ['#', '\%(\x\{3}\|\x\{6}\)', '\%(\>\|[-_]\)\@=']) + + if has("gui_running") || &t_Co >= 8 || s:HasColorPattern() + " The list of available match() patterns + let w:match_list = s:GetMatchList() + " If the syntax highlighting got reset, force recreating it + if ((empty(w:match_list) || !hlexists(w:match_list[0].group) || + \ (empty(SynID(w:match_list[0].group)) && !s:force_hl))) + let s:force_hl = 1 + endif + if &t_Co > 16 || has("gui_running") + let s:colors = (exists("g:colorizer_x11_names") ? + \ s:x11_color_names : s:w3c_color_names) + elseif &t_Co == 16 + " should work with 16 colors terminals + let s:colors = s:xterm_16colors + else + let s:colors = s:xterm_8colors + endif + if exists("g:colorizer_custom_colors") + call extend(s:colors, g:colorizer_custom_colors, 'force') + endif + let s:colornamepattern = s:GetColorPattern(keys(s:colors)) + call map(w:match_list, 'v:val.pattern') + else + throw "nocolor" + endif + + " Dictionary, containing all information on what to color + " Key: Name + " Value: List, containing 1) Pattern to find color + " 2) func ref to call on the match of 1 + " 3) Name of variable, to enable or this enty + " 4) condition, that must be fullfilled, before + " using this entry + let s:color_patterns = { + \ 'rgb': ['rgb(\s*\%(\d\+%\?[^)]*\)\{3})', + \ function("s:ColorRGBValues"), 'colorizer_rgb', 1 ], + \ 'rgba': ['rgba(\s*\%(\d\+%\?\D*\)\{3}\%(\%(0\?\%(.\d\+\)\?\)\|1\))', + \ function("s:ColorRGBValues"), 'colorizer_rgba', 1 ], + \ 'hsla': ['hsla\=(\s*\%(\d\+%\?\D*\)\{3,4})', + \ function("s:ColorRGBValues"), 'colorizer_hsla', 1 ], + \ 'vimcolors': ['\%(gui[fb]g\|cterm[fb]g\)\s*=\s*\<\%(\d\+\|#\x\{6}\|\w\+\)\>', + \ function("s:PreviewVimColors"), 'colorizer_vimcolors', '&ft ==# "vim"' ], + \ 'vimhighlight': ['^\s*\%(\%[Html]HiLink\s\+\w\+\s\+\w\+\)\|'. + \ '\(^\s*hi\%[ghlight]!\?\s\+\(clear\)\@!\S\+.*\)', + \ function("s:PreviewVimHighlight"), 'colorizer_vimhighlight', '&ft ==# "vim"' ], + \ 'taskwarrior': ['^color[^=]*=\zs.\+$', + \ function("s:PreviewTaskWarriorColors"), 'colorizer_taskwarrior', 'expand("%:e") ==# "theme"' ], + \ 'hex': [join(s:hex_pattern, ''), function("s:PreviewColorHex"), 'colorizer_hex', 1], + \ 'vimhighlight_dump': ['^\v\w+\s+xxx%((\s+(term|cterm%([bf]g)?|gui%(%([bf]g|sp))?'. + \ ')\=[#0-9A-Za-z_,]+)+)?%(\_\s+links to \w+)?%( cleared)@!', + \ function("s:PreviewVimHighlightDump"), 'colorizer_vimhighlight_dump', 'empty(&ft)' ] + \ } + + let s:color_patterns_special = { + \ 'term': ['\%(\%x1b\[0m\)\?\(\%(\%x1b\[\d\+\%(;\d\+\)*m\)\+\)\([^\e]*\)\(\%x1b\[0m\)\=', + \ function("s:PreviewColorTerm"), 'colorizer_term'], + \ 'term_conceal': ['\(\%(\%x1b\[0m\)\?\%x1b\[\d\+\%(;\d\+\)*m\)', '', + \ 'colorizer_term_conceal' ] } + + if exists("s:colornamepattern") && s:color_names + let s:color_patterns["colornames"] = [ s:colornamepattern, + \ function("s:PreviewColorName"), 'colorizer_names', 1] + endif +endfu + +function! s:SwapColors(list) "{{{1 + if empty(a:list[0]) && empty(a:list[1]) + return a:list + elseif s:swap_fg_bg > 0 + return [a:list[1]] + ['NONE'] + elseif s:swap_fg_bg == -1 + return [a:list[1], a:list[0]] + else + return a:list + endif +endfu + +function! s:FGforBG(bg) "{{{1 + " takes a 6hex color code and returns a matching color that is visible + let fgc = g:colorizer_fgcontrast + if fgc == -1 + return a:bg + endif + if a:bg ==# 'NONE' + return (&bg==#'dark' ? s:predefined_fgcolors['dark'][fgc] : s:predefined_fgcolors['light'][fgc]) + endif + let r = '0x'.a:bg[0:1]+0 + let g = '0x'.a:bg[2:3]+0 + let b = '0x'.a:bg[4:5]+0 + if r*30 + g*59 + b*11 > 12000 + return s:predefined_fgcolors['dark'][fgc] + else + return s:predefined_fgcolors['light'][fgc] + end +endfunction + +function! s:DidColor(clr, pat) "{{{1 + let idx = index(w:match_list, a:pat) + if idx > -1 + let attr = SynID(a:clr) + if (!empty(attr) && get(w:match_list, idx) ==# a:pat) + return 1 + endif + endif + return 0 +endfu + +function! s:DoHlGroup(group, Dict) "{{{1 + if !s:force_hl + let syn = SynID(a:group) + if !empty(syn) + " highlighting already exists + return + endif + endif + + if empty(a:Dict) + " try to link the given highlight group + call s:Exe("hi link ". a:group. " ". matchstr(a:group, 'Color_\zs.*')) + return + endif + + let hi = printf('hi %s ', a:group) + let fg = get(a:Dict, 'fg', '') + let bg = get(a:Dict, 'bg', '') + let [fg, bg] = s:SwapColors([fg, bg]) + + if !empty(fg) && fg[0] !=# '#' && fg !=# 'NONE' + let fg='#'.fg + endif + if !empty(bg) && bg[0] !=# '#' && bg !=# 'NONE' + let bg='#'.bg + endif + if !empty(fg) + let hi .= printf('guifg=%s', fg) + endif + if has_key(a:Dict, "gui") + let hi.=printf(" gui=%s ", a:Dict['gui']) + endif + if has_key(a:Dict, "guifg") + let hi.=printf(" guifg=%s ", a:Dict['guifg']) + endif + if !empty(bg) + let hi .= printf(' guibg=%s', bg) + endif + let hi .= printf('%s', !empty(get(a:Dict, 'special', '')) ? + \ (' gui='. a:Dict.special) : '') + if !has("gui_running") + let fg = get(a:Dict, 'ctermfg', '') + let bg = get(a:Dict, 'ctermbg', '') + let [fg, bg] = s:SwapColors([fg, bg]) + if !empty(string(bg)) && !empty(string(fg)) + let hi.= printf(' ctermfg=%s ctermbg=%s', fg, bg) + endif + let hi .= printf('%s', !empty(get(a:Dict, 'special','')) ? + \ (' cterm='. a:Dict.special) : '') + if has_key(a:Dict, "term") + let hi.=printf(" term=%s ", a:Dict['term']) + endif + if has_key(a:Dict, "cterm") + let hi.=printf(" cterm=%s ", a:Dict['cterm']) + endif + endif + call s:Exe(hi) +endfunction + +function! s:Exe(stmt) "{{{1 + "Don't error out for invalid colors + try + exe a:stmt + catch + " Only report errors, when debugging info is turned on + if s:debug + call s:Warn("Invalid statement: ".a:stmt) + endif + endtry +endfu + +function! s:SynID(group, ...) + let property = exists("a:1") ? a:1 : 'fg' + let c1 = synIDattr(synIDtrans(hlID(a:group)), property) + " since when can c1 be negative? Is this a vim bug? + " it used to be empty on errors or non-existing properties... + if empty(c1) || c1 < 0 + return '' + else + return c1 +endfu + +function! s:GenerateColors(dict) "{{{1 + let result=copy(a:dict) + + if !has_key(result, 'bg') && has_key(result, 'ctermbg') + let result.bg = s:Term2RGB(result.ctermbg) + endif + if !has_key(result, 'fg') && has_key(result, 'ctermfg') + let result.fg = s:Term2RGB(result.ctermfg) + endif + + if !has_key(result, 'fg') && + \ has_key(result, 'bg') + let result.fg = toupper(s:FGforBG(result.bg)) + endif + if !has("gui_running") + " need to make sure, we have ctermfg/ctermbg values + if !has_key(result, 'ctermfg') && + \ has_key(result, 'fg') + let result.ctermfg = s:Rgb2xterm(result.fg) + endif + if !has_key(result, 'ctermbg') && + \ has_key(result, 'bg') + let result.ctermbg = s:Rgb2xterm(result.bg) + endif + endif + return result +endfunction + +function! s:SetMatcher(pattern, Dict) "{{{1 + let param = s:GenerateColors(a:Dict) + let clr = get(param, 'name', '') + if empty(clr) + let clr = 'Color_'. get(param, 'fg'). '_'. get(param, 'bg'). + \ (!empty(get(param, 'special', '')) ? + \ ('_'. get(param, 'special')) : '') + endif + call s:SetMatch(clr, a:pattern, param) +endfunction + +function! s:SetMatch(group, pattern, param_dict) "{{{1 + call s:DoHlGroup(a:group, a:param_dict) + if s:DidColor(a:group, a:pattern) + return + endif + " let 'hls' overrule our syntax highlighting + call matchadd(a:group, a:pattern, s:default_match_priority) + call add(w:match_list, a:pattern) +endfunction + + +function! s:Xterm2rgb16(color) "{{{1 + " 16 basic colors + let r=0 + let g=0 + let b=0 + let r = s:basic16[a:color][0] + let g = s:basic16[a:color][1] + let b = s:basic16[a:color][2] + return [ r, g, b ] +endfunction + +function! s:Xterm2rgb88(color) "{{{1 + " 16 basic colors + let r=0 + let g=0 + let b=0 + if a:color < 16 + return s:Xterm2rgb16(a:color) + + " 4x4x4 color cube + elseif a:color >= 16 && a:color < 80 + let color=a:color-16 + let r = s:valuerange4[(color/16)%4] + let g = s:valuerange4[(color/4)%4] + let b = s:valuerange4[color%4] + " gray tone + elseif a:color >= 80 && a:color <= 87 + let color = (a:color-80) + 0.0 + let r = 46.36363636 + color * 23.18181818 + + \ (color > 0.0 ? 23.18181818 : 0.0) + 0.0 + let r = float2nr(r) + let g = r + let b = r + endif + + let rgb=[r,g,b] + return rgb +endfunction + +function! s:Xterm2rgb256(color) "{{{1 + " 16 basic colors + let r=0 + let g=0 + let b=0 + if a:color < 16 + return s:Xterm2rgb16(a:color) + + " color cube color + elseif a:color >= 16 && a:color < 232 + let color=a:color-16 + let r = s:valuerange6[(color/36)%6] + let g = s:valuerange6[(color/6)%6] + let b = s:valuerange6[color%6] + + " gray tone + elseif a:color >= 232 && a:color <= 255 + let r = 8 + (a:color-232) * 0x0a + let g = r + let b = r + endif + let rgb=[r,g,b] + return rgb +endfunction + +function! s:RoundColor(...) "{{{1 + let result = [] + let minlist = [] + let min = 1000 + let list = (&t_Co == 256 ? s:valuerange6 : s:valuerange4) + if &t_Co > 16 + for item in a:000 + for val in list + let t = abs(val - item) + if (min > t) + let min = t + let r = val + endif + endfor + call add(result, r) + call add(minlist, min) + let min = 1000 + endfor + endif + if &t_Co <= 16 + let result = [ a:1, a:2, a:3 ] + let minlist = [ 255, 255, 255 ] + endif + " Check with the values from the 16 color xterm, if the difference + " is lower + let result = s:Check16ColorTerm(result, minlist) + return result +endfunction + +function! s:Check16ColorTerm(rgblist, minlist) "{{{1 +" We only check those values for 256 color terminals here: +" [205,0,0] [0,205,0] [205,205,0] [205,0,205] +" [0,205,205] [0,0,238] [92,92,255] +" The other values are already included in the s:colortable list + let min = a:minlist[0] + a:minlist[1] + a:minlist[2] + if &t_Co == 256 + for value in [[205,0,0], [0,205,0], [205,205,0], [205,0,205], + \ [0,205,205], [0,0,238], [92,92,255]] + " euclidian distance would be needed, + " but this works good enough and is faster. + let t = abs(value[0] - a:rgblist[0]) + + \ abs(value[1] - a:rgblist[1]) + + \ abs(value[2] - a:rgblist[2]) + if min > t + return value + endif + endfor + elseif &t_Co == 88 + for value in [[0,0,238], [229,229,229], [127,127,127], [92,92,255]] + let t = abs(value[0] - a:rgblist[0]) + + \ abs(value[1] - a:rgblist[1]) + + \ abs(value[2] - a:rgblist[2]) + if min > t + return value + endif + endfor + else " 16 color terminal + " Check for values from 16 color terminal + let best = [] + let min = 100000 + let list = (&t_Co == 16 ? s:basic16 : s:basic16[:7]) + for value in list + let t = abs(value[0] - a:rgblist[0]) + + \ abs(value[1] - a:rgblist[1]) + + \ abs(value[2] - a:rgblist[2]) + if min > t + let min = t + let best = value + endif + endfor + return best + endif + return a:rgblist +endfunction + +function! s:Ansi2Color(chars) "{{{1 + " chars look like this + "  + if !exists("s:term2ansi") + let s:term2ansi = {} + " Color values taken from + " https://en.wikipedia.org/wiki/ANSI_escape_code#Colors + let s:term2ansi.std = { 30: printf("%.2X%.2X%.2X", 0, 0, 0), + \ 31: printf("%.2X%.2X%.2X", 205, 0, 0), + \ 32: printf("%.2X%.2X%.2X", 0, 205, 0), + \ 33: printf("%.2X%.2X%.2X", 205, 205, 0), + \ 34: printf("%.2X%.2X%.2X", 0, 0, 238), + \ 35: printf("%.2X%.2X%.2X", 205, 0, 205), + \ 36: printf("%.2X%.2X%.2X", 0, 205, 205), + \ 37: printf("%.2X%.2X%.2X", 229, 229, 229) + \ } + let s:term2ansi.bold = { 30: printf("%.2X%.2X%.2X", 127, 127, 127), + \ 31: printf("%.2X%.2X%.2X", 255, 0, 0), + \ 32: printf("%.2X%.2X%.2X", 0, 255, 0), + \ 33: printf("%.2X%.2X%.2X", 255, 255, 0), + \ 34: printf("%.2X%.2X%.2X", 92, 92, 255), + \ 35: printf("%.2X%.2X%.2X", 255, 0, 255), + \ 36: printf("%.2X%.2X%.2X", 0, 255, 255), + \ 37: printf("%.2X%.2X%.2X", 255, 255, 255) + \ } + endif + + let fground = "" + let bground = "" + let check = [0,0] " check fground and bground color + + if a:chars=~ '.*3[0-7]\(;1\)\?[m;]' + let check[0] = 1 + else + let fground = "NONE" + endif + if a:chars=~ '.*4[0-7]\(;1\)\?[m;]' + let check[1] = 1 + else + let bground = "NONE" + endif + + for val in ["std", "bold"] + for key in keys(s:term2ansi[val]) + let bright = (val == "std" ? "" : ";1") + + if check[0] " Check for a match of the foreground color + if a:chars =~ ".*".key.bright."[m;]" + let fground = s:term2ansi[val][key] + endif + endif + if check[1] "Check for background color + if a:chars =~ ".*".(key+10).bright."[m;]" + let bground = s:term2ansi[val][key] + endif + endif + if !empty(bground) && !empty(fground) + break + endif + endfor + if !empty(fground) && !empty(bground) + break + endif + endfor + return [fground, bground] +endfunction + +function! s:TermConceal(pattern) "{{{1 + if has("conceal") + exe "syn match ColorTermESC /". a:pattern. "/ conceal containedin=ALL" + setl cocu=nv cole=2 + endif +endfu +function! s:GetColorPattern(list) "{{{1 + let list = map(copy(a:list), ' ''\%(-\@-\@!\)'' ') + " Force the old re engine. It should be faster without backtracking. + return '\%#=1'.join(list, '\|') +endfunction + +function! s:GetMatchList() "{{{1 + " this is window-local! + return filter(getmatches(), 'v:val.group =~ ''^\(Color_\w\+\)\|NONE''') +endfunction + +function! s:CheckTimeout(pattern, force) "{{{1 + " Abort, if pattern is not found within 100 ms and force + " is not set + return (!empty(a:force) || search(a:pattern, 'cnw', '', 100)) +endfunction + +function! s:SaveRestoreOptions(save, dict, list) "{{{1 + if a:save + return s:SaveOptions(a:list) + else + for [key, value] in items(a:dict) + if key !~ '@' + call setbufvar('', '&'. key, value) + else + call call('setreg', [key[1]] + value) + endif + unlet value + endfor + endif +endfun + +function! s:SaveOptions(list) "{{{1 + let save = {} + for item in a:list + if item !~ '^@' + exe "let save.". item. " = &l:". item + else + let save[item] = [] + call add(save[item], getreg(item[1])) + call add(save[item], getregtype(item)) + endif + if item == 'ma' && !&l:ma + setl ma + elseif item == 'ro' && &l:ro + setl noro + elseif item == 'lz' && &l:lz + setl lz + elseif item == 'ed' && &g:ed + setl noed + elseif item == 'gd' && &g:gd + setl nogd + endif + endfor + return save +endfunction + +function! s:StripParentheses(val) "{{{1 + return split(matchstr(a:val, '^\(hsl\|rgb\)a\?\s*(\zs[^)]*\ze)'), '\s*,\s*') +endfunction + +function! s:ApplyAlphaValue(rgb) "{{{1 + " Add Alpha Value to RGB values + let bg = SynID('Normal', 'bg') + if empty(bg) || !has('float') + return a:rgb[0:3] + else + if (bg =~? '\d\{1,3}') && bg < 256 + " Xterm color code + let bg = '.'.join(s:colortable[bg]) + endif + let rgb = [] + let bg_ = split(bg[1:], '..\zs') + let alpha = str2float(a:rgb[3]) + if alpha > 1 + let alpha = 1 + 0.0 + elseif alpha < 0 + let alpha = 0 + 0.0 + endif + let i = 0 + for value in a:rgb[0:2] + let value += 0 " convert to nr + let value = float2nr(ceil(value * alpha) + ceil((bg_[i]+0)*(1-alpha))) + if value > 255 + let value = 255 + elseif value < 0 + let value = 0 + endif + call add(rgb, value) + let i+=1 + unlet value " reset type of value + endfor + return rgb + endif +endfunction + +function! s:ColorRGBValues(val) "{{{1 + if IsInComment() + " skip coloring comments + return + endif + " strip parantheses and split on comma + let rgb = s:StripParentheses(a:val) + if empty(rgb) + call s:Warn("Error in expression". a:val. "! Please report as bug.") + return + endif + for i in range(3) + if rgb[i][-1:-1] == '%' + let val = matchstr(rgb[i], '\d\+') + if (val + 0 > 100) + let rgb[1] = 100 + endif + let rgb[i] = float2nr((val + 0.0)*255/100) + else + if rgb[i] + 0 > 255 + let rgb[i] = 255 + endif + endif + endfor + if len(rgb) == 4 + " drop alpha channel + " call remove(rgb, 3) + let rgb = s:ApplyAlphaValue(rgb) + endif + let clr = printf("%02X%02X%02X", rgb[0],rgb[1],rgb[2]) + call s:SetMatcher(a:val, {'bg': clr}) +endfunction + +function! s:ColorHSLValues(val) "{{{1 + if IsInComment() + " skip coloring comments + return + endif + " strip parantheses and split on comma + let hsl = s:StripParentheses(a:val) + if empty(hsl) + call s:Warn("Error in expression". a:val. "! Please report as bug.") + return + endif + let str = s:PrepareHSLArgs(hsl) + + call s:SetMatcher(a:val, {'bg': str}) + return +endfu + +function! s:HSL2RGB(h, s, l) "{{{1 + let s = a:s + 0.0 + let l = a:l + 0.0 + if l <= 0.5 + let m2 = l * (s + 1) + else + let m2 = l + s - l * s + endif + let m1 = l * 2 - m2 + let r = float2nr(s:Hue2RGB(m1, m2, a:h + 120)) + let g = float2nr(s:Hue2RGB(m1, m2, a:h)) + let b = float2nr(s:Hue2RGB(m1, m2, a:h - 120)) + return printf("%02X%02X%02X", r, g, b) +endfunction + +function! s:Hue2RGB(m1, m2, h) "{{{1 + let h = (a:h + 0.0)/360 + if h < 0 + let h = h + 1 + elseif h > 1 + let h = h - 1 + endif + if h * 6 < 1 + let res = a:m1 + (a:m2 - a:m1) * h * 6 + elseif h * 2 < 1 + let res = a:m2 + elseif h * 3 < 2 + let res = a:m1 + (a:m2 - a:m1) * (2.0/3.0 - h) * 6 + else + let res = a:m1 + endif + return round(res * 255) +endfunction + +function! s:Rgb2xterm(color) "{{{1 +" selects the nearest xterm color for a rgb value like #FF0000 +" hard code values for 000000 and FFFFFF, they will be called many times +" so make this fast + if a:color ==# 'NONE' + return 'NONE' + endif + if len(a:color) <= 3 + " a:color is already a terminal color + return a:color + endif + if !exists("s:colortable") + call s:ColorInit('') + endif + let color = (a:color[0] == '#' ? a:color[1:] : a:color) + if ( color == '000000') + return 0 + elseif (color == 'FFFFFF') + return 15 + else + let r = '0x'.color[0:1]+0 + let g = '0x'.color[2:3]+0 + let b = '0x'.color[4:5]+0 + + " Try exact match first + let i = index(s:colortable, [r, g, b]) + if i > -1 + return i + endif + + " Grey scale ? + if ( r == g && r == b ) + if &t_Co == 256 + " 0 and 15 have already been take care of + if r < 5 + return 0 " black + elseif r > 244 + return 15 " white + endif + " grey cube starts at index 232 + return 232+(r-5)/10 + elseif &t_Co == 88 + if r < 23 + return 0 " black + elseif r < 69 + return 80 + elseif r > 250 + return 15 " white + else + " should be good enough + return 80 + (r-69)/23 + endif + endif + endif + + " Round to the next step in the xterm color cube + " euclidian distance would be needed, + " but this works good enough and is faster. + let round = s:RoundColor(r, g, b) + " Return closest match or -1 if not found + return index(s:colortable, round) + endif +endfunction + +function! s:Warn(msg) "{{{1 + let msg = 'Colorizer: '. a:msg + echohl WarningMsg + echomsg msg + echohl None + let v:errmsg = msg +endfu + +function! s:LoadSyntax(file) "{{{1 + unlet! b:current_syntax + exe "sil! ru! syntax/".a:file. ".vim" +endfu +function! s:HasColorPattern() "{{{1 + let _pos = winsaveview() + try + if !exists("s:colornamepattern") + let s:colornamepattern = s:GetColorPattern(keys(s:colors)) + endif + let pattern = values(s:color_patterns) + [s:colornamepattern] + call cursor(1,1) + for pat in pattern + if s:CheckTimeout(pat, '') + return 1 + endif + endfor + return 0 + + finally + call winrestview(_pos) + endtry +endfunction + +function! s:PrepareHSLArgs(list) "{{{1 + let hsl=a:list + if len(hsl) == 4 + " drop alpha channel + call remove(hsl, 3) + endif + let hsl[0] = (matchstr(hsl[0], '\d\+') + 360)%360 + let hsl[1] = (matchstr(hsl[1], '\d\+') + 0.0)/100 + let hsl[2] = (matchstr(hsl[2], '\d\+') + 0.0)/100 + return s:HSL2RGB(hsl[0], hsl[1], hsl[2]) +endfu +function! s:SyntaxMatcher(enable) "{{{1 + if !a:enable + return + endif + let did_clean = {} + for hi in s:GetMatchList() + if !get(did_clean, hi.group, 0) + let did_clean[hi.group] = 1 + exe "sil! syn clear" hi.group + endif + if a:enable + exe "syn match" hi.group "excludenl /". hi.pattern. "/ display containedin=ALL" + " We have syntax highlighting, can clear the matching + " ignore errors (just in case) + sil! call matchdelete(hi.id) + endif + endfor +endfu + +function! Colorizer#ColorToggle() "{{{1 + if !exists("w:match_list") || empty(w:match_list) + call Colorizer#DoColor(0, 1, line('$')) + else + call Colorizer#ColorOff() + endif +endfu + +function! Colorizer#ColorOff() "{{{1 + for _match in s:GetMatchList() + sil! call matchdelete(_match.id) + endfor + call Colorizer#LocalFTAutoCmds(0) + if exists("s:conceal") && has("conceal") + let [&l:cole, &l:cocu] = s:conceal + endif + unlet! w:match_list s:conceal +endfu + +function! Colorizer#DoColor(force, line1, line2, ...) "{{{1 + " initialize plugin + try + if v:version < 704 + call s:Warn("Colorizer needs Vim 7.4") + return + endif + call s:ColorInit(a:force) + if exists("a:1") && !empty(a:1) + let s:color_syntax = ( a:1 =~# '^\%(syntax\|nomatch\)$' ) + endif + catch /nocolor/ + " nothing to do + call s:Warn("Your terminal doesn't support colors or no colors". + \ 'found in the current buffer!') + return + endtry + let error = "" + + let _a = winsaveview() + let save = s:SaveRestoreOptions(1, {}, + \ ['mod', 'ro', 'ma', 'lz', 'ed', 'gd', '@/']) + + " highlight Hex Codes: + " + " The :%s command is a lot faster than this: + ":g/#\x\{3,6}\>/call s:ColorMatchingLines(line('.')) + " Should color #FF0000 + " #F0F + " #FFF + " + if &t_Co > 16 || has("gui_running") + " Also support something like + " CSS rgb(255,0,0) + " rgba(255,0,0,1) + " rgba(255,0,0,0.8) + " rgba(255,0,0,0.2) + " rgb(10%,0,100%) + " hsl(0,100%,50%) -> hsl2rgb conversion RED + " hsla(120,100%,50%,1) Lime + " hsl(120,100%,25%) Darkgreen + " hsl(120, 100%, 75%) lightgreen + " hsl(120, 75%, 75%) pastelgreen + " highlight rgb(X,X,X) values + for Pat in values(s:color_patterns) + if !get(g:, Pat[2], 1) || (get(s:, Pat[2]. '_disable', 0) > 0) + " Coloring disabled + continue + endif + + " 4th element in pattern is condition, that must be fullfilled, + " before we continue + if !empty(Pat[3]) && !eval(Pat[3]) + continue + endif + + " Check, the pattern isn't too costly... + if s:CheckTimeout(Pat[0], a:force) && !s:IsInComment() + let cmd = printf(':sil %s %d,%d%ss/%s/'. + \ '\=call(Pat[1], [submatch(0)])/egin', + \ (s:keeppatterns ? "keeppatterns" : ''), + \ a:line1, a:line2, + \ s:color_unfolded, Pat[0]) + try + if Pat[2] ==# 'colorizer_vimhighlight' && has('windows') + \ && has('syntax') && !empty(bufname('')) + " try to load the corresponding syntax file so the syntax + " groups will be defined + let s:extension = fnamemodify(expand('%'), ':t:r') + let s:old_syntax = exists("b:current_syntax") ? b:current_syntax : '' + call s:LoadSyntax(s:extension) + endif + + exe cmd + + if s:stop + break + endif + + catch + " some error occured, stop when finished (and don't setup auto + " comands + let error.=" Colorize: ". string(Pat) + break + + finally + if exists("s:extension") + call s:LoadSyntax(&ft) + unlet! s:extension + endif + endtry + endif + endfor + endif + + for Pat in [ s:color_patterns_special.term ] + if (s:CheckTimeout(Pat[0], a:force)) && !s:IsInComment() + + if !get(g:, Pat[2], 1) || (get(s:, Pat[2]. '_disable', 0) > 0) + " Coloring disabled + continue + endif + + let cmd = printf(':sil %s %d,%d%ss/%s/'. + \ '\=call(Pat[1],[submatch(1),submatch(2),submatch(3)])/egin', + \ (s:keeppatterns ? "keeppatterns" : ''), + \ a:line1, a:line2, s:color_unfolded, Pat[0]) + try + exe cmd + " Hide ESC Terminal Chars + call s:TermConceal(s:color_patterns_special.term_conceal[0]) + catch + " some error occured, stop when finished (and don't setup auto + " comands + let error=" ColorTerm " + break + endtry + endif + endfor + + " convert matches into synatx highlighting, so TOhtml can display it + " correctly + call s:SyntaxMatcher(s:color_syntax) + if !exists("#FTColorizer#BufWinEnter#") && empty(error) + " Initialise current window. + call Colorizer#LocalFTAutoCmds(1) + call Colorizer#ColorWinEnter(1) + endif + if !empty(error) + " Some error occured, stop trying to color the file + call Colorizer#ColorOff() + call s:Warn("Some error occured here: ". error) + endif + call s:SaveRestoreOptions(0, save, []) + call winrestview(_a) +endfu + +function! Colorizer#RGB2Term(arg) "{{{1 + if a:arg =~ '^rgb' + let clr = s:StripParentheses(a:arg) + let color = printf("#%02X%02X%02X", clr[0], clr[1], clr[2]) + else + let color = a:arg[0] == '#' ? a:arg : '#'.a:arg + endif + + let tcolor = s:Rgb2xterm(color) + call s:DoHlGroup("Color_". color[1:], s:GenerateColors({'bg': color[1:]})) + exe "echohl" "Color_".color[1:] + echo a:arg. " => ". tcolor + echohl None +endfu + +function! Colorizer#Term2RGB(arg) "{{{1 + let index = a:arg + 0 + if a:arg > 255 || a:arg < 0 + call s:Warn('invalid index') + return + endif + + let _t_Co=&t_Co + let &t_Co = 256 + call s:ColorInit(1) + + let rgb = s:Term2RGB(index) + call s:DoHlGroup("Color_". rgb, s:GenerateColors({'bg': rgb, 'ctermbg': index})) + exe "echohl" "Color_".rgb + echo "TerminalColor: ". a:arg. " => ". rgb + echohl None + let &t_Co = _t_Co +endfu + + +function! Colorizer#HSL2Term(arg) "{{{1 + let hsl = s:StripParentheses(a:arg) + if empty(hsl) + call s:Warn("Error evaluating expression". a:val. "! Please report as bug.") + return a:val + endif + let str = s:PrepareHSLArgs(hsl) + + let tcolor = s:Rgb2xterm('#'.str) + call s:DoHlGroup("Color_".str, s:GenerateColors({'bg': str})) + exe "echohl" str + echo a:arg. " => ". tcolor + echohl None +endfu + +function! Colorizer#AutoCmds(enable) "{{{1 + if a:enable + aug Colorizer + au! + au CursorHold,CursorHoldI,InsertLeave * silent call + \ Colorizer#DoColor('', line('w0'), line('w$')) + "au GUIEnter,BufWinEnter * silent call + " \ Colorizer#DoColor('', 1, line('$')) + au GUIEnter * silent call Colorizer#DoColor('!', 1, line('$')) + au WinEnter,BufWinEnter * silent call Colorizer#ColorWinEnter() + au ColorScheme * silent call Colorizer#DoColor('!', 1, line('$')) + if get(g:, 'colorizer_cursormoved', 0) + au CursorMoved,CursorMovedI * call Colorizer#ColorLine() + endif + aug END + else + aug Colorizer + au! + aug END + aug! Colorizer + endif +endfu + +function! Colorizer#LocalFTAutoCmds(enable) "{{{1 + if a:enable + aug FTColorizer + au! + au CursorHold,CursorHoldI,InsertLeave silent call + \ Colorizer#DoColor('', line('w0'), line('w$')) + au CursorMoved,CursorMovedI call Colorizer#ColorLine() + au WinEnter,BufWinEnter silent call Colorizer#ColorWinEnter() + au GUIEnter,ColorScheme silent + \ call Colorizer#DoColor('!', 1, line('$')) + aug END + if !exists("b:undo_ftplugin") + " simply unlet a dummy variable + let b:undo_ftplugin = 'unlet! b:Colorizer_foobar' + endif + " Delete specific auto commands, because the filetype + " has been changed. + let b:undo_ftplugin .= '| exe "sil! au! FTColorizer"' + let b:undo_ftplugin .= '| exe "sil! aug! FTColorizer"' + let b:undo_ftplugin .= '| exe ":ColorClear"' + else + aug FTColorizer + au! + aug END + aug! FTColorizer + endif +endfu + +function! Colorizer#ColorWinEnter(...) "{{{1 + let force = a:0 ? a:1 : 0 + " be fast! + if !force + let ft_list = split(get(g:, "colorizer_auto_filetype", ""), ',') + if match(ft_list, "^".&ft."$") == -1 + " current filetype doesn't match g:colorizer_auto_filetype, + " so nothing to do + return + endif + if get(b:, 'Colorizer_changedtick', 0) == b:changedtick && + \ !empty(getmatches()) + " nothing to do + return + endif + endif + let g:colorizer_only_unfolded = 1 + let _c = getpos('.') + call Colorizer#DoColor('', 1, line('$')) + let b:Colorizer_changedtick = b:changedtick + unlet! g:colorizer_only_unfolded + call setpos('.', _c) +endfu + +function! Colorizer#ColorLine() "{{{1 + if get(b:, 'Colorizer_changedtick', 0) == b:changedtick + " nothing to do + return + else + call Colorizer#DoColor('', line('.'),line('.')) + let b:Colorizer_changedtick = b:changedtick + endif +endfu + +function! Colorizer#SwitchContrast() "{{{1 + if exists("s:swap_fg_bg") && s:swap_fg_bg + call s:Warn('Contrast Adjustment does not work with swapped foreground colors!') + return + endif + " make sure, g:colorizer_fgcontrast is set up + if !exists('g:colorizer_fgcontrast') + " Default to black / white + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 + endif + let g:colorizer_fgcontrast-=1 + if g:colorizer_fgcontrast < -1 + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 + endif + echom 'Colorizer: using fgcontrast' g:colorizer_fgcontrast + call Colorizer#DoColor(1, 1, line('$')) +endfu + +function! Colorizer#SwitchFGBG() "{{{1 + let range = [ 0, 1, -1 ] + if !exists("s:round") + let s:round = 0 + else + let s:round = (s:round >= 2 ? 0 : s:round+1) + endif + let s:swap_fg_bg = range[s:round] + call Colorizer#DoColor(1, 1, line('$')) +endfu + +" DEBUG TEST "{{{1 +if !s:debug + let &cpo = s:cpo_save + unlet s:cpo_save + finish +endif + +fu! Test1() "{{{2 + return map(range(0,254), 's:Xterm2rgb256(v:val)') +endfu +" +fu! Test2() "{{{2 + let list=[] + for c in range(0, 254) + let css_color = s:Xterm2rgb256(c) + call add(list, css_color) + endfor + return list +endfu + +" Plugin folklore and Vim Modeline " {{{1 +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: set foldmethod=marker et fdl=0: diff --git a/config/old/vim/autoload/plug.vim b/config/old/vim/autoload/plug.vim new file mode 100644 index 0000000..652caa8 --- /dev/null +++ b/config/old/vim/autoload/plug.vim @@ -0,0 +1,2812 @@ +" vim-plug: Vim plugin manager +" ============================ +" +" Download plug.vim and put it in ~/.vim/autoload +" +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" +" Edit your .vimrc +" +" call plug#begin('~/.vim/plugged') +" +" " Make sure you use single quotes +" +" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align +" Plug 'junegunn/vim-easy-align' +" +" " Any valid git URL is allowed +" Plug 'https://github.com/junegunn/vim-github-dashboard.git' +" +" " Multiple Plug commands can be written in a single line using | separators +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" +" " On-demand loading +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } +" +" " Using a non-default branch +" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } +" +" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) +" Plug 'fatih/vim-go', { 'tag': '*' } +" +" " Plugin options +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } +" +" " Plugin outside ~/.vim/plugged with post-update hook +" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +" +" " Unmanaged plugin (manually installed and updated) +" Plug '~/my-prototype-plugin' +" +" " Initialize plugin system +" call plug#end() +" +" Then reload .vimrc and :PlugInstall to install plugins. +" +" Plug options: +" +"| Option | Description | +"| ----------------------- | ------------------------------------------------ | +"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | +"| `rtp` | Subdirectory that contains Vim plugin | +"| `dir` | Custom directory for the plugin | +"| `as` | Use different name for the plugin | +"| `do` | Post-update hook (string or funcref) | +"| `on` | On-demand loading: Commands or ``-mappings | +"| `for` | On-demand loading: File types | +"| `frozen` | Do not update unless explicitly specified | +" +" More information: https://github.com/junegunn/vim-plug +" +" +" Copyright (c) 2017 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') +let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) +let s:vim8 = has('patch-8.0.0039') && exists('*job_start') +if s:is_win && &shellslash + set noshellslash + let s:me = resolve(expand(':p')) + set shellslash +else + let s:me = resolve(expand(':p')) +endif +let s:base_spec = { 'branch': '', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! s:is_powershell(shell) + return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$' +endfunction + +function! s:isabsolute(dir) abort + return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)') +endfunction + +function! s:git_dir(dir) abort + let gitdir = s:trim(a:dir) . '/.git' + if isdirectory(gitdir) + return gitdir + endif + if !filereadable(gitdir) + return '' + endif + let gitdir = matchstr(get(readfile(gitdir), 0, ''), '^gitdir: \zs.*') + if len(gitdir) && !s:isabsolute(gitdir) + let gitdir = a:dir . '/' . gitdir + endif + return isdirectory(gitdir) ? gitdir : '' +endfunction + +function! s:git_origin_url(dir) abort + let gitdir = s:git_dir(a:dir) + let config = gitdir . '/config' + if empty(gitdir) || !filereadable(config) + return '' + endif + return matchstr(join(readfile(config)), '\[remote "origin"\].\{-}url\s*=\s*\zs\S*\ze') +endfunction + +function! s:git_revision(dir) abort + let gitdir = s:git_dir(a:dir) + let head = gitdir . '/HEAD' + if empty(gitdir) || !filereadable(head) + return '' + endif + + let line = get(readfile(head), 0, '') + let ref = matchstr(line, '^ref: \zs.*') + if empty(ref) + return line + endif + + if filereadable(gitdir . '/' . ref) + return get(readfile(gitdir . '/' . ref), 0, '') + endif + + if filereadable(gitdir . '/packed-refs') + for line in readfile(gitdir . '/packed-refs') + if line =~# ' ' . ref + return matchstr(line, '^[0-9a-f]*') + endif + endfor + endif + + return '' +endfunction + +function! s:git_local_branch(dir) abort + let gitdir = s:git_dir(a:dir) + let head = gitdir . '/HEAD' + if empty(gitdir) || !filereadable(head) + return '' + endif + let branch = matchstr(get(readfile(head), 0, ''), '^ref: refs/heads/\zs.*') + return len(branch) ? branch : 'HEAD' +endfunction + +function! s:git_origin_branch(spec) + if len(a:spec.branch) + return a:spec.branch + endif + + " The file may not be present if this is a local repository + let gitdir = s:git_dir(a:spec.dir) + let origin_head = gitdir.'/refs/remotes/origin/HEAD' + if len(gitdir) && filereadable(origin_head) + return matchstr(get(readfile(origin_head), 0, ''), + \ '^ref: refs/remotes/origin/\zs.*') + endif + + " The command may not return the name of a branch in detached HEAD state + let result = s:lines(s:system('git symbolic-ref --short HEAD', a:spec.dir)) + return v:shell_error ? '' : result[-1] +endfunction + +if s:is_win + function! s:plug_call(fn, ...) + let shellslash = &shellslash + try + set noshellslash + return call(a:fn, a:000) + finally + let &shellslash = shellslash + endtry + endfunction +else + function! s:plug_call(fn, ...) + return call(a:fn, a:000) + endfunction +endif + +function! s:plug_getcwd() + return s:plug_call('getcwd') +endfunction + +function! s:plug_fnamemodify(fname, mods) + return s:plug_call('fnamemodify', a:fname, a:mods) +endfunction + +function! s:plug_expand(fmt) + return s:plug_call('expand', a:fmt, 1) +endfunction + +function! s:plug_tempname() + return s:plug_call('tempname') +endfunction + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif has('nvim') + let home = stdpath('data') . '/plugged' + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + if s:plug_fnamemodify(home, ':t') ==# 'plugin' && s:plug_fnamemodify(home, ':h') ==# s:first_rtp + return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call plug#() + if !executable('git') + return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') + endif + if has('win32') + \ && &shellslash + \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell)) + return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.') + endif + if !has('nvim') + \ && (has('win32') || has('win32unix')) + \ && !has('multi_byte') + return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) + command! -nargs=0 -bar -bang PlugClean call s:clean(0) + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:glob(from, pattern) + return s:lines(globpath(a:from, a:pattern)) +endfunction + +function! s:source(from, ...) + let found = 0 + for pattern in a:000 + for vim in s:glob(a:from, pattern) + execute 'source' s:esc(vim) + let found = 1 + endfor + endfor + return found +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! s:ask(message, ...) + call inputsave() + echohl WarningMsg + let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) + echohl None + call inputrestore() + echo "\r" + return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 +endfunction + +function! s:ask_no_interrupt(...) + try + return call('s:ask', a:000) + catch + return 0 + endtry +endfunction + +function! s:lazy(plug, opt) + return has_key(a:plug, a:opt) && + \ (empty(s:to_a(a:plug[a:opt])) || + \ !isdirectory(a:plug.dir) || + \ len(s:glob(s:rtp(a:plug), 'plugin')) || + \ len(s:glob(s:rtp(a:plug), 'after/plugin'))) +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('plug#end() called without calling plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + if get(g:, 'did_load_filetypes', 0) + filetype off + endif + for name in g:plugs_order + if !has_key(g:plugs, name) + continue + endif + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~# '^[A-Z]' + let cmd = substitute(cmd, '!*$', '', '') + if exists(':'.cmd) != 2 + call s:assoc(lod.cmd, cmd, name) + endif + call add(s:triggers[name].cmd, cmd) + else + call s:err('Invalid `on` option: '.cmd. + \ '. Should start with an uppercase letter or ``.') + endif + endfor + endif + + if has_key(plug, 'for') + let types = s:to_a(plug.for) + if !empty(types) + augroup filetypedetect + call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') + augroup END + endif + for type in types + call s:assoc(lod.ft, type, name) + endfor + endif + endfor + + for [cmd, names] in items(lod.cmd) + execute printf( + \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', + \ cmd, string(cmd), string(names)) + endfor + + for [map, names] in items(lod.map) + for [mode, map_prefix, key_prefix] in + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + execute printf( + \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) + endfor + endfor + + for [ft, names] in items(lod.ft) + augroup PlugLOD + execute printf('autocmd FileType %s call lod_ft(%s, %s)', + \ ft, string(ft), string(names)) + augroup END + endfor + + call s:reorg_rtp() + filetype plugin indent on + if has('vim_starting') + if has('syntax') && !exists('g:syntax_on') + syntax enable + end + else + call s:reload_plugins() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:load_plugin(spec) + call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') +endfunction + +function! s:reload_plugins() + for name in s:loaded_names() + call s:load_plugin(g:plugs[name]) + endfor +endfunction + +function! s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function! s:version_requirement(val, min) + for idx in range(0, len(a:min) - 1) + let v = get(a:val, idx, 0) + if v < a:min[idx] | return 0 + elseif v > a:min[idx] | return 1 + endif + endfor + return 1 +endfunction + +function! s:git_version_requirement(...) + if !exists('s:git_version') + let s:git_version = map(split(split(s:system(['git', '--version']))[2], '\.'), 'str2nr(v:val)') + endif + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) +endfunction + +if s:is_win + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction + + " Copied from fzf + function! s:wrap_cmds(cmds) + let cmds = [ + \ '@echo off', + \ 'setlocal enabledelayedexpansion'] + \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) + \ + ['endlocal'] + if has('iconv') + if !exists('s:codepage') + let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0) + endif + return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage)) + endif + return map(cmds, 'v:val."\r"') + endfunction + + function! s:batchfile(cmd) + let batchfile = s:plug_tempname().'.bat' + call writefile(s:wrap_cmds(a:cmd), batchfile) + let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0}) + if s:is_powershell(&shell) + let cmd = '& ' . cmd + endif + return [batchfile, cmd] + endfunction +else + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom '[vim-plug] '.a:msg + echohl None +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! s:doautocmd(...) + if exists('#'.join(a:000, '#')) + execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) + endif +endfunction + +function! s:dobufread(names) + for name in a:names + let path = s:rtp(g:plugs[name]) + for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin'] + if len(finddir(dir, path)) + if exists('#BufRead') + doautocmd BufRead + endif + return + endif + endfor + endfor +endfunction + +function! plug#load(...) + if a:0 == 0 + return s:err('Argument missing: plugin name(s) required') + endif + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000 + let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)') + if !empty(unknowns) + let s = len(unknowns) > 1 ? 's' : '' + return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) + end + let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)') + if !empty(unloaded) + for name in unloaded + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(unloaded) + return 1 + end + return 0 +endfunction + +function! s:remove_triggers(name) + if !has_key(s:triggers, a:name) + return + endif + for cmd in s:triggers[a:name].cmd + execute 'silent! delc' cmd + endfor + for map in s:triggers[a:name].map + execute 'silent! unmap' map + execute 'silent! iunmap' map + endfor + call remove(s:triggers, a:name) +endfunction + +function! s:lod(names, types, ...) + for name in a:names + call s:remove_triggers(name) + let s:loaded[name] = 1 + endfor + call s:reorg_rtp() + + for name in a:names + let rtp = s:rtp(g:plugs[name]) + for dir in a:types + call s:source(rtp, dir.'/**/*.vim') + endfor + if a:0 + if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) + execute 'runtime' a:1 + endif + call s:source(rtp, a:2) + endif + call s:doautocmd('User', name) + endfor +endfunction + +function! s:lod_ft(pat, names) + let syn = 'syntax/'.a:pat.'.vim' + call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) + execute 'autocmd! PlugLOD FileType' a:pat + call s:doautocmd('filetypeplugin', 'FileType') + call s:doautocmd('filetypeindent', 'FileType') +endfunction + +function! s:lod_cmd(cmd, bang, l1, l2, args, names) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) +endfunction + +function! s:lod_map(map, names, with_prefix, prefix) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + let extra = '' + while 1 + let c = getchar(0) + if c == 0 + break + endif + let extra .= nr2char(c) + endwhile + + if a:with_prefix + let prefix = v:count ? v:count : '' + let prefix .= '"'.v:register.a:prefix + if mode(1) == 'no' + if v:operator == 'c' + let prefix = "\" . prefix + endif + let prefix .= v:operator + endif + call feedkeys(prefix, 'n') + endif + call feedkeys(substitute(a:map, '^', "\", '') . extra) +endfunction + +function! plug#(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo), opts) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(repo . ' ' . v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)' + if type == s:TYPE.string + if empty(a:arg) + throw printf(opt_errfmt, 'tag', 'string') + endif + let opts.tag = a:arg + elseif type == s:TYPE.dict + for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as'] + if has_key(a:arg, opt) + \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt])) + throw printf(opt_errfmt, opt, 'string') + endif + endfor + for opt in ['on', 'for'] + if has_key(a:arg, opt) + \ && type(a:arg[opt]) != s:TYPE.list + \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt])) + throw printf(opt_errfmt, opt, 'string or list') + endif + endfor + if has_key(a:arg, 'do') + \ && type(a:arg.do) != s:TYPE.funcref + \ && (type(a:arg.do) != s:TYPE.string || empty(a:arg.do)) + throw printf(opt_errfmt, 'do', 'string or funcref') + endif + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(s:plug_expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(s:plug_expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } + endif +endfunction + +function! s:install(force, names) + call s:update_impl(0, a:force, a:names) +endfunction + +function! s:update(force, names) + call s:update_impl(1, a:force, a:names) +endfunction + +function! plug#helptags() + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + for spec in values(g:plugs) + let docd = join([s:rtp(spec), 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-\{1}\ / + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ + syn match plugTag /(tag: [^)]\+)/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag + syn match plugEdge /^ \X\+$/ + syn match plugEdge /^ \X*/ contained nextgroup=plugSha + syn match plugSha /[0-9a-f]\{7,9}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ + syn match plugH2 /^.*:\n-\+$/ + syn match plugH2 /^-\{2,}/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugH2 Type + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugDeleted Ignore + hi def link plugRelDate Comment + hi def link plugEdge PreProc + hi def link plugSha Identifier + hi def link plugTag Constant + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:finish_bindings() + nnoremap R :call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') +endfunction + +function! s:prepare(...) + if empty(s:plug_getcwd()) + throw 'Invalid current working directory. Cannot proceed.' + endif + + for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] + if exists(evar) + throw evar.' detected. Cannot proceed.' + endif + endfor + + call s:job_abort() + if s:switch_in() + if b:plug_preview == 1 + pc + endif + enew + else + call s:new_window() + endif + + nnoremap q :call close_pane() + if a:0 == 0 + call s:finish_bindings() + endif + let b:plug_preview = -1 + let s:plug_tab = tabpagenr() + let s:plug_buf = winbufnr(0) + call s:assign_name() + + for k in ['', 'L', 'o', 'X', 'd', 'dd'] + execute 'silent! unmap ' k + endfor + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell + if exists('+colorcolumn') + setlocal colorcolumn= + endif + setf vim-plug + if exists('g:syntax_on') + call s:syntax() + endif +endfunction + +function! s:close_pane() + if b:plug_preview == 1 + pc + let b:plug_preview = -1 + else + bd + endif +endfunction + +function! s:assign_name() + " Assign buffer name + let prefix = '[Plugins]' + let name = prefix + let idx = 2 + while bufexists(name) + let name = printf('%s (%s)', prefix, idx) + let idx = idx + 1 + endwhile + silent! execute 'f' fnameescape(name) +endfunction + +function! s:chsh(swap) + let prev = [&shell, &shellcmdflag, &shellredir] + if !s:is_win + set shell=sh + endif + if a:swap + if s:is_powershell(&shell) + let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s' + elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$' + set shellredir=>%s\ 2>&1 + endif + endif + return prev +endfunction + +function! s:bang(cmd, ...) + let batchfile = '' + try + let [sh, shellcmdflag, shrd] = s:chsh(a:0) + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let [batchfile, cmd] = s:batchfile(cmd) + endif + let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') + execute "normal! :execute g:_plug_bang\\" + finally + unlet g:_plug_bang + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win && filereadable(batchfile) + call delete(batchfile) + endif + endtry + return v:shell_error ? 'Exit status: ' . v:shell_error : '' +endfunction + +function! s:regress_bar() + let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') + call s:progress_bar(2, bar, len(bar)) +endfunction + +function! s:is_updated(dir) + return !empty(s:system_chomp(['git', 'log', '--pretty=format:%h', 'HEAD...HEAD@{1}'], a:dir)) +endfunction + +function! s:do(pull, force, todo) + for [name, spec] in items(a:todo) + if !isdirectory(spec.dir) + continue + endif + let installed = has_key(s:update.new, name) + let updated = installed ? 0 : + \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) + if a:force || installed || updated + execute 'cd' s:esc(spec.dir) + call append(3, '- Post-update hook for '. name .' ... ') + let error = '' + let type = type(spec.do) + if type == s:TYPE.string + if spec.do[0] == ':' + if !get(s:loaded, name, 0) + let s:loaded[name] = 1 + call s:reorg_rtp() + endif + call s:load_plugin(spec) + try + execute spec.do[1:] + catch + let error = v:exception + endtry + if !s:plug_window_exists() + cd - + throw 'Warning: vim-plug was terminated by the post-update hook of '.name + endif + else + let error = s:bang(spec.do) + endif + elseif type == s:TYPE.funcref + try + call s:load_plugin(spec) + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + catch + let error = v:exception + endtry + else + let error = 'Invalid hook type' + endif + call s:switch_in() + call setline(4, empty(error) ? (getline(4) . 'OK') + \ : ('x' . getline(4)[1:] . error)) + if !empty(error) + call add(s:update.errors, name) + call s:regress_bar() + endif + cd - + endif + endfor +endfunction + +function! s:hash_match(a, b) + return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 +endfunction + +function! s:checkout(spec) + let sha = a:spec.commit + let output = s:git_revision(a:spec.dir) + if !empty(output) && !s:hash_match(sha, s:lines(output)[0]) + let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : '' + let output = s:system( + \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir) + endif + return output +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') | 4 + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) + call add(msgs, "Press 'D' to see the updated changes.") + endif + echo join(msgs, ' ') + call s:finish_bindings() +endfunction + +function! s:retry() + if empty(s:update.errors) + return + endif + echo + call s:update_impl(s:update.pull, s:update.force, + \ extend(copy(s:update.errors), [s:update.threads])) +endfunction + +function! s:is_managed(name) + return has_key(g:plugs[a:name], 'uri') +endfunction + +function! s:names(...) + return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) +endfunction + +function! s:check_ruby() + silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") + if !exists('g:plug_ruby') + redraw! + return s:warn('echom', 'Warning: Ruby interface is broken') + endif + let ruby_version = split(g:plug_ruby, '\.') + unlet g:plug_ruby + return s:version_requirement(ruby_version, [1, 8, 7]) +endfunction + +function! s:update_impl(pull, force, args) abort + let sync = index(a:args, '--sync') >= 0 || has('vim_starting') + let args = filter(copy(a:args), 'v:val != "--sync"') + let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? + \ remove(args, -1) : get(g:, 'plug_threads', 16) + + let managed = filter(copy(g:plugs), 's:is_managed(v:key)') + let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : + \ filter(managed, 'index(args, v:key) >= 0') + + if empty(todo) + return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) + endif + + if !s:is_win && s:git_version_requirement(2, 3) + let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' + let $GIT_TERMINAL_PROMPT = 0 + for plug in values(todo) + let plug.uri = substitute(plug.uri, + \ '^https://git::@github\.com', 'https://github.com', '') + endfor + endif + + if !isdirectory(g:plug_home) + try + call mkdir(g:plug_home, 'p') + catch + return s:err(printf('Invalid plug directory: %s. '. + \ 'Try to call plug#begin with a valid directory', g:plug_home)) + endtry + endif + + if has('nvim') && !exists('*jobwait') && threads > 1 + call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') + endif + + let use_job = s:nvim || s:vim8 + let python = (has('python') || has('python3')) && !use_job + let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare(1) + call append(0, ['', '']) + normal! 2G + silent! redraw + + " Set remote name, overriding a possible user git config's clone.defaultRemoteName + let s:clone_opt = ['--origin', 'origin'] + if get(g:, 'plug_shallow', 1) + call extend(s:clone_opt, ['--depth', '1']) + if s:git_version_requirement(1, 7, 10) + call add(s:clone_opt, '--no-single-branch') + endif + endif + + if has('win32unix') || has('wsl') + call extend(s:clone_opt, ['-c', 'core.eol=lf', '-c', 'core.autocrlf=input']) + endif + + let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : '' + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 + redir => pyv + silent python import platform; print platform.python_version() + redir END + let python = s:version_requirement( + \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) + endif + + if (python || ruby) && s:update.threads > 1 + try + let imd = &imd + if s:mac_gui + set noimd + endif + if ruby + call s:update_ruby() + else + call s:update_python() + endif + catch + let lines = getline(4, '$') + let printed = {} + silent! 4,$d _ + for line in lines + let name = s:extract_name(line, '.', '') + if empty(name) || !has_key(printed, name) + call append('$', line) + if !empty(name) + let printed[name] = 1 + if line[0] == 'x' && index(s:update.errors, name) < 0 + call add(s:update.errors, name) + end + endif + endif + endfor + finally + let &imd = imd + call s:update_finish() + endtry + else + call s:update_vim() + while use_job && sync + sleep 100m + if s:update.fin + break + endif + endwhile + endif +endfunction + +function! s:log4(name, msg) + call setline(4, printf('- %s (%s)', a:msg, a:name)) + redraw +endfunction + +function! s:update_finish() + if exists('s:git_terminal_prompt') + let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt + endif + if s:switch_in() + call append(3, '- Updating ...') | 4 + for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))')) + let [pos, _] = s:logpos(name) + if !pos + continue + endif + if has_key(spec, 'commit') + call s:log4(name, 'Checking out '.spec.commit) + let out = s:checkout(spec) + elseif has_key(spec, 'tag') + let tag = spec.tag + if tag =~ '\*' + let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir)) + if !v:shell_error && !empty(tags) + let tag = tags[0] + call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) + call append(3, '') + endif + endif + call s:log4(name, 'Checking out '.tag) + let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir) + else + let branch = s:git_origin_branch(spec) + call s:log4(name, 'Merging origin/'.s:esc(branch)) + let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1' + \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir) + endif + if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && + \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) + call s:log4(name, 'Updating submodules. This may take a while.') + let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir) + endif + let msg = s:format_message(v:shell_error ? 'x': '-', name, out) + if v:shell_error + call add(s:update.errors, name) + call s:regress_bar() + silent execute pos 'd _' + call append(4, msg) | 4 + elseif !empty(out) + call setline(pos, msg[0]) + endif + redraw + endfor + silent 4 d _ + try + call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) + catch + call s:warn('echom', v:exception) + call s:warn('echo', '') + return + endtry + call s:finish(s:update.pull) + call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') + call s:switch_out('normal! gg') + endif +endfunction + +function! s:job_abort() + if (!s:nvim && !s:vim8) || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + if s:nvim + silent! call jobstop(j.jobid) + elseif s:vim8 + silent! call job_stop(j.jobid) + endif + if j.new + call s:rm_rf(g:plugs[name].dir) + endif + endfor + let s:jobs = {} +endfunction + +function! s:last_non_empty_line(lines) + let len = len(a:lines) + for idx in range(len) + let line = a:lines[len-idx-1] + if !empty(line) + return line + endif + endfor + return '' +endfunction + +function! s:job_out_cb(self, data) abort + let self = a:self + let data = remove(self.lines, -1) . a:data + let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') + call extend(self.lines, lines) + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if !self.running || self.tick % len(s:jobs) == 0 + let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') + let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) + call s:log(bullet, self.name, result) + endif +endfunction + +function! s:job_exit_cb(self, data) abort + let a:self.running = 0 + let a:self.error = a:data != 0 + call s:reap(a:self.name) + call s:tick() +endfunction + +function! s:job_cb(fn, job, ch, data) + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + call call(a:fn, [a:job, a:data]) +endfunction + +function! s:nvim_cb(job_id, data, event) dict abort + return (a:event == 'stdout' || a:event == 'stderr') ? + \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : + \ s:job_cb('s:job_exit_cb', self, 0, a:data) +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], + \ 'new': get(a:opts, 'new', 0) } + let s:jobs[a:name] = job + + if s:nvim + if has_key(a:opts, 'dir') + let job.cwd = a:opts.dir + endif + let argv = a:cmd + call extend(job, { + \ 'on_stdout': function('s:nvim_cb'), + \ 'on_stderr': function('s:nvim_cb'), + \ 'on_exit': function('s:nvim_cb'), + \ }) + let jid = s:plug_call('jobstart', argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = [jid < 0 ? argv[0].' is not executable' : + \ 'Invalid arguments (or job table is full)'] + endif + elseif s:vim8 + let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})')) + if has_key(a:opts, 'dir') + let cmd = s:with_cd(cmd, a:opts.dir, 0) + endif + let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd] + let jid = job_start(s:is_win ? join(argv, ' ') : argv, { + \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'err_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), + \ 'err_mode': 'raw', + \ 'out_mode': 'raw' + \}) + if job_status(jid) == 'run' + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = ['Failed to start job'] + endif + else + let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd])) + let job.error = v:shell_error != 0 + let job.running = 0 + endif +endfunction + +function! s:reap(name) + let job = s:jobs[a:name] + if job.error + call add(s:update.errors, a:name) + elseif get(job, 'new', 0) + let s:update.new[a:name] = 1 + endif + let s:update.bar .= job.error ? 'x' : '=' + + let bullet = job.error ? 'x' : '-' + let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) + call s:log(bullet, a:name, empty(result) ? 'OK' : result) + call s:bar() + + call remove(s:jobs, a:name) +endfunction + +function! s:bar() + if s:switch_in() + let total = len(s:update.all) + call setline(1, (s:update.pull ? 'Updating' : 'Installing'). + \ ' plugins ('.len(s:update.bar).'/'.total.')') + call s:progress_bar(2, s:update.bar, total) + call s:switch_out() + endif +endfunction + +function! s:logpos(name) + let max = line('$') + for i in range(4, max > 4 ? max : 4) + if getline(i) =~# '^[-+x*] '.a:name.':' + for j in range(i + 1, max > 5 ? max : 5) + if getline(j) !~ '^ ' + return [i, j - 1] + endif + endfor + return [i, i] + endif + endfor + return [0, 0] +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let [b, e] = s:logpos(a:name) + if b > 0 + silent execute printf('%d,%d d _', b, e) + if b > winheight('.') + let b = 4 + endif + else + let b = 4 + endif + " FIXME For some reason, nomodifiable is set after :d in vim8 + setlocal modifiable + call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) + call s:switch_out() + endif +endfunction + +function! s:update_vim() + let s:jobs = {} + + call s:bar() + call s:tick() +endfunction + +function! s:tick() + let pull = s:update.pull + let prog = s:progress_opt(s:nvim || s:vim8) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + call s:update_finish() + let s:update.fin = 1 + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = empty(globpath(spec.dir, '.git', 1)) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + if !new + let [error, _] = s:git_validate(spec, 0) + if empty(error) + if pull + let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch'] + if has_tag && !empty(globpath(spec.dir, '.git/shallow')) + call extend(cmd, ['--depth', '99999999']) + endif + if !empty(prog) + call add(cmd, prog) + endif + call s:spawn(name, cmd, { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } + endif + else + let cmd = ['git', 'clone'] + if !has_tag + call extend(cmd, s:clone_opt) + endif + if !empty(prog) + call add(cmd, prog) + endif + call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python') ? 'python' : 'python3' +execute py_exe "<< EOF" +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = ' '.join(vim.eval('s:clone_opt')) +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_IS_WIN = vim.eval('s:is_win') == '1' + +class PlugError(Exception): + def __init__(self, msg): + self.msg = msg +class CmdTimedOut(PlugError): + pass +class CmdFailed(PlugError): + pass +class InvalidURI(PlugError): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def __where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + msg.extend([' ' + line for line in rest]) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self.__where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + CD = 'cd /d' if G_IS_WIN else 'cd' + + def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): + self.cmd = cmd + if cmd_dir: + self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) + self.timeout = timeout + self.callback = cb if cb else (lambda msg: None) + self.clean = clean if clean else (lambda: None) + self.proc = None + + @property + def alive(self): + """ Returns true only if command still running. """ + return self.proc and self.proc.poll() is None + + def execute(self, ntries=3): + """ Execute the command with ntries if CmdTimedOut. + Returns the output of the command if no Exception. + """ + attempt, finished, limit = 0, False, self.timeout + + while not finished: + try: + attempt += 1 + result = self.try_command() + finished = True + return result + except CmdTimedOut: + if attempt != ntries: + self.notify_retry() + self.timeout += limit + else: + raise + + def notify_retry(self): + """ Retry required for command, notify user. """ + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.callback(['Retrying ...']) + + def try_command(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + first_line = True + + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b') + preexec_fn = not G_IS_WIN and os.setsid or None + self.proc = subprocess.Popen(self.cmd, stdout=tfile, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, shell=True, + preexec_fn=preexec_fn) + thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) + thrd.start() + + thread_not_started = True + while thread_not_started: + try: + thrd.join(0.1) + thread_not_started = False + except RuntimeError: + pass + + while self.alive: + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = '' if G_IS_WIN else nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + thrd.join(0.5) + + tfile.seek(0) + result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] + + if self.proc.returncode != 0: + raise CmdFailed([''] + result) + + return result + except: + self.terminate() + raise + + def terminate(self): + """ Terminate process and cleanup. """ + if self.alive: + if G_IS_WIN: + os.kill(self.proc.pid, signal.SIGINT) + else: + os.killpg(self.proc.pid, signal.SIGTERM) + self.clean() + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + self.tag = args.get('tag', 0) + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except PlugError as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + if target[-1] == '\\': + target = target[0:-1] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], + esc(target)) + com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT,) + result = command.execute(G_RETRIES) + return result[-1] + + def update(self): + actual_uri = self.repo_uri() + expect_uri = self.args['uri'] + regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') + ma = regex.match(actual_uri) + mb = regex.match(expect_uri) + if ma is None or mb is None or ma.groups() != mb.groups(): + msg = ['', + 'Invalid URI: {0}'.format(actual_uri), + 'Expected {0}'.format(expect_uri), + 'PlugClean required.'] + raise InvalidURI(msg) + + if G_PULL: + self.write(Action.UPDATE, self.name, ['Updating ...']) + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) + com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + else: + self.write(Action.DONE, self.name, ['Already installed']) + + def write(self, action, name, msg): + self.buf_q.put((action, name, msg)) + +class PlugThread(thr.Thread): + def __init__(self, tname, args): + super(PlugThread, self).__init__() + self.tname = tname + self.args = args + + def run(self): + thr.current_thread().name = self.tname + buf_q, work_q, lock = self.args + + try: + while not G_STOP.is_set(): + name, args = work_q.get_nowait() + plug = Plugin(name, args, buf_q, lock) + plug.manage() + work_q.task_done() + except queue.Empty: + pass + +class RefreshThread(thr.Thread): + def __init__(self, lock): + super(RefreshThread, self).__init__() + self.lock = lock + self.running = True + + def run(self): + while self.running: + with self.lock: + thread_vim_command('noautocmd normal! a') + time.sleep(0.33) + + def stop(self): + self.running = False + +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + +def esc(name): + return '"' + name.replace('"', '\"') + '"' + +def nonblock_read(fname): + """ Read a file with nonblock flag. Return the last line. """ + fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) + buf = os.read(fread, 100000).decode('utf-8', 'replace') + os.close(fread) + + line = buf.rstrip('\r\n') + left = max(line.rfind('\r'), line.rfind('\n')) + if left != -1: + left += 1 + line = line[left:] + + return line + +def main(): + thr.current_thread().name = 'main' + nthreads = int(vim.eval('s:update.threads')) + plugs = vim.eval('s:update.todo') + mac_gui = vim.eval('s:mac_gui') == '1' + + lock = thr.Lock() + buf = Buffer(lock, len(plugs), G_PULL) + buf_q, work_q = queue.Queue(), queue.Queue() + for work in plugs.items(): + work_q.put(work) + + start_cnt = thr.active_count() + for num in range(nthreads): + tname = 'PlugT-{0:02}'.format(num) + thread = PlugThread(tname, (buf_q, work_q, lock)) + thread.start() + if mac_gui: + rthread = RefreshThread(lock) + rthread.start() + + while not buf_q.empty() or thr.active_count() != start_cnt: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, ['OK'] if not msg else msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + + if mac_gui: + rthread.stop() + rthread.join() + +main() +EOF +endfunction + +function! s:update_ruby() + ruby << EOF + module PlugStream + SEP = ["\r", "\n", nil] + def get_line + buffer = '' + loop do + char = readchar rescue return + if SEP.include? char.chr + buffer << $/ + break + else + buffer << char + end + end + buffer + end + end unless defined?(PlugStream) + + def esc arg + %["#{arg.gsub('"', '\"')}"] + end + + def killall pid + pids = [pid] + if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM + pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } + else + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + end + + def compare_git_uri a, b + regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} + regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) + end + + require 'thread' + require 'fileutils' + require 'timeout' + running = true + iswin = VIM::evaluate('s:is_win').to_i == 1 + pull = VIM::evaluate('s:update.pull').to_i == 1 + base = VIM::evaluate('g:plug_home') + all = VIM::evaluate('s:update.todo') + limit = VIM::evaluate('get(g:, "plug_timeout", 60)') + tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 + nthr = VIM::evaluate('s:update.threads').to_i + maxy = VIM::evaluate('winheight(".")').to_i + vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ + cd = iswin ? 'cd /d' : 'cd' + tot = VIM::evaluate('len(s:update.todo)') || 0 + bar = '' + skip = 'Already installed' + mtx = Mutex.new + take1 = proc { mtx.synchronize { running && all.shift } } + logh = proc { + cnt = bar.length + $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" + $curbuf[2] = '[' + bar.ljust(tot) + ']' + VIM::command('normal! 2G') + VIM::command('redraw') + } + where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } + log = proc { |name, result, type| + mtx.synchronize do + ing = ![true, false].include?(type) + bar += type ? '=' : 'x' unless ing + b = case type + when :install then '+' when :update then '*' + when true, nil then '-' else + VIM::command("call add(s:update.errors, '#{name}')") + 'x' + end + result = + if type || type.nil? + ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] + elsif result =~ /^Interrupted|^Timeout/ + ["#{b} #{name}: #{result}"] + else + ["#{b} #{name}"] + result.lines.map { |l| " " << l } + end + if lnum = where.call(name) + $curbuf.delete lnum + lnum = 4 if ing && lnum > maxy + end + result.each_with_index do |line, offset| + $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) + end + logh.call + end + } + bt = proc { |cmd, name, type, cleanup| + tried = timeout = 0 + begin + tried += 1 + timeout += limit + fd = nil + data = '' + if iswin + Timeout::timeout(timeout) do + tmp = VIM::evaluate('tempname()') + system("(#{cmd}) > #{tmp}") + data = File.read(tmp).chomp + File.unlink tmp rescue nil + end + else + fd = IO.popen(cmd).extend(PlugStream) + first_line = true + log_prob = 1.0 / nthr + while line = Timeout::timeout(timeout) { fd.get_line } + data << line + log.call name, line.chomp, type if name && (first_line || rand < log_prob) + first_line = false + end + fd.close + end + [$? == 0, data.chomp] + rescue Timeout::Error, Interrupt => e + if fd && !fd.closed? + killall fd.pid + fd.close + end + cleanup.call if cleanup + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end + [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] + end + } + main = Thread.current + threads = [] + watcher = Thread.new { + if vim7 + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + else + require 'io/console' # >= Ruby 1.9 + nil until IO.console.getch == 3.chr + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } unless vim7 + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt').join(' ') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, tag = pair.last.values_at *%w[dir uri tag] + exists = File.directory? dir + ok, result = + if exists + chdir = "#{cd} #{iswin ? dir : esc(dir)}" + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif !compare_git_uri(current_uri, uri) + [false, ["Invalid URI: #{current_uri}", + "Expected: #{uri}", + "PlugClean required."].join($/)] + else + if pull + log.call name, 'Updating ...', :update + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil + else + [true, skip] + end + end + else + d = esc dir.sub(%r{[\\/]+$}, '') + log.call name, 'Installing ...', :install + bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { + FileUtils.rm_rf dir + } + end + mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok + log.call name, result, ok + end + } if running + end + end + threads.each { |t| t.join rescue nil } + logh.call + refresh.kill if refresh + watcher.kill +EOF +endfunction + +function! s:shellesc_cmd(arg, script) + let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g') + return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g') +endfunction + +function! s:shellesc_ps1(arg) + return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'" +endfunction + +function! s:shellesc_sh(arg) + return "'".substitute(a:arg, "'", "'\\\\''", 'g')."'" +endfunction + +" Escape the shell argument based on the shell. +" Vim and Neovim's shellescape() are insufficient. +" 1. shellslash determines whether to use single/double quotes. +" Double-quote escaping is fragile for cmd.exe. +" 2. It does not work for powershell. +" 3. It does not work for *sh shells if the command is executed +" via cmd.exe (ie. cmd.exe /c sh -c command command_args) +" 4. It does not support batchfile syntax. +" +" Accepts an optional dictionary with the following keys: +" - shell: same as Vim/Neovim 'shell' option. +" If unset, fallback to 'cmd.exe' on Windows or 'sh'. +" - script: If truthy and shell is cmd.exe, escape for batchfile syntax. +function! plug#shellescape(arg, ...) + if a:arg =~# '^[A-Za-z0-9_/:.-]\+$' + return a:arg + endif + let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {} + let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh') + let script = get(opts, 'script', 1) + if shell =~# 'cmd\(\.exe\)\?$' + return s:shellesc_cmd(a:arg, script) + elseif s:is_powershell(shell) + return s:shellesc_ps1(a:arg) + endif + return s:shellesc_sh(a:arg) +endfunction + +function! s:glob_dir(path) + return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') +endfunction + +function! s:progress_bar(line, bar, total) + call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') +endfunction + +function! s:compare_git_uri(a, b) + " See `git help clone' + " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] + " [git@] github.com[:port] : junegunn/vim-plug [.git] + " file:// / junegunn/vim-plug [/] + " / junegunn/vim-plug [/] + let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' + let ma = matchlist(a:a, pat) + let mb = matchlist(a:b, pat) + return ma[1:2] ==# mb[1:2] +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir, ...) + let script = a:0 > 0 ? a:1 : 1 + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd) +endfunction + +function! s:system(cmd, ...) + let batchfile = '' + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + if type(a:cmd) == s:TYPE.list + " Neovim's system() supports list argument to bypass the shell + " but it cannot set the working directory for the command. + " Assume that the command does not rely on the shell. + if has('nvim') && a:0 == 0 + return system(a:cmd) + endif + let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})')) + if s:is_powershell(&shell) + let cmd = '& ' . cmd + endif + else + let cmd = a:cmd + endif + if a:0 > 0 + let cmd = s:with_cd(cmd, a:1, type(a:cmd) != s:TYPE.list) + endif + if s:is_win && type(a:cmd) != s:TYPE.list + let [batchfile, cmd] = s:batchfile(cmd) + endif + return system(cmd) + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win && filereadable(batchfile) + call delete(batchfile) + endif + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_validate(spec, check_branch) + let err = '' + if isdirectory(a:spec.dir) + let result = [s:git_local_branch(a:spec.dir), s:git_origin_url(a:spec.dir)] + let remote = result[-1] + if empty(remote) + let err = join([remote, 'PlugClean required.'], "\n") + elseif !s:compare_git_uri(remote, a:spec.uri) + let err = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + elseif a:check_branch && has_key(a:spec, 'commit') + let sha = s:git_revision(a:spec.dir) + if empty(sha) + let err = join(add(result, 'PlugClean required.'), "\n") + elseif !s:hash_match(sha, a:spec.commit) + let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', + \ a:spec.commit[:6], sha[:6]), + \ 'PlugUpdate required.'], "\n") + endif + elseif a:check_branch + let current_branch = result[0] + " Check tag + let origin_branch = s:git_origin_branch(a:spec) + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag && a:spec.tag !~ '\*' + let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + endif + " Check branch + elseif origin_branch !=# current_branch + let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ current_branch, origin_branch) + endif + if empty(err) + let [ahead, behind] = split(s:lastline(s:system([ + \ 'git', 'rev-list', '--count', '--left-right', + \ printf('HEAD...origin/%s', origin_branch) + \ ], a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ origin_branch, ahead) + endif + endif + endif + endif + else + let err = 'Not found' + endif + return [err, err =~# 'PlugClean'] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + return s:system(s:is_win + \ ? 'rmdir /S /Q '.plug#shellescape(a:dir) + \ : ['rm', '-rf', a:dir]) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for invalid plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let errs = {} + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) + call add(dirs, spec.dir) + else + let [err, clean] = s:git_validate(spec, 1) + if clean + let errs[spec.dir] = s:lines(err)[0] + else + call add(dirs, spec.dir) + endif + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(s:plug_fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + if has_key(errs, f) + call append(line('$'), ' ' . errs[f]) + endif + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + 4 + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + let s:clean_count = 0 + call append(3, ['Directories to delete:', '']) + redraw! + if a:force || s:ask_no_interrupt('Delete all directories?') + call s:delete([6, line('$')], 1) + else + call setline(4, 'Cancelled.') + nnoremap d :set opfunc=delete_opg@ + nmap dd d_ + xnoremap d :call delete_op(visualmode(), 1) + echo 'Delete the lines (d{motion}) to delete the corresponding directories' + endif + endif + 4 + setlocal nomodifiable +endfunction + +function! s:delete_op(type, ...) + call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) +endfunction + +function! s:delete(range, force) + let [l1, l2] = a:range + let force = a:force + let err_count = 0 + while l1 <= l2 + let line = getline(l1) + if line =~ '^- ' && isdirectory(line[2:]) + execute l1 + redraw! + let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) + let force = force || answer > 1 + if answer + let err = s:rm_rf(line[2:]) + setlocal modifiable + if empty(err) + call setline(l1, '~'.line[1:]) + let s:clean_count += 1 + else + delete _ + call append(l1 - 1, s:format_message('x', line[1:], err)) + let l2 += len(s:lines(err)) + let err_count += 1 + endif + let msg = printf('Removed %d directories.', s:clean_count) + if err_count > 0 + let msg .= printf(' Failed to remove %d directories.', err_count) + endif + call setline(4, msg) + setlocal nomodifiable + endif + endif + let l1 += 1 + endwhile +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = s:plug_tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(['git', 'clone', '--depth', '1', s:plug_src, tmp]) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + let is_dir = isdirectory(spec.dir) + if has_key(spec, 'uri') + if is_dir + let [err, _] = s:git_validate(spec, 1) + let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] + else + let [valid, msg] = [0, 'Not found. Try PlugInstall.'] + endif + else + if is_dir + let [valid, msg] = [1, 'OK'] + else + let [valid, msg] = [0, 'Not found.'] + endif + endif + let cnt += 1 + let ecnt += !valid + " `s:loaded` entry can be missing if PlugUpgraded + if is_dir && get(s:loaded, name, -1) == 0 + let unloaded = 1 + let msg .= ' (not loaded)' + endif + call s:progress_bar(2, repeat('=', cnt), total) + call append(3, s:format_message(valid ? '-' : 'x', name, msg)) + normal! 2G + redraw + endfor + call setline(1, 'Finished. '.ecnt.' error(s).') + normal! gg + setlocal nomodifiable + if unloaded + echo "Press 'L' on each line to load plugin, or 'U' to update" + nnoremap L :call status_load(line('.')) + xnoremap L :call status_load(line('.')) + end +endfunction + +function! s:extract_name(str, prefix, suffix) + return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') +endfunction + +function! s:status_load(lnum) + let line = getline(a:lnum) + let name = s:extract_name(line, '-', '(not loaded)') + if !empty(name) + call plug#load(name) + setlocal modifiable + call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) + setlocal nomodifiable + endif +endfunction + +function! s:status_update() range + let lines = getline(a:firstline, a:lastline) + let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') + if !empty(names) + echo + execute 'PlugUpdate' join(names) + endif +endfunction + +function! s:is_preview_window_open() + silent! wincmd P + if &previewwindow + wincmd p + return 1 + endif +endfunction + +function! s:find_name(lnum) + for lnum in reverse(range(1, a:lnum)) + let line = getline(lnum) + if empty(line) + return '' + endif + let name = s:extract_name(line, '-', '') + if !empty(name) + return name + endif + endfor + return '' +endfunction + +function! s:preview_commit() + if b:plug_preview < 0 + let b:plug_preview = !s:is_preview_window_open() + endif + + let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') + if empty(sha) + let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$') + if empty(name) + return + endif + let title = 'HEAD@{1}..' + let command = 'git diff --no-color HEAD@{1}' + else + let title = sha + let command = 'git show --no-color --pretty=medium '.sha + let name = s:find_name(line('.')) + endif + + if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) + return + endif + + if exists('g:plug_pwindow') && !s:is_preview_window_open() + execute g:plug_pwindow + execute 'e' title + else + execute 'pedit' title + wincmd P + endif + setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable + let batchfile = '' + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command + if s:is_win + let [batchfile, cmd] = s:batchfile(cmd) + endif + execute 'silent %!' cmd + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win && filereadable(batchfile) + call delete(batchfile) + endif + endtry + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:format_git_log(line) + let indent = ' ' + let tokens = split(a:line, nr2char(1)) + if len(tokens) != 5 + return indent.substitute(a:line, '\s*$', '', '') + endif + let [graph, sha, refs, subject, date] = tokens + let tag = matchstr(refs, 'tag: [^,)]\+') + let tag = empty(tag) ? ' ' : ' ('.tag.') ' + return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) +endfunction + +function! s:append_ul(lnum, text) + call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) +endfunction + +function! s:diff() + call s:prepare() + call append(0, ['Collecting changes ...', '']) + let cnts = [0, 0] + let bar = '' + let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') + call s:progress_bar(2, bar, len(total)) + for origin in [1, 0] + let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) + if empty(plugs) + continue + endif + call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') + for [k, v] in plugs + let branch = s:git_origin_branch(v) + if len(branch) + let range = origin ? '..origin/'.branch : 'HEAD@{1}..' + let cmd = ['git', 'log', '--graph', '--color=never'] + if s:git_version_requirement(2, 10, 0) + call add(cmd, '--no-show-signature') + endif + call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range]) + if has_key(v, 'rtp') + call extend(cmd, ['--', v.rtp]) + endif + let diff = s:system_chomp(cmd, v.dir) + if !empty(diff) + let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' + call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) + let cnts[origin] += 1 + endif + endif + let bar .= '=' + call s:progress_bar(2, bar, len(total)) + normal! 2G + redraw + endfor + if !cnts[origin] + call append(5, ['', 'N/A']) + endif + endfor + call setline(1, printf('%d plugin(s) updated.', cnts[0]) + \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) + + if cnts[0] || cnts[1] + nnoremap (plug-preview) :silent! call preview_commit() + if empty(maparg("\", 'n')) + nmap (plug-preview) + endif + if empty(maparg('o', 'n')) + nmap o (plug-preview) + endif + endif + if cnts[0] + nnoremap X :call revert() + echo "Press 'X' on each block to revert the update" + endif + normal! gg + setlocal nomodifiable +endfunction + +function! s:revert() + if search('^Pending updates', 'bnW') + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.plug#shellescape(g:plugs[name].branch).' --', g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted' +endfunction + +function! s:snapshot(force, ...) abort + call s:prepare() + setf vim + call append(0, ['" Generated by vim-plug', + \ '" '.strftime("%c"), + \ '" :source this file in vim to restore the snapshot', + \ '" or execute: vim -S snapshot.vim', + \ '', '', 'PlugUpdate!']) + 1 + let anchor = line('$') - 3 + let names = sort(keys(filter(copy(g:plugs), + \'has_key(v:val, "uri") && isdirectory(v:val.dir)'))) + for name in reverse(names) + let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir) + if !empty(sha) + call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = s:plug_expand(a:1) + if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) + return + endif + call writefile(getline(1, '$'), fn) + echo 'Saved as '.a:1 + silent execute 'e' s:esc(fn) + setf vim + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@TogBG. The