dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 045e24675afab2003f672000f1ba8046dea18453
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Sat, 21 Dec 2019 12:09:37 +0000

New Init

Diffstat:
A.Xauthority | 0
A.Xdefaults | 32++++++++++++++++++++++++++++++++
A.Xresources | 44++++++++++++++++++++++++++++++++++++++++++++
A.bash_profile | 2++
A.bashrc | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/calcurse/Xtheme | 44++++++++++++++++++++++++++++++++++++++++++++
A.config/calcurse/conf | 25+++++++++++++++++++++++++
A.config/calcurse/keys | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/dunst/dunstrc | 46++++++++++++++++++++++++++++++++++++++++++++++
A.config/fff/config | 2++
A.config/fish/config.fish | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/fish/fish_variables | 44++++++++++++++++++++++++++++++++++++++++++++
A.config/grub/autoinstall.sh | 7+++++++
A.config/grub/background.png | 0
A.config/grub/grub | 21+++++++++++++++++++++
A.config/grub/grub.cfg | 443+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/htop/htoprc | 26++++++++++++++++++++++++++
A.config/i3/config | 288+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/i3blocks/config | 47+++++++++++++++++++++++++++++++++++++++++++++++
A.config/i3blocks/config2 | 27+++++++++++++++++++++++++++
A.config/irssi/away.log | 17+++++++++++++++++
A.config/irssi/config | 283+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/irssi/pipeline.theme | 267+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/irssi/scripts/autorun/README | 21+++++++++++++++++++++
A.config/irssi/scripts/autorun/ascii.pl | 405+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/irssi/scripts/autorun/auto_whois.pl | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/irssi/scripts/autorun/nickcolor.pl | 253+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/irssi/scripts/autorun/url_hilight.pl | 33+++++++++++++++++++++++++++++++++
A.config/irssi/scripts/autorun/usercount.pl | 184+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/mpv/input.conf | 4++++
A.config/mpv/mpv.conf | 3+++
A.config/neofetch/config.conf | 764+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/newsboat/config | 31+++++++++++++++++++++++++++++++
A.config/picom/config | 29+++++++++++++++++++++++++++++
A.config/urxvt/ext/clipboard | 28++++++++++++++++++++++++++++
A.config/urxvt/ext/keyboard-select | 606+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/urxvt/ext/resize-font | 169+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/urxvt/ext/url-select | 408+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/autoload/commentary.vim | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/autoload/repeat.vim | 165+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/autoload/surround.vim | 619+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/autoload/system_copy.vim | 148+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/colors/.vimrc | 0
A.config/vim/colors/duochrome.vim | 313+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/colors/plain.vim | 294+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/colors/wal.vim | 196+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vimb/config | 22++++++++++++++++++++++
A.config/vimb/scripts.js | 33+++++++++++++++++++++++++++++++++
A.config/vimb/style.css | 21+++++++++++++++++++++
A.config/youtube-dl/config | 5+++++
A.inputrc | 1+
A.licenses/gplv2.license | 9+++++++++
A.licenses/mit.license | 19+++++++++++++++++++
A.ls_colors | 2++
A.profile | 34++++++++++++++++++++++++++++++++++
A.scripts/bin/display/hlock | 39+++++++++++++++++++++++++++++++++++++++
A.scripts/bin/display/hlock.png | 0
A.scripts/bin/display/hlockr | 36++++++++++++++++++++++++++++++++++++
A.scripts/bin/display/monitors.sh | 2++
A.scripts/bin/display/rfeh | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/dmenu/daskpass | 11+++++++++++
A.scripts/bin/dmenu/dbrowse | 9+++++++++
A.scripts/bin/dmenu/dfm | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/dmenu/dmenurun | 3+++
A.scripts/bin/dmenu/dmount | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/dmenu/dmpv | 6++++++
A.scripts/bin/dmenu/dmpvurl | 18++++++++++++++++++
A.scripts/bin/dmenu/dpass | 43+++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/dmenu/dumount | 39+++++++++++++++++++++++++++++++++++++++
A.scripts/bin/dmenu/dvimedit | 12++++++++++++
A.scripts/bin/dmenu/userinput | 12++++++++++++
A.scripts/bin/i3/crefresh | 4++++
A.scripts/bin/i3/ffflaunch | 13+++++++++++++
A.scripts/bin/i3/hvol | 11+++++++++++
A.scripts/bin/i3/locker | 8++++++++
A.scripts/bin/i3/lockerexit | 27+++++++++++++++++++++++++++
A.scripts/bin/i3/moveentire | 9+++++++++
A.scripts/bin/i3/moveone | 5+++++
A.scripts/bin/i3/mpvlisten | 26++++++++++++++++++++++++++
A.scripts/bin/i3/wallvar | 9+++++++++
A.scripts/bin/misc/hirssi | 3+++
A.scripts/bin/misc/hmpv | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/misc/ircgetpass | 3+++
A.scripts/bin/misc/pipes | 385+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/bin/misc/rmpv | 32++++++++++++++++++++++++++++++++
A.scripts/bin/misc/trimfiles | 14++++++++++++++
A.urxvt | 2++
A.vim | 2++
A.vimrc | 30++++++++++++++++++++++++++++++
A.wall | 1+
A.xinitrc | 2++
A.xprofile | 2++
92 files changed, 8086 insertions(+), 0 deletions(-)

diff --git a/.Xauthority b/.Xauthority Binary files differ. diff --git a/.Xdefaults b/.Xdefaults @@ -0,0 +1,32 @@ +!! +!! .Xdefaults +!! Created by Hayden Hamilton +!! +!! haydenvh.com +!! Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license +!! + +URxvt.intensityStyles:false +URxvt.depth:32 +URxvt.font:xft:monospace:size=9 +URxvt.scrollBar:false +URxvt.cursorColor:white + +!! 25px padding +URxvt*internalBorder:25 +!! Extensions +URxvt.perl-ext-common:default,resize-font,url-select,keyboard-select,clipboard +URxvt.colorUL:#4682B4 +!! url-select +URxvt.keysym.C-u:perl:url-select:select_next +URxvt.url-select.launcher:vimb +URxvt.url-select.underline:true +!! keyboard-select: +URxvt.keysym.C-s:perl:keyboard-select:activate +!! resize-font +URxvt.resize-font.smaller:C-j +URxvt.resize-font.bigger:C-k +!! Matcher +URxvt.url-launcher:vimb +!! clipboard +URxvt.keysym.M-c:perl:clipboard:copy diff --git a/.Xresources b/.Xresources @@ -0,0 +1,44 @@ +! +! .Xresources +! Created by Hayden Hamilton +! +! haydenvh.com +! Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license +! + +! special +*.foreground: #1e5eb3 +*.background: #090711 +*.cursorColor: #1e5eb3 + +! black +*.color0: #141726 +*.color8: #dc6f3c + +! red +*.color1: #24283c +*.color9: #4747e1 + +! green +*.color2: #31364b +*.color10: #892b2b + +! yellow +*.color3: #40445c +*.color11: #a1a1d9 + +! blue +*.color4: #575b72 +*.color12: #1f8a27 + +! magenta +*.color5: #777b8e +*.color13: #a84b8d + +! cyan +*.color6: #a3a6b3 +*.color14: #434343 + +! white +*.color7: #c7cad9 +*.color15: #3ab475 diff --git a/.bash_profile b/.bash_profile @@ -0,0 +1 @@ +.profile +\ No newline at end of file diff --git a/.bashrc b/.bashrc @@ -0,0 +1,103 @@ +# +# .bashrc +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ./licenses/gplv2.license +# + +##Infinite command history +HISTSIZE= HISTFILESIZE= +##Setting promt +export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\w\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\\$ \[$(tput sgr0)\]" +export PS2="\[$(tput bold)\]\[$(tput setaf 1)\][$(tput setaf 2)\]Unclosed string\[$(tput setaf 1)\]]\[$(tput setaf 7)\]> \[$(tput sgr0)\]" + +##Setting aliases for xbps +alias \ +vi="vim" \ +xi="sudo xbps-install" \ +xq="sudo xbps-query" \ +xr="sudo xbps-remove" \ +irssi="irssi --config ~/.config/irssi/config" \ +pipes="pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15" \ +clock="tty-clock" \ +ytdl="youtube-dl --add-metadata -ic" \ +ytdla="youtube-dl --add-metadata -xic" \ +ls="ls --color" \ +map="telnet mapscii.me" \ +tetris="ssh netris.rocketnine.space" \ +calcurse="calcurse -D ~/.config/calcurse/" \ +irssi="irssi --home ~/.config/irssi/ -n haydenh" \ +trimwhite="for f in *; do mv "$f" `echo $f | tr ' ' '.'`; done" \ +xsleep="sudo zzz" \ +xhibernate="sudo ZZZ" \ +urxvtrestart="xrdb ~/.Xdefaults;xrdb ~/.Xresources" \ +rmst="bash ~/.scripts/random/gnulinux.sh" \ +?="sudo !!" \ +fff="ffflaunch" \ +python="python3" \ +gcc="gcc -Wall" \ +gpp="g++ -Wall" \ +fb="mpv --vo=drm" \ +vimb="vimb --no-maximize" \ + +##Setting VI mode +set -o vi + +##Setting colors for ls +export LS_COLORS="di=35:fi=0:ln=33:ex=91;01:*.sh=91:*.html=92:*.css=97:*.md=97:*.yml=93:*.c=94:*.h=94:*.h.orig=94;01:*.h.rej=94;01:*.mk=96:*LICENSE=90:*Makefile=90:*README=97:*.c.orig=94;01:*.c.rej=94;01:*.png=95:*.jpg=95:*.heic=95:*.heif=95:*.mp3=95;01:*opus=.95;01:*.m4a=95;01:*.flac=95;01:*.wav=95;01:*.mp4=95;04:*.mkv=95;04" + +##Framebuffer functions +video(){ + mpv $1 --vo=drm +} +image(){ + mpv $1 --vo=drm --pause +} + +##C Compilation +comp(){ + out="$1" + gcc $2 $3 $4 $5 $6 $7 $8 $9 -o ~/.scripts/bin/c/"$out" +} + +##Random +hostfile() { + if [ "$(echo "$1" | sed 's/ /qqq/g' | awk '/qqq/')" == "" ] + then + name=$(curl -F "file=@$1" http://0x0.st) + echo "Your file has been hosted at $name" + else + newfile=$(echo $1 | tr ' ' '.') + mv "$1" $newfile + name=$(curl -F "file=@$newfile" http://0x0.st) + echo "Your file has been hosted at $name" + mv $newfile "$1" &&>/dev/null 2>/dev/null 1>/dev/null + fi +} +rickroll(){ + curl -s -L https://raw.githubusercontent.com/keroseren/rickrollrc/master/roll.sh | bash +} +weather(){ + curl wttr.in/$1 +} +iploc(){ + curl ifconfig.co/$1 +} +getnews(){ + if [ "$1" != "" ] + then + arg=$(echo "$1" | sed 's/ /+/g') + fi + curl getnews.tech/$arg +} +cheatsh(){ + curl cheat.sh/$1 +} +dict(){ + curl "dict://dict.org/d:$1" +} +parrot(){ + curl parrot.live/$1 +} +bash ~/.bash_profile diff --git a/.config/calcurse/Xtheme b/.config/calcurse/Xtheme @@ -0,0 +1,44 @@ +! +! calcurse/Xtheme +! Created by Hayden Hamilton +! +! haydenvh.com +! Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license +! + +! special +*.foreground: #a84b8d +*.background: #090711 +*.cursorColor: #1e5eb3 + +! black +*.color0: #dc6f3c +*.color8: #dc6f3c + +! red +*.color1: #4747e1 +*.color9: #4747e1 + +! green +*.color4: #892b2b +*.color12: #892b2b + +! yellow +*.color3: #a1a1d9 +*.color11: #a1a1d9 + +! blue +*.color5: #1f8a27 +*.color13: #1f8a27 + +! magenta +*.color2: #a84b8d +*.color10: #a84b8d + +! cyan +*.color6: #434343 +*.color14: #434343 + +! white +*.color7: #3ab475 +*.color15: #3ab475 diff --git a/.config/calcurse/conf b/.config/calcurse/conf @@ -0,0 +1,25 @@ +appearance.calendarview=monthly +appearance.compactpanels=no +appearance.defaultpanel=calendar +appearance.layout=1 +appearance.notifybar=yes +appearance.sidebarwidth=1 +appearance.todoview=show-completed +appearance.theme=blue on default +daemon.enable=no +daemon.log=no +format.inputdate=1 +format.notifydate=%a %F +format.notifytime=%T +format.outputdate=%D +general.autogc=no +general.autosave=yes +general.confirmdelete=yes +general.confirmquit=no +general.firstdayofweek=sunday +general.periodicsave=0 +general.progressbar=yes +general.systemdialogs=no +notification.command=printf '\a' +notification.notifyall=flagged-only +notification.warning=300 diff --git a/.config/calcurse/keys b/.config/calcurse/keys @@ -0,0 +1,55 @@ +# +# Calcurse keys configuration file +# +# In this file the keybindings used by Calcurse are defined. +# It is generated automatically by Calcurse and is maintained +# via the key configuration menu of the interactive user +# interface. It should not be edited directly. + +generic-cancel ESC +generic-select SPC +generic-credits @ +generic-help ? +generic-quit q Q +generic-save s S ^S +generic-reload R +generic-copy c +generic-paste p ^V +generic-change-view TAB +generic-import i I +generic-export x X +generic-goto g G +generic-other-cmd o O +generic-config-menu C +generic-redraw ^R +generic-add-appt ^A +generic-add-todo ^T +generic-prev-day T ^H +generic-next-day t ^L +generic-prev-week W ^K +generic-next-week w +generic-prev-month M +generic-next-month m +generic-prev-year Y +generic-next-year y +generic-scroll-down ^N +generic-scroll-up ^P +generic-goto-today ^G +generic-command : +move-right l L RGT +move-left h H LFT +move-down j J DWN +move-up k K UP +start-of-week 0 +end-of-week $ +add-item a A +del-item d D +edit-item e E +view-item v V RET +pipe-item | +flag-item ! +repeat r +edit-note n N +view-note > +raise-priority + +lower-priority - diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc @@ -0,0 +1,46 @@ +[global] + monitor = 0 + follow = keyboard + geometry = "350x5+11+20" + indicate_hidden = yes + notification_height = 0 + separator_height = 2 + padding = 15 + horizontal_padding = 15 + frame_width=3 + frame_color = "#0a3439" + separator_color = frame + sort = yes + idle_threshold = 1 + font = Monospace 8 + line_height = 0 + markup = full + format = "<b><u>%s</u></b>\n%b" + alignment = left + show_age_threshold = 10 + word_wrap = yes + ellipsize = middle + ignore_newline = no + stack_duplicates = false + hide_duplicate_count = true + show_indicators = yes + sticky_history = yes + history_length = 20 + title = Dunst + class = Dunst + startup_notification = false + force_xinerama = false +[experimental] + per_monitor_dpi = false +[urgency_low] + background="#141726" + foreground="#ffffff" + frame_color="#0a3439" +[urgency normal] + background="#141726" + foreground="#ffffff" + frame_color="#0a3439" +[urgency critical] + background="#141726" + foreground="#ffffff" + frame_color="#0a3439" diff --git a/.config/fff/config b/.config/fff/config @@ -0,0 +1 @@ +.scripts/bin/i3/ffflaunch +\ No newline at end of file diff --git a/.config/fish/config.fish b/.config/fish/config.fish @@ -0,0 +1,61 @@ +#Prompt +function fish_prompt + tput setaf bold + tput setaf 2 + printf "[" + tput setaf 3 + printf $USER + tput setaf 4 + printf "@" + tput setaf 5 + printf $hostname + tput setaf 6 + printf " "(pwd | sed "s~$HOME~\~~g") + tput setaf 2 + printf "]" + tput setaf 11 + printf "\$ " +end + +#Aliases +function vi; vim $argv; end +function xi; sudo xbps-install $argv; end +function xq; sudo xbps-query $argv; end +function xr; sudo xbps-remove $argv; end +function irssi; irssi --config ~/.config/irssi/config $argv; end +function pipes; pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15 $argv; end +function clock; tty-clock; end +function ytdl; youtube-dl --add-metadata -ic $argv; end +function ytdla; youtube-dl --add-metadata -xic $argv; end +function ls; command ls --color $argv; end +function map; telnet mapscii.me; end +function tetris; ssh netris.rocketnine.space; end +function calcurse; calcurse -D ~/.config/calcurse/; end +function irssi; command irssi --home ~/.config/irssi/ -n hayden; ircgetpass; end +function xsleep; sudo zzz; end +function xhibernate; sudo ZZZ; end +function urxvtrestart; xrdb ~/.Xresources; xrdb ~/.Xdefaults; end +function rmst; bash ~/.scripts/random/gnulinux.sh; end +function fff; bash ~/.config/fff/config; end +function python; python3; end +function vimb; command vimb --no-maximize; end +function cleancache; sudo xbps-remove -O; end +function dots; git push orgin master; git push github master; end + +#Set fish colors +set fish_color_command a84b8d +set fish_color_autosuggestion 86296b +set fish_color_quote 3ab475 + +#Set LS colors +bash ~/.ls_colors +bash ~/.bash_profile + +#Frame buffer +function video; mpv $argv --vo=drm; end +function music; mpv $argv --vo=drm --pause; end + +##Auto tar +function at; bash ~/.autotar; end + +fish_vi_key_bindings diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables @@ -0,0 +1,44 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR --export BROWSER:vimb +SETUVAR --export EDITOR:vim +SETUVAR --export LANG:en_US\x2eUTF\x2d8 +SETUVAR --export LC_CTYPE:en_US\x2eUTF\x2d8 +SETUVAR --export PASS:/home/hayden/work/pass +SETUVAR --export --path PATH:/usr/local/bin\x1e/bin\x1e/usr/bin\x1e/usr/local/sbin\x1e/usr/sbin\x1e/sbin\x1e/home/hayden/\x2escripts/bin/c/\x1e/home/hayden/\x2escripts/bin/display/\x1e/home/hayden/\x2escripts/bin/dmenu/\x1e/home/hayden/\x2escripts/bin/git/\x1e/home/hayden/\x2escripts/bin/i3/\x1e/home/hayden/\x2escripts/bin/misc/\x1e\x2e\x1e\x1b\x5b0m\x1b\x5b35m/home/hayden/\x2escripts/bin/c/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/display/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/dmenu/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/git/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/i3/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/misc/\x1b\x5b0m\x20 +SETUVAR --export SCRIPTS:/home/hayden/\x2escripts/bin +SETUVAR --export SUDO_ASKPASS:/home/hayden/\x2escripts/bin/dmenu/daskpass +SETUVAR --export TERMINAL:urxvt +SETUVAR --export WORK:/home/hayden/work +SETUVAR __fish_init_2_39_8:\x1d +SETUVAR __fish_init_2_3_0:\x1d +SETUVAR __fish_init_3_x:\x1d +SETUVAR fish_color_autosuggestion:86296b +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:a84b8d +SETUVAR fish_color_comment:990000 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:009900 +SETUVAR fish_color_error:ff0000 +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_param:00afff +SETUVAR fish_color_quote:3ab475 +SETUVAR fish_color_redirection:00afff +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell +SETUVAR fish_key_bindings:fish_vi_key_bindings +SETUVAR fish_pager_color_completion:\x1d +SETUVAR fish_pager_color_description:B3A06D\x1eyellow +SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR --export scripts:\x1b\x5b0m\x1b\x5b35m/home/hayden/\x2escripts/bin/c/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/display/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/dmenu/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/git/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/i3/\x1b\x5b0m\x20\x1b\x5b35m/home/hayden/\x2escripts/bin/misc/\x1b\x5b0m\x20 +SETUVAR --export work:/home/hayden/work diff --git a/.config/grub/autoinstall.sh b/.config/grub/autoinstall.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cd $HOME/.config/grub/ +sudo cp background.png /boot/ +sudo cp grub /etc/default/grub +sudo grub-mkconfig -o grub.cfg +sudo cp grub.cfg /boot/grub/grub.cfg diff --git a/.config/grub/background.png b/.config/grub/background.png Binary files differ. diff --git a/.config/grub/grub b/.config/grub/grub @@ -0,0 +1,21 @@ +# +# Configuration file for GRUB. +# +GRUB_DEFAULT=0 +#GRUB_HIDDEN_TIMEOUT=0 +#GRUB_HIDDEN_TIMEOUT_QUIET=false +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="Void/Austall" +GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 slub_debug=P page_poison=1" +# Uncomment to use basic console +#GRUB_TERMINAL_INPUT="console" +# Uncomment to disable graphical terminal +#GRUB_TERMINAL_OUTPUT=console +GRUB_BACKGROUND=/boot/background.png +#GRUB_GFXMODE=1920x1080x32 +#GRUB_DISABLE_LINUX_UUID=true +#GRUB_DISABLE_RECOVERY=true +# Uncomment and set to the desired menu colors. Used by normal and wallpaper +# modes only. Entries specified as foreground/background. +#GRUB_COLOR_NORMAL="light-blue/black" +#GRUB_COLOR_HIGHLIGHT="light-cyan/blue" diff --git a/.config/grub/grub.cfg b/.config/grub/grub.cfg @@ -0,0 +1,443 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="0" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +if [ x$feature_default_font_path = xy ] ; then + font=unicode +else +insmod part_msdos +insmod ext2 +set root='hd0,msdos1' +if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 788d0f37-8e91-4264-ba91-6a6b47885232 +else + search --no-floppy --fs-uuid --set=root 788d0f37-8e91-4264-ba91-6a6b47885232 +fi + font="/usr/share/grub/unicode.pf2" +fi + +if loadfont $font ; then + set gfxmode=auto + load_video + insmod gfxterm + set locale_dir=$prefix/locale + set lang=en_US + insmod gettext +fi +terminal_output gfxterm +insmod part_msdos +insmod ext2 +set root='hd0,msdos4' +if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e +else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e +fi +insmod png +background_image -m stretch /background.png +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=5 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=5 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Void/Austall GNU/Linux' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.18_1 ...' + linux /vmlinuz-5.3.18_1 root=/dev/sda1 ro loglevel=4 slub_debug=P page_poison=1 +} +submenu 'Advanced options for Void/Austall GNU/Linux' $menuentry_id_option 'gnulinux-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.18_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.18_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.18_1 ...' + linux /vmlinuz-5.3.18_1 root=/dev/sda1 ro loglevel=4 slub_debug=P page_poison=1 + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.18_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.18_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.18_1 ...' + linux /vmlinuz-5.3.18_1 root=/dev/sda1 ro single + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.16_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.16_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.16_1 ...' + linux /vmlinuz-5.3.16_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.16_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.16_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.16_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.16_1 ...' + linux /vmlinuz-5.3.16_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.16_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.15_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.15_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.15_1 ...' + linux /vmlinuz-5.3.15_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.15_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.15_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.15_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.15_1 ...' + linux /vmlinuz-5.3.15_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.15_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.14_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.14_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.14_1 ...' + linux /vmlinuz-5.3.14_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.14_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.14_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.14_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.14_1 ...' + linux /vmlinuz-5.3.14_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.14_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.11_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.11_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.11_1 ...' + linux /vmlinuz-5.3.11_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.11_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.11_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.11_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.11_1 ...' + linux /vmlinuz-5.3.11_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.11_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.10_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.10_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.10_1 ...' + linux /vmlinuz-5.3.10_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.10_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.10_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.10_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.10_1 ...' + linux /vmlinuz-5.3.10_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.10_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.9_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.9_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.9_1 ...' + linux /vmlinuz-5.3.9_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.9_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.9_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.9_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.9_1 ...' + linux /vmlinuz-5.3.9_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.9_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.8_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.8_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.8_1 ...' + linux /vmlinuz-5.3.8_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.8_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 5.3.8_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.8_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 5.3.8_1 ...' + linux /vmlinuz-5.3.8_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-5.3.8_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 4.18.17_1' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.17_1-advanced-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 4.18.17_1 ...' + linux /vmlinuz-4.18.17_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro loglevel=4 slub_debug=P page_poison=1 + echo 'Loading initial ramdisk ...' + initrd /initramfs-4.18.17_1.img + } + menuentry 'Void/Austall GNU/Linux, with Linux 4.18.17_1 (recovery mode)' --class void_austall --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.17_1-recovery-788d0f37-8e91-4264-ba91-6a6b47885232' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod ext2 + set root='hd0,msdos4' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + else + search --no-floppy --fs-uuid --set=root b2bdfd15-e2d3-44b2-aeee-214e9ea5b80e + fi + echo 'Loading Linux 4.18.17_1 ...' + linux /vmlinuz-4.18.17_1 root=UUID=788d0f37-8e91-4264-ba91-6a6b47885232 ro single + echo 'Loading initial ramdisk ...' + initrd /initramfs-4.18.17_1.img + } +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/.config/htop/htoprc b/.config/htop/htoprc @@ -0,0 +1,26 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +fields=0 48 17 18 38 39 40 2 46 47 49 1 +sort_key=46 +sort_direction=1 +hide_threads=0 +hide_kernel_threads=1 +hide_userland_threads=0 +shadow_other_users=1 +show_thread_names=0 +show_program_path=1 +highlight_base_name=0 +highlight_megabytes=1 +highlight_threads=1 +tree_view=1 +header_margin=1 +detailed_cpu_time=0 +cpu_count_from_zero=1 +update_process_names=0 +account_guest_in_cpu_meter=0 +color_scheme=0 +delay=15 +left_meters=AllCPUs CPU Memory Swap LoadAverage Tasks +left_meter_modes=1 1 1 1 1 1 +right_meters=Tasks LoadAverage Uptime Clock Hostname Uptime +right_meter_modes=2 2 2 2 2 2 diff --git a/.config/i3/config b/.config/i3/config @@ -0,0 +1,288 @@ +# +# i3/config +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# + +##Loading Xresources with XRDB +exec xrdb ~/.Xresources + +##Setting font +font pango:monospace 8 + +##Setting variables +set $mod Mod4 +set $terminal urxvtc +set $browser vimb +exec export BROWSER="surf" +exec export EDITOR="vim" +exec_always export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" + +##Setting gaps +gaps outer 10 +gaps inner 2 +for_window [class="^.*"] border pixel 0 + +##Setting Xresources +set_from_resource $foreground foreground #343c62 +set_from_resource $background background #090711 +set_from_resource $black color0 #141726 +set_from_resource $black2 color8 #dc6f3c +set_from_resource $red color1 #24283c +set_from_resource $red2 color9 #4747e1 +set_from_resource $green color2 #31364b +set_from_resource $green2 color10 #892b2b +set_from_resource $yellow color3 #40445c +set_from_resource $yellow2 color11 #a1a1d9 +set_from_resource $blue color4 #575b72 +set_from_resource $blue2 color12 #658a1f +set_from_resource $magenta color5 #777b8e +set_from_resource $magenta2 color13 #ea74c7 +set_from_resource $cyan color6 #a3a6b3 +set_from_resource $cyan2 color14 #cfcfcf +set_from_resource $white color7 #c7cad9 +set_from_resource $white2 color15 #3ab475 + +##Setting bar +bar{ + font pango:monospace 7 + status_command i3blocks + position top + mode dock + modifier none + separator_symbol " " + colors { + background $background + statusline #eeddee + focused_workspace $background #ffffff #000000 + active_workspace $background $yellow2 #000000 + inactive_workspace $background $yellow2 #000000 + urgent_workspace $background #ffffff #990000 + } + + #Learn to use the keyboard newbs. + bindsym button1 nop + + id bar-1 +} +bar{ + font pango:monospace 7 + status_command i3blocks -c .config/i3blocks/config2 + position top + id bar-2 + mode dock + modifier none + workspace_buttons no + separator_symbol " " + colors { + background $background + statusline #eeddee + focused_workspace $background #ffffff #000000 + active_workspace $background $yellow2 #000000 + inactive_workspace $background $yellow2 #000000 + urgent_workspace $background #ffffff #990000 + } + + #Learn to use the keyboard newbs. + bindsym button1 nop +} + +##Setting workspace names +set $ws1 "1.WWW" +set $ws2 "2.DEV" +set $ws3 "3.DEV" +set $ws4 "4.DEV" +set $ws5 "5.DEV" +set $ws6 "6.SYS" +set $ws7 "7.SYS" +set $ws8 "8.IRC" +set $ws9 "9.GFX" +set $ws10 "10.MSC" + +##Change workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws10 + +##Move container to workspace & change +bindsym $mod+shift+1 exec moveone "$ws1" +bindsym $mod+shift+2 exec moveone "$ws2" +bindsym $mod+shift+3 exec moveone "$ws3" +bindsym $mod+shift+4 exec moveone "$ws4" +bindsym $mod+shift+5 exec moveone "$ws5" +bindsym $mod+shift+6 exec moveone "$ws6" +bindsym $mod+shift+7 exec moveone "$ws7" +bindsym $mod+shift+8 exec moveone "$ws8" +bindsym $mod+shift+9 exec moveone "$ws9" +bindsym $mod+shift+0 exec moveone "$ws10" + +##Move entire workspace & change +bindsym $mod+ctrl+1 exec moveentire "$ws1" +bindsym $mod+ctrl+2 exec moveentire "$ws2" +bindsym $mod+ctrl+3 exec moveentire "$ws3" +bindsym $mod+ctrl+4 exec moveentire "$ws4" +bindsym $mod+ctrl+5 exec moveentire "$ws5" +bindsym $mod+ctrl+6 exec moveentire "$ws6" +bindsym $mod+ctrl+7 exec moveentire "$ws7" +bindsym $mod+ctrl+8 exec moveentire "$ws8" +bindsym $mod+ctrl+9 exec moveentire "$ws9" +bindsym $mod+ctrl+0 exec moveentire "$ws10" + +##Move container to workspace +#bindsym $mod+Mod4+1 move container to workspace $ws1 +bindsym $mod+Mod1+2 move container to workspace $ws2 +bindsym $mod+Mod1+3 move container to workspace $ws3 +bindsym $mod+Mod1+4 move container to workspace $ws4 +bindsym $mod+Mod1+5 move container to workspace $ws5 +bindsym $mod+Mod1+6 move container to workspace $ws6 +bindsym $mod+Mod1+7 move container to workspace $ws7 +bindsym $mod+Mod1+8 move container to workspace $ws8 +bindsym $mod+Mod1+9 move container to workspace $ws9 +bindsym $mod+Mod1+0 move container to workspace $ws10 + +##Outputs for workspaces +workspace $ws1 output VGA1 +workspace $ws2 output LVDS1 + +##Setting windows to workspaces +assign [class="Gimp"] $ws9 +assign [class="Vimb"] $ws1 +assign [class="URxvt" instance="irssi"] $ws8 + +##Scratchpad +for_window [class="URxvt" instance="dropdown"] move scratchpad; move position 0 0; resize set 1000 500 + +##Movement bindings +bindsym $mod+h focus left +bindsym $mod+shift+h move left +bindsym $mod+ctrl+h resize shrink width 5px or 5ppt +bindsym $mod+j focus down +bindsym $mod+shift+j move down +bindsym $mod+ctrl+j resize shrink height 5px or 5ppt +bindsym $mod+k focus up +bindsym $mod+shift+k move up +bindsym $mod+ctrl+k resize grow height 5px or 5ppt +bindsym $mod+l focus right +bindsym $mod+shift+l move right +bindsym $mod+ctrl+l resize grow width 5px or 5ppt + +##Symbol bindings +bindsym $mod+shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+Return exec $terminal +bindsym $mod+F1 exec $browser file:///etc/manual/index.html +bindsym $mod+Escape exec userinput "Do you want to quit i3?" "sudo -A i3-msg exit" +bindsym $mod+shift+Escape exec userinput "Do you want to shutdown?" "sudo -A halt" +bindsym $mod+ctrl+Escape exec userinput "Do you want to reboot?" "sudo -A reboot" +bindsym $mod+bracketleft exec userinput "Do you want to suspend?" "sudo -A zzz" +bindsym $mod+shift+bracketleft exec userinput "Do you want to hibernate?" "sudo -A ZZZ" + +##Letter bindings +bindsym $mod+q exec dropdown kill; exec dropdown hide +bindsym $mod+shift+q kill +bindsym $mod+w exec rfeh ~/.wallpapers/ +bindsym $mod+shift+w exec fehffile ~/.wall +bindsym $mod+ctrl+w exec wallblur true +bindsym $mod+mod1+w exec fehffile ~/.cache/rfeh/prev +bindsym $mod+e exec $terminal -e dvimedit +bindsym $mod+shift+e exec $terminal -e dvimedit +bindsym $mod+r exec $terminal -name fileman -e dfm fm +bindsym $mod+shift+r restart +bindsym $mod+t layout tabbed +bindsym $mod+shift+t layout toggle split +bindsym $mod+y exec $terminal -name irssi -e irssi --home ~/.config/irssi/; exec ircgetpass +bindsym $mod+shift+y exec $terminal -name irssi -e irsii --home ~/.config/irssi/; exec ircgetpass +bindsym $mod+u exec wallvar ~/.wallpapers/ 60; exec dunstify "Auto-changing wallpapers on." +bindsym $mod+shift+u exec killall wallvar; exec dunstify "Auto-changing wallpapers off." +bindsym $mod+i exec $terminal -name fff -e ffflaunch +bindsym $mod+shift+i exec $terminal -name fff -e ffflaunch +##bindsym $mod+o +##bindsym $mod+super+o +bindsym $mod+p focus parent +bindsym $mod+shift+p focus child +bindsym $mod+a exec screenkey +bindsym $mod+shift+a exec killall screenkey +bindsym $mod+s exec dpass +bindsym $mod+shift+s exec dpass +bindsym $mod+d exec dmenurun +bindsym $mod+shift+d exec dmenurun +bindsym $mod+f fullscreen toggle +bindsym $mod+shift+f fullscreen toggle +bindsym $mod+g exec dropdown show; exec dropdown program 'newsboat' +bindsym $mod+shift+g exec dropdown hide; exec dropdown program 'calcurse' +##HJKL in movement bindings +bindsym $mod+z split v +bindsym $mod+shift+z split v +bindsym $mod+x split h +bindsym $mod+shift+x split h +bindsym $mod+c exec locker /tmp/mpv-socket2 /tmp/mpv-socket +bindsym $mod+shift+c exec slock +bindsym $mod+v exec killall mpv +bindsym $mod+shift+v exec killall mpv +bindsym $mod+b exec vimb --no-maximize +bindsym $mod+shift+b exec dmpvurl /tmp/mpv-socket /tmp/mpv-socket2 +bindsym $mod+n exec dmpv music /tmp/mpv-socket /tmp/mpv-socket2 --no-video +bindsym $mod+shift+n exec dmpv videos /tmp/mpv-socket2 /tmp/mpv-socket +bindsym $mod+m exec dmount +bindsym $mod+shift+m exec dumount + +##Starting scripts/programs +exec monitors.sh +exec bash ~/.scripts/input/keyboard +exec picom --config .config/picom/config -b -f +exec bash ~/.scripts/input/language +exec dunst --config ~/.config/dunst/config +exec nm-applet & +exec urxvtd -f -o -q +exec mpvlisten /tmp/mpv-socket2 /tmp/mpv-socket +exec fehffile ~/.wall.png +exec_always notify-send "i3 restarted. Press Super(windows key)+F1 to open the manual." +exec_always brightnessctl s 100% +exec_always crefresh +exec dropdown start urxvtc + +##Setting colors for tabbed windows +#class #border #background #text +client.focused $yellow $red $white +client.unfocused $yellow $background $white +client.focused_inactive $yellow $background $white +client.placeholder $yellow $background $white +client.urgent $yellow $background $yellow2 + +##Setting volume +bindsym XF86AudioRaiseVolume exec hvol 5%+ +bindsym XF86AudioLowerVolume exec hvol 5%- +bindsym XF86AudioMute exec hvol toggle + +##Setting brightness +bindsym XF86MonBrightnessUp exec brightnessctl --quiet set +5% +bindsym XF86MonBrightnessDown exec brightnessctl --quiet set -5% + +##Function bindings (hmpv) +bindsym F8 exec dmpv videos /tmp/mpv-socket2 /tmp/mpv-socket +bindsym shift+F8 exec rmpv videos 50 +bindsym F9 exec dmpv music /tmp/mpv-socket /tmp/mpv-socket2 --no-video +bindsym shift+F9 exec rmpv music 50 +bindsym F10 exec hmpv back /tmp/mpv-socket +bindsym shift+F10 exec hmpv prev /tmp/mpv-socket +bindsym F11 exec hmpv toggle /tmp/mpv-socket +bindsym shift+F11 exec hmpv quit /tmp/mpv-socket +bindsym F12 exec hmpv forward /tmp/mpv-socket +bindsym shift+F12 exec hmpv next /tmp/mpv-socket +bindsym Home exec brightnessctl s +500000 +bindsym End exec brightnessctl s 500000- + +##i3 related commands +focus_follows_mouse no +mouse_warping none +popup_during_fullscreen ignore +focus_on_window_activation urgent diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -0,0 +1,47 @@ +command=~/.scripts/i3blocks/$BLOCK_NAME +separator_block_width=7 +markup=none +border_bottom=2 +border_top=0 +border_left=0 +border_right=0 + +[vol] +interval=1 +border=#21a4a3 + +[net] +interval=50 +border=#4db0c6 + +[mem] +interval=1 +border=#009dc1 + +[disk] +interval=100 +border=#0f9bf3 + +[disk2] +interval=1 +border=#3157b5 + +[cpu] +interval=1 +border=#7525c8 + +[bat] +interval=30 +border=#c625c8 + +[time] +interval=150 +border=#ff7777 + +[time2] +interval=1 +border=#ff303b + +[host] +interval=10000 +border=#ff003b diff --git a/.config/i3blocks/config2 b/.config/i3blocks/config2 @@ -0,0 +1,27 @@ +command=~/.scripts/i3blocks/$BLOCK_NAME +separator_block_width=7 +markup=none +border_bottom=2 +border_top=0 +border_left=0 +border_right=0 + +[mpv] +interval=1 +border=#666b1b + +[cal] +interval=30 +border=#236b1b + +[news] +interval=30 +border=#498364 + +[weather2] +interval=1 +border=#249980 + +[weather] +interval=50 +border=#249980 diff --git a/.config/irssi/away.log b/.config/irssi/away.log @@ -0,0 +1,17 @@ +--- Log opened Thu Dec 12 18:30:41 2019 +18:35 9/bishop948/ |g ethe idea is nice let's hope it never have to be used at all +18:35 9/bishop948/ |g e*but +20:57 9/aldcor8/ |g ei made #GNU/matrix as a result of todays "incident". Feel free to join :) +20:57 ?/haydenhg8/ |g ek. +20:59 9/aldcor8/ |g ewith feel free I meant that you must join that channel! +--- Log closed Thu Dec 12 21:04:32 2019 +--- Log opened Thu Dec 12 23:40:41 2019 +--- Log closed Thu Dec 12 23:41:09 2019 +--- Log opened Sat Dec 14 00:18:42 2019 +--- Log closed Sat Dec 14 00:18:42 2019 +--- Log opened Sun Dec 15 00:58:34 2019 +--- Log closed Sun Dec 15 11:24:57 2019 +--- Log opened Tue Dec 17 23:29:52 2019 +--- Log closed Wed Dec 18 07:12:52 2019 +--- Log opened Sat Dec 21 01:27:29 2019 +--- Log closed Sat Dec 21 11:01:32 2019 diff --git a/.config/irssi/config b/.config/irssi/config @@ -0,0 +1,283 @@ +servers = ( + { + address = "chat.freenode.net"; + chatnet = "Freenode"; + port = "6667"; + }, + { address = "irc.rizon.net"; chatnet = "Rizon"; port = "6667"; } +); +chatnets = { + Freenode = { + type = "IRC"; + max_kicks = "1"; + max_msgs = "4"; + max_whois = "1"; + }; + Rizon = { + type = "IRC"; + max_kicks = "1"; + max_msgs = "1"; + max_whois = "1"; + }; +}; +channels = ( + { name = "#voidlinux"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#haydenh"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#irssi"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#neomutt"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#GNU/matrix"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#i3"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#archlinux-offtopic"; chatnet = "Freenode"; autojoin = "Yes"; }, +); +aliases = { + ATAG = "WINDOW SERVER"; + ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}"; + B = "BAN"; + BACK = "AWAY"; + BANS = "BAN"; + BYE = "QUIT"; + C = "CLEAR"; + CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi"; + CHAT = "DCC CHAT"; + CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }"; + DATE = "TIME"; + DEHIGHLIGHT = "DEHILIGHT"; + DESCRIBE = "ACTION"; + DHL = "DEHILIGHT"; + EXEMPTLIST = "MODE $C +e"; + EXIT = "QUIT"; + GOTO = "SCROLLBACK GOTO"; + HIGHLIGHT = "HILIGHT"; + HL = "HILIGHT"; + HOST = "USERHOST"; + IDENTIFY = "msg NickServ identify"; + INVITELIST = "MODE $C +I"; + J = "JOIN"; + K = "KICK"; + KB = "KICKBAN"; + KN = "KNOCKOUT"; + LAST = "LASTLOG"; + LEAVE = "PART"; + M = "MSG"; + MUB = "UNBAN *"; + N = "NAMES"; + NMSG = "^MSG"; + P = "PART"; + Q = "QUERY"; + RESET = "SET -default"; + RUN = "SCRIPT LOAD"; + SAY = "MSG *"; + SB = "SCROLLBACK"; + SBAR = "STATUSBAR"; + SIGNOFF = "QUIT"; + SV = "MSG * Irssi $J ($V) - http://www.irssi.org"; + T = "TOPIC"; + UB = "UNBAN"; + UMODE = "MODE $N"; + UNSET = "SET -clear"; + W = "WHO"; + WC = "WINDOW CLOSE"; + WG = "WINDOW GOTO"; + WJOIN = "JOIN -window"; + WI = "WHOIS"; + WII = "WHOIS $0 $0"; + WL = "WINDOW LIST"; + WN = "WINDOW NEW HIDDEN"; + WQUERY = "QUERY -window"; + WW = "WHOWAS"; + 1 = "WINDOW GOTO 1"; + 2 = "WINDOW GOTO 2"; + 3 = "WINDOW GOTO 3"; + 4 = "WINDOW GOTO 4"; + 5 = "WINDOW GOTO 5"; + 6 = "WINDOW GOTO 6"; + 7 = "WINDOW GOTO 7"; + 8 = "WINDOW GOTO 8"; + 9 = "WINDOW GOTO 9"; + 10 = "WINDOW GOTO 10"; + 11 = "WINDOW GOTO 11"; + 12 = "WINDOW GOTO 12"; + 13 = "WINDOW GOTO 13"; + 14 = "WINDOW GOTO 14"; + 15 = "WINDOW GOTO 15"; + 16 = "WINDOW GOTO 16"; + 17 = "WINDOW GOTO 17"; + 18 = "WINDOW GOTO 18"; + 19 = "WINDOW GOTO 19"; + 20 = "WINDOW GOTO 20"; + 21 = "WINDOW GOTO 21"; + 22 = "WINDOW GOTO 22"; + 23 = "WINDOW GOTO 23"; + 24 = "WINDOW GOTO 24"; + 25 = "WINDOW GOTO 25"; + 26 = "WINDOW GOTO 26"; + 27 = "WINDOW GOTO 27"; + 28 = "WINDOW GOTO 28"; + 29 = "WINDOW GOTO 29"; + 30 = "WINDOW GOTO 30"; + 31 = "WINDOW GOTO 31"; + 32 = "WINDOW GOTO 32"; + 33 = "WINDOW GOTO 33"; + 34 = "WINDOW GOTO 34"; + 35 = "WINDOW GOTO 35"; + 36 = "WINDOW GOTO 36"; + 37 = "WINDOW GOTO 37"; + 38 = "WINDOW GOTO 38"; + 39 = "WINDOW GOTO 39"; + 40 = "WINDOW GOTO 40"; + 41 = "WINDOW GOTO 41"; + 42 = "WINDOW GOTO 42"; + 43 = "WINDOW GOTO 43"; + 44 = "WINDOW GOTO 44"; + 45 = "WINDOW GOTO 45"; + 46 = "WINDOW GOTO 46"; + 47 = "WINDOW GOTO 47"; + 48 = "WINDOW GOTO 48"; + 49 = "WINDOW GOTO 49"; + 50 = "WINDOW GOTO 50"; + 51 = "WINDOW GOTO 51"; + 52 = "WINDOW GOTO 52"; + 53 = "WINDOW GOTO 53"; + 54 = "WINDOW GOTO 54"; + 55 = "WINDOW GOTO 55"; + 56 = "WINDOW GOTO 56"; + 57 = "WINDOW GOTO 57"; + 58 = "WINDOW GOTO 58"; + 59 = "WINDOW GOTO 59"; + 60 = "WINDOW GOTO 60"; + 61 = "WINDOW GOTO 61"; + 62 = "WINDOW GOTO 62"; + 63 = "WINDOW GOTO 63"; + 64 = "WINDOW GOTO 64"; + 65 = "WINDOW GOTO 65"; + 66 = "WINDOW GOTO 66"; + 67 = "WINDOW GOTO 67"; + 68 = "WINDOW GOTO 68"; + 69 = "WINDOW GOTO 69"; + 70 = "WINDOW GOTO 70"; + 71 = "WINDOW GOTO 71"; + 72 = "WINDOW GOTO 72"; + 73 = "WINDOW GOTO 73"; + 74 = "WINDOW GOTO 74"; + 75 = "WINDOW GOTO 75"; + 76 = "WINDOW GOTO 76"; + 77 = "WINDOW GOTO 77"; + 78 = "WINDOW GOTO 78"; + 79 = "WINDOW GOTO 79"; + 80 = "WINDOW GOTO 80"; + 81 = "WINDOW GOTO 81"; + 82 = "WINDOW GOTO 82"; + 83 = "WINDOW GOTO 83"; + 84 = "WINDOW GOTO 84"; + 85 = "WINDOW GOTO 85"; + 86 = "WINDOW GOTO 86"; + 87 = "WINDOW GOTO 87"; + 88 = "WINDOW GOTO 88"; + 89 = "WINDOW GOTO 89"; + 90 = "WINDOW GOTO 90"; + 91 = "WINDOW GOTO 91"; + 92 = "WINDOW GOTO 92"; + 93 = "WINDOW GOTO 93"; + 94 = "WINDOW GOTO 94"; + 95 = "WINDOW GOTO 95"; + 96 = "WINDOW GOTO 96"; + 97 = "WINDOW GOTO 97"; + 98 = "WINDOW GOTO 98"; + 99 = "WINDOW GOTO 99"; +}; +statusbar = { + items = { + barstart = "{sbstart}"; + barend = "{sbend}"; + topicbarstart = "{topicsbstart}"; + topicbarend = "{topicsbend}"; + time = "{sb $Z}"; + user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}"; + window = "{sb $winref:$tag/$itemname{sbmode $M}}"; + window_empty = "{sb $winref{sbservertag $tag}}"; + prompt = "{prompt $[.15]itemname}"; + prompt_empty = "{prompt $winname}"; + topic = " $topic"; + topic_empty = " Irssi v$J - http://www.irssi.org"; + lag = "{sb Lag: $0-}"; + act = "{sb Act: $0-}"; + more = "-- more --"; + }; + default = { + window = { + disabled = "no"; + type = "window"; + placement = "bottom"; + position = "1"; + visible = "active"; + items = { + barstart = { priority = "100"; }; + time = { }; + user = { }; + window = { }; + window_empty = { }; + lag = { priority = "-1"; }; + act = { priority = "10"; }; + more = { priority = "-1"; alignment = "right"; }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; + window_inact = { + type = "window"; + placement = "bottom"; + position = "1"; + visible = "inactive"; + items = { + barstart = { priority = "100"; }; + window = { }; + window_empty = { }; + more = { priority = "-1"; alignment = "right"; }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; + prompt = { + type = "root"; + placement = "bottom"; + position = "100"; + visible = "always"; + items = { + prompt = { priority = "-1"; }; + prompt_empty = { priority = "-1"; }; + input = { priority = "10"; }; + }; + }; + topic = { + type = "root"; + placement = "top"; + position = "1"; + visible = "always"; + items = { + topicbarstart = { priority = "100"; }; + topic = { }; + topic_empty = { }; + topicbarend = { priority = "100"; alignment = "right"; }; + }; + }; + }; +}; +settings = { + core = { + real_name = "haydenh"; + user_name = "haydenh"; + nick = "haydenh"; + recode_transliterate = "no"; + }; + "fe-text" = { actlist_sort = "refnum"; }; + "fe-common/core" = { + theme = "pipeline"; + autolog_path = "~/.irc.log"; + autolog = "yes"; + }; + "perl/core/scripts" = { + ascii_figlet_path = "/usr/bin/figlet"; + nickcolor_colors = "4 8 9 10 11 12 13 14 15"; + }; +}; + +logs = { }; diff --git a/.config/irssi/pipeline.theme b/.config/irssi/pipeline.theme @@ -0,0 +1,267 @@ +#!/bin/bash +# +# pipeline +# +# An Irssi theme inspired by madcow and skeita +# +# Copyright (c) 2016 Beau Hastings. All rights reserved. +# License: GNU General Public License v2 +# +# Author: Beau Hastings <beausy@gmail.com> +# URL: https://github.com/hastinbe/irssi-theme-pipeline + +replaces = { "/[]=" = "%K$*%n"; "*@+." = "%B$*%n"; }; + +#replaces = { "!@+" = "%r$*%n"; }; +info_eol = "false"; + +abstracts = { + ## + ## generic + ## + + # text to insert at the beginning of each non-message line + #line_start = "%b.%c.%C.%n "; + line_start = ""; + + # timestamp styling, nothing by default + timestamp = "%B$*%n"; + #timestamp = "%y$*%n"; + + # any kind of text that needs hilighting, default is to bold + hilight = "%_$*%_"; + + # any kind of error message, default is bright red + error = "%R$*%n"; + + # channel name is printed + #channel = "$*"; + channel = "%_$*%_"; + + # nick is printed + nick = "$*"; + + # nick host is printed + nickhost = "$*"; + + # server name is printed + server = "%_$*%_"; + + # some kind of comment is printed + #comment = "$*"; + comment = "%b[%n$*%b]%n"; + + # reason for something is printed (part, quit, kick, ..) + reason = "{comment %_$*%_}"; + + # mode change is printed ([+o nick]) + #mode = "{comment %n[%W$*]%n}"; + mode = "%b$*%n"; + + ## + ## channel specific messages + ## + + # highlighted nick/host is printed (joins) + channick_hilight = "$*"; + chanhost_hilight = "{nickhost $*}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%W$*%n"; + chanhost = "{nickhost $*}"; + + # highlighted channel name is printed + channelhilight = "%R$*%n"; + + # ban/ban exception/invite list mask is printed + ban = "%r$*%n"; + + ## + ## messages + ## + + # the basic styling of how to print message, $0 = nick mode, $1 = nick + #msgnick = "<%C$0%n$1-%n> %|"; + msgnick = "$0$1%K |%n %|"; + + # message from you is printed. "msgownnick" specifies the styling of the + # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the + # whole line. + + # Example1: You want the message text to be green: + # ownmsgnick = "{msgnick $0 $1-}%g"; + # Example2.1: You want < and > chars to be yellow: + # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; + # (you'll also have to remove <> from replaces list above) + # Example2.2: But you still want to keep <> grey for other messages: + # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; + # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; + # pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n"; + # ownprivmsgnick = "%K{msgnick $*%K}%n"; + # privmsgnick = "%K{msgnick %R$*%K}%n"; + + # $0 = nick mode, $1 = nick + ownmsgnick = "{msgnick $0 $1-}%W"; + ownnick = "%y$*%n"; + + # public message in channel, $0 = nick mode, $1 = nick + pubmsgnick = "{msgnick %b$0%n %w$1%n}"; + #pubmsgnick = "{msgnick $0$1-}"; + pubnick = "%w$*%n"; + + # public message in channel meant for me, $0 = nick mode, $1 = nick + #pubmsgmenick = "%Y{msgnick %B$0%n %w$1%n}%w"; + pubmsgmenick = "{msgnick $0$1-}"; + menick = "%g$*%n"; + + # public highlighted message in channel + # $0 = highlight color, $1 = nick mode, $2 = nick + #pubmsghinick = "%Y{msgnick %B$1 %w$2}%w"; + pubmsghinick = "{msgnick $1 $0$2-%n}"; + + # channel name is printed with message + msgchannel = "%b:$*%n"; + + # private message, $0 = nick, $1 = host + #privmsg = "%b.%c.%C.%n(%c$0%n[%c$1]) "; + privmsg = "[%w$0!%b$1-%n] "; + + # private message from you, $0 = "msg", $1 = target nick + #ownprivmsg = "%b.%c.%C.%n[%cmsg%n(%c$1%n)] "; + ownprivmsg = "{msgnick $*}"; + + # own private message in query + ownprivmsgnick = "{msgnick %W$*%w}"; + ownprivnick = "%W$0%n%w"; + + # private message in query + privmsgnick = "{msgnick %B$*%w}"; + + ## + ## Actions (/ME stuff) + ## + + # used internally by this theme + action_core = "%W*%w $*%n"; + + # generic one that's used by most actions + action = "%w{action_core %w$*} "; + + # own action, both private/public + ownaction = "{action $*}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}%K:%b$1%n "; + + # private action sent by others + pvtaction = "%w $*%n "; + pvtaction_query = "{action $*}"; + + # public action sent by others + pubaction = "{action $*}"; + + + ## + ## other IRC events + ## + + # notices + ownnotice = "%b>%c>%C> %c$0%B!%c$1%n: "; + notice = "%b$*%n "; + pubnotice_channel = "%K:%m$*"; + pubnotice_host = "%K(%m$*%K)"; + servernotice = "%g!$*%n "; + + # CTCPs + ownctcp = "%b>%c>%C> %c$0%B!%c$1%n: "; + ctcp = "%m$*%n"; + + # wallops + wallop = "%W$*%n: "; + wallop_nick = "%n$*"; + wallop_action = "%W * $*%n "; + + # netsplits + netsplit = "%B$*%n"; + netjoin = "%B$*%n"; + + # /names list + names_nick = "[%_$0%_%w$1-%n] "; + names_users = "%b$*%n:"; + names_channel = "%B$*%n"; + + # DCC + dcc = "%b$*%n"; + dccfile = "%_$*%_"; + + # DCC chat, own msg/action + dccownmsg = "[%b$0%K($1-%K)%n] "; + dccownnick = "%B$*%n"; + dccownaction = "{action $*}"; + dccownaction_target = "{action_core $0}%K:%b$1%n "; + + # DCC chat, others + dccmsg = "[%B$1-%K(%b$0%K)%n] "; + dccquerynick = "%B$*%n"; + dccaction = "%W (*dcc*) $*%n %|"; + + ## + ## statusbar + ## + + # background of statusbar + sb_background = "%0"; + + + # default statusbar item style + sb = "%B[%W$*%B]%n"; + sbmode = " %b+%n$*"; + sbaway = " (%Baway%n)"; + sbservertag = ":%W$0"; + sbmore = "%_-- more --%_"; + sblag = "{sb L: %B$*}"; + sbmail = "{sb M: $*}"; + + # activity. Det is used for hilights when display doesn't support colors + sbact_det = " D: $*"; + + # usercount + sb_usercount = "{sb %W$0%n $1-}"; + sb_uc_ircops = "%_*%_%K/%R$*%n"; + sb_uc_ops = "%_@%_%K/%G$*%n"; + sb_uc_halfops = "%_=%_%K/%g$*%n"; + sb_uc_voices = "%_+%_%K/%Y$*%n"; + sb_uc_normal = "%_.%_%K/%W$*%n"; + sb_uc_space = " "; + +}; + +# %r%n%_$0%_$1%K |%n %| +formats = { + "fe-common/core" = { + pubmsg = "{pubmsgnick $2 {pubnick $[-16]0}}$1"; + join = " %_%Bjoin%_%K |%n %g{channick_hilight $0}%K!%n{chanhost_hilight $1}"; + part = " %_%Bpart%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $3}"; + kick = " %_%Bkick%_%K |%n %r{channick $0} %nby {nick $2} from {channel $1}: {reason $3}"; + quit = " %_%Bquit%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $2}"; + nick_changed = " %_%Bnick%_%K |%n {nick %w$0%n} %Nis now {nick %W$1%n}"; + endofnames = "{channel $0}: {hilight $1} nicks ({comment @/{hilight $2} +/{hilight $3} -/{hilight $4}})"; + own_msg = "{ownmsgnick $2 {ownnick $[-16]0}}$1"; + own_msg_channel = "{ownmsgnick $3 {ownnick $[-16]0}{msgchannel $1}}$2"; + pubmsg_me = "{pubmsgmenick $2 {menick $[-16]0}}$1"; + pubmsg_me_channel = "{pubmsgmenick $3 {menick $[-16]0}{msgchannel $1}}$2"; + pubmsg_hilight = "{pubmsghinick $0 $3 $[-16]1}$2"; + pubmsg_channel = "{pubmsgnick $3 {pubnick $[-16]0}{msgchannel $1}}$2"; + chanmode_change = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; + channel_mode = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; + }; + "fe-common/text" = { window_info_sticky = "%# Sticky : $0"; }; + "fe-common/irc" = { + chanmode_change = " %_%Bmode%_%K |%n %y{channick_hilight $2} %nsets mode %b{$mode $1} %non {$channelhilight $0}"; + whois = "{hilight $0} [{nickhost $1@$2}] [$whois_country]%: ircname : $3"; + server_chanmode_change = "{netsplit ServerMode}/{channelhilight $0}: {mode $1} by {nick $2}"; + whois_server = " server : $1 ({comment $2})"; + own_action = "{ownaction $0}%|$1"; + action_public = "{pubaction $0}%|$1"; + }; +}; diff --git a/.config/irssi/scripts/autorun/README b/.config/irssi/scripts/autorun/README @@ -0,0 +1,21 @@ + +ascii.pl: + /ASCII [-c1234] [-f <fontname>] [-p <prefix>] [-l|-s|-m <where>] <text> + /COLSAY [-1234] [-m <where>] <text> + /COLME [-1234] <text> + /COLTOPIC [-1234] <text> + /COLKICK [-1234] [nick(,nick_1,...,nick_n)] <reason> + /COLQUIT [-1234] <reason> + /SET ascii_figlet_path [path] + +auto_whois: + all is handled by itself + +nickcolor.pl: + all is handled by itself + +url_hilight.pl: + all is handled by itself + +usercount.pl: + all is handled by itself diff --git a/.config/irssi/scripts/autorun/ascii.pl b/.config/irssi/scripts/autorun/ascii.pl @@ -0,0 +1,405 @@ +# +# Commands: /ASCII, /COLSAY, /COLME, /COLTOPIC, /COLKICK, /COLQUIT +# Usage: +# /ASCII [-c1234] [-f <fontname>] [-p <prefix>] [-l|-s|-m <where>] <text> +# /COLSAY [-1234] [-m <where>] <text> +# /COLME [-1234] <text> +# /COLTOPIC [-1234] <text> +# /COLKICK [-1234] [nick(,nick_1,...,nick_n)] <reason> +# /COLQUIT [-1234] <reason> +# Settings: +# /SET ascii_figlet_path [path] +# /SET ascii_default_font [fontname] +# /SET ascii_default_colormode [1-4] +# /SET ascii_default_prefix [prefix] +# /SET ascii_default_kickreason [reason] +# /SET ascii_default_quitreason [reason] +# +# Script is bassed on figlet. +# + +use strict; +use Irssi; +use Irssi::Irc; + +use vars qw($VERSION %IRSSI); + +$VERSION = "1.6.3"; +%IRSSI = ( + "authors" => "Marcin Rozycki", + "contact" => "derwan\@irssi.pl", + "name" => "ascii-art", + "description" => "Ascii-art bassed on figlet. Available commands: /ASCII, /COLSAY, /COLME, /COLTOPIC, /COLKICK, /COLQUIT.", + "url" => "http://derwan.irssi.pl", + "license" => "GNU GPL v2", + "changed" => "Fri Jun 21 17:17:53 CEST 2002" +); + +use IPC::Open3; + +# defaults +my $ascii_default_font = "small.flf"; +my $ascii_default_kickreason = "Irssi BaBy!"; +my $ascii_default_quitreason = "I Quit!"; +my $ascii_last_color = undef; +my @ascii_colors = (12, 12, 12, 9, 5, 4, 13, 8, 7, 3, 11, 10, 2, 6, 6, 6, 6, 10, 8, 7, 4, 3, 9, 11, 2, 12, 13, 5); + +# registering themes +Irssi::theme_register([ + 'ascii_not_connected', '%_$0:%_ You\'re not connected to server', + 'ascii_not_window', '%_$0:%_ Not joined to any channel or query window', + 'ascii_not_chanwindow', '%_$0:%_ Not joined to any channel', + 'ascii_not_chanop', '%_$0:%_ You\'re not channel operator in {hilight $1}', + 'ascii_figlet_notfound', '%_Ascii:%_ Cannot execute {hilight $0} - file not found or bad permissions', + 'ascii_figlet_notset', '%_Ascii:%_ Cannot find external program %_figlet%_, usign /SET ascii_figlet_path [path], to set it', + 'ascii_cmd_syntax', '%_$0:%_ $1, usage: $2', + 'ascii_figlet_error', '%_Ascii: Figlet returns error:%_ $0-', + 'ascii_fontlist', '%_Ascii:%_ Available fonts [in $0]: $1 ($2)', + 'ascii_empty_fontlist', '%_Ascii:%_ Cannot find figlet fonts in $0', + 'ascii_unknown_fontdir', '%_Ascii:%_ Cannot find figlet fontdir', + 'ascii_show_line', '$0-' + +]); + +# str find_figlet_path() +sub find_figlet_path { + foreach my $dir (split(/\:/, $ENV{'PATH'})) + { + return "$dir/figlet" if ($dir and -x "$dir/figlet"); + } +} + +# int randcolor() +sub randcolor { + return $ascii_colors[int(rand(12)+2)]; +} + +# str colorline($colormode, $text) +sub colorline { + my ($colormode, $text) = @_; + my $colortext = undef; + my $last = ($ascii_last_color) ? $ascii_last_color : randcolor(); + my $indx = $last; + + if ($colormode =~ /3/) { + $ascii_last_color = randcolor(); + }elsif ($colormode =~ /4/) { + $ascii_last_color = $ascii_colors[$last]; + }elsif ($colormode !~ /2/) { + $ascii_last_color = $ascii_colors[14+$last]; + } + + while ($text =~ /./g) + { + my $char = "$&"; + + if ($colormode =~ /3/) { + while ($indx == $last) { $indx = randcolor(); }; + $last = $indx; + }elsif ($colormode =~ /4/) { + $indx = $ascii_colors[$indx]; + }elsif ($last) { + $indx = $ascii_colors[$last]; + undef $last; + } else { + $indx = $ascii_colors[$indx]; + $last = $indx + 14; + }; + + $colortext .= $char, next if ($char eq " "); + $colortext .= "\003" . sprintf("%02d", $indx) . $char; + $colortext .= $char if ($char eq ","); + }; + + return $colortext; +}; + +# int colormode() +sub colormode { + my $mode = Irssi::settings_get_int("ascii_default_colormode"); + $mode =~ s/-//g; + return (!$mode or $mode > 4) ? 1 : $mode; +}; + +# bool ascii_test($command, $flags, $server, $window) +sub ascii_test { + my ($cmd, $test, $server, $window) = @_; + + if ($test =~ /s/ and !$server || !$server->{connected}) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_not_connected", $cmd); + return 0; + }; + if ($test =~ /W/ and !$window || $window->{type} !~ /(channel|query)/i) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_not_window", $cmd); + return 0; + }; + if ($test =~ /(w|o)/ and !$window || $window->{type} !~ /channel/i) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_not_chanwindow", $cmd); + return 0; + }; + if ($test =~ /o/ and !$window->{chanop}) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_not_chanop", $cmd, Irssi::active_win()->get_active_name()); + return 0; + }; + + return 1; +} + +# void cmd_ascii() +# handles /ascii +sub cmd_ascii +{ + my $usage = "/ASCII [-c1234] [-f <fontname>] [-p <prefix>] [-l|-s|-m <where>] <text>"; + my $font = Irssi::settings_get_str("ascii_default_font"); + my $prefix = Irssi::settings_get_str("ascii_default_prefix"); + my ($arguments, $server, $witem) = @_; + my ($text, $cmd, $mode); + + $font = $ascii_default_font unless ($font); + $ascii_last_color = randcolor(); + + my $figlet = Irssi::settings_get_str("ascii_figlet_path"); + if (!$figlet or !(-x $figlet)) { + my $theme = ($figlet) ? "ascii_figlet_notfound" : "ascii_figlet_notset"; + Irssi::printformat(MSGLEVEL_CRAP, $theme, $figlet); + return; + }; + + my @foo = split(/ +/, $arguments); + while ($_ = shift(@foo)) + { + /^-l$/ and show_figlet_fonts($figlet), return; + /^-c$/ and $mode = colormode(), next; + /^-(1|2|3|4)$/ and s/-//g, $mode = $_, next; + /^-f$/ and $font = shift(@foo), next; + /^-p$/ and $prefix = shift(@foo), next; + /^-m$/ and $cmd = shift(@foo), next; + /^-s$/ and $cmd = 0, next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Ascii", "Unknown argument: $_", $usage), return; + $text = ($#foo < 0) ? $_ : $_ . " " . join(" ", @foo); + last; + } + + unless (length($text)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Ascii", "Missing arguments", $usage); + return; + }; + + if ($cmd eq "") { + return unless (ascii_test("Ascii", "sW", $server, $witem)); + $cmd = Irssi::active_win()->get_active_name(); + } elsif ($cmd ne "0" and !ascii_test("Ascii", "s", $server, $witem)) { + return; + } + + my $pid = open3(*FIGIN, *FIGOUT, *FIGERR, $figlet, qw(-k -f), $font, $text); + + while (<FIGOUT>) + { + chomp; + next unless (/[^ ]/); + $_ = colorline($mode, $_) if ($mode); + Irssi::printformat(MSGLEVEL_CLIENTCRAP, "ascii_show_line", $prefix.$_), next if ($cmd eq "0"); + $server->command("msg $cmd $prefix$_"); + } + + while (<FIGERR>) + { + chomp; + Irssi::printformat(MSGLEVEL_CRAP, "ascii_figlet_error", $_); + }; + + close FIGIN; + close FIGOUT; + close FIGERR; + + waitpid $pid, 0; +} + +# void show_figlet_fonts(figlet path) +sub show_figlet_fonts { + my @fontlist; + if (my $fontdir = `"$_[0]" -I 2 2>/dev/null`) { + chomp $fontdir; + foreach my $font (glob $fontdir."/*.flf") + { + $font =~ s/^$fontdir\///; + $font =~ s/\.flf$//; + push @fontlist, $font; + } + if ($#fontlist < 0) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_fontlist_empty", $fontdir); + } else { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_fontlist", $fontdir, join(", ", @fontlist), scalar(@fontlist)); + } + } else { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_unknown_fontdir"); + } +} + +# void cmd_colsay() +# handles /colsay +sub cmd_colsay { + my $usage = "/COLSAY [-1234] [-m <where>] <text>"; + my ($arguments, $server, $witem) = @_; + my ($cmd, $text); + my $mode = colormode(); + + $ascii_last_color = randcolor(); + + my @foo = split(/ /, $arguments); + while ($_ = shift(@foo)) + { + /^-(1|2|3|4)$/ and $mode = $_, next; + /^-m$/i and $cmd = shift(@foo), next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colsay", "Unknown argument: $_", $usage), return; + $text = ($#foo < 0) ? $_ : $_ . " " . join(" ", @foo); + last; + }; + + unless (length($text)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colsay", "Missing arguments", $usage); + return; + }; + + if ($cmd) { + return unless (ascii_test("Colsay", "s", $server, $witem)); + } else { + return unless (ascii_test("Colsay", "sW", $server, $witem)); + $cmd = Irssi::active_win()->get_active_name(); + }; + + $server->command("msg $cmd ".colorline($mode, $text)); +} + + +sub cmd_colme { + my $usage = "/COLME [-1234] <text>"; + my ($arguments, $server, $witem) = @_; + my $mode = colormode(); + my $text; + + $ascii_last_color = randcolor(); + + my @foo = split(/ /, $arguments); + while ($_ = shift(@foo)) + { + /^-(1|2|3|4)$/ and $mode = $_, next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colme", "Unknown argument: $_", $usage), return; + $text = ($#foo < 0) ? $_ : $_ . " " . join(" ", @foo); + last; + }; + + unless (length($text)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colme", "Missing arguments", $usage); + return; + }; + + return unless (ascii_test("Colme", "sW", $server, $witem)); + $witem->command("me ".colorline($mode, $text)); +} + +# void cmd_coltopic() +# handles /coltopic +sub cmd_coltopic { + my $usage = "/COLTOPIC [-1234] <text>"; + my ($arguments, $server, $witem) = @_; + my $mode = colormode(); + my $text; + + $ascii_last_color = randcolor(); + + my @foo = split(/ /, $arguments); + while ($_ = shift(@foo)) + { + /^-(1|2|3|4)$/ and $mode = $_, next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Coltopic", "Unknown argument: $_", $usage), return; + $text = ($#foo < 0) ? $_ : $_ . " " . join(" ", @foo); + last; + }; + + unless (length($text)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Coltopic", "Missing arguments", $usage); + return; + }; + + return unless (ascii_test("Coltopic", "sw", $server, $witem)); + + $server->command("topic " . Irssi::active_win()->get_active_name() . " " . colorline($mode, $text)); +}; + +# void cmd_colkick() +# handles /colkick +sub cmd_colkick { + my $usage = "/COLKICK [-1234] [nick(,nick_1,...,nick_n)] <reason>"; + my ($arguments, $server, $witem) = @_; + my $kickreason = Irssi::settings_get_str("ascii_default_kickreason"); + my $mode = colormode(); + my $who = undef; + + $ascii_last_color = randcolor(); + $kickreason = $ascii_default_kickreason unless ($kickreason); + + my @foo = split(/ /, $arguments); + while ($_ = shift(@foo)) + { + /^-(1|2|3|4)$/ and $mode = $_, next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colkick", "Unknown argument: $_", $usage), return; + $kickreason = join(" ", @foo) if ($#foo >= 0); + $who = $_; + last; + }; + + if (!$who or !length($kickreason)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colkick", "Missing arguments", $usage); + return; + }; + + return unless (ascii_test("Colkick", "swo", $server, $witem)); + $witem->command("kick $who ".colorline($mode, $kickreason)); +}; + +# void cmd_colquit() +# handles /colquit +sub cmd_colquit { + my $usage = "/COLQUIT [-1234] <reason>"; + my ($arguments, $server, $witem) = @_; + my $quitreason = Irssi::settings_get_str("ascii_default_quitreason"); + my $mode = colormode(); + + $ascii_last_color = randcolor(); + $quitreason = $ascii_default_quitreason unless ($quitreason); + + my @foo = split(/ /, $arguments); + while ($_ = shift(@foo)) + { + /^-(1|2|3|4)$/ and $mode = $_, next; + /^-/ and Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colquit", "Unknown argument: $_", $usage), return; + $quitreason = ($#foo < 0) ? $_ : $_ . " " . join(" ", @foo); + last; + }; + + unless (length($quitreason)) { + Irssi::printformat(MSGLEVEL_CRAP, "ascii_cmd_syntax", "Colquit", "Missing arguments", $usage); + return; + }; + + return unless (ascii_test("Colquit", "s", $server, $witem)); + $server->command("quit " . colorline($mode, $quitreason)); +} + +# registering settings +Irssi::settings_add_str("misc", "ascii_default_font", $ascii_default_font); +Irssi::settings_add_str("misc", "ascii_default_kickreason", $ascii_default_kickreason); +Irssi::settings_add_str("misc", "ascii_default_quitreason", $ascii_default_quitreason); +Irssi::settings_add_str("misc", "ascii_default_prefix", ""); +Irssi::settings_add_int("misc", "ascii_default_colormode", 1); +Irssi::settings_add_str("misc", "ascii_figlet_path", find_figlet_path); + +# binding commands +Irssi::command_bind("ascii", "cmd_ascii"); +Irssi::command_bind("colsay", "cmd_colsay"); +Irssi::command_bind("colme", "cmd_colme"); +Irssi::command_bind("coltopic", "cmd_coltopic"); +Irssi::command_bind("colkick", "cmd_colkick"); +Irssi::command_bind("colquit", "cmd_colquit"); diff --git a/.config/irssi/scripts/autorun/auto_whois.pl b/.config/irssi/scripts/autorun/auto_whois.pl @@ -0,0 +1,80 @@ +# /WHOIS all the users who send you a private message. +# v0.9 for irssi by Andreas 'ads' Scherbaum +# idea and some code taken from autowhois.pl from Timo Sirainen +use strict; +use Irssi; +use vars qw($VERSION %IRSSI); + +$VERSION = "0.9"; +%IRSSI = ( + authors => "Andreas \'ads\' Scherbaum", + contact => "ads\@ufp.de", + name => "auto_whois", + description => "/WHOIS all the users who send you a private message.", + license => "GPL", + url => "http://irssi.org/", + changed => "2004-02-10", + changes => "v0.9: don't /WHOIS if query exists for the nick already" +); + +# History: +# v0.9: don't /WHOIS if query exists for the nick already +# now we store all nicks we have seen in the last 10 minutes + +my @seen = (); + +sub msg_private_first { + my ($server, $msg, $nick, $address) = @_; + + # go through every stored connection and remove, if timed out + my $time = time(); + my ($connection); + my @new = (); + foreach $connection (@seen) { + if ($connection->{lasttime} >= $time - 600) { + # is ok, use it + push(@new, $connection); + # all timed out connections will be dropped + } + } + @seen = @new; +} + +sub msg_private { + my ($server, $msg, $nick, $address) = @_; + + # look, if we already know this connection + my ($connection, $a); + my $known_to_us = 0; + for ($a = 0; $a <= $#seen; $a++) { + $connection = $seen[$a]; + # the lc() works not exact, because irc uses another charset + if ($connection->{server} eq $server->{address} and $connection->{port} eq $server->{port} and lc($connection->{nick}) eq lc($nick)) { + $known_to_us = 1; + # mark as refreshed + $seen[$a]->{lasttime} = time(); + last; + } + } + + if ($known_to_us == 1) { + # all ok, return + return; + } + + # now store the new connection + $connection = {}; + # store our own server data here + $connection->{server} = $server->{address}; + $connection->{port} = $server->{port}; + # and the nick who queried us + $connection->{nick} = $nick; + $connection->{lasttime} = time(); + $connection->{starttime} = time(); + push(@seen, $connection); + + $server->command("whois $nick"); +} + +Irssi::signal_add_first('message private', 'msg_private_first'); +Irssi::signal_add('message private', 'msg_private'); diff --git a/.config/irssi/scripts/autorun/nickcolor.pl b/.config/irssi/scripts/autorun/nickcolor.pl @@ -0,0 +1,253 @@ +use strict; +use Irssi 20020101.0250 (); +use vars qw($VERSION %IRSSI); +$VERSION = "2.1"; +%IRSSI = ( + authors => "Timo Sirainen, Ian Peters, David Leadbeater, Bruno Cattáneo", + contact => "tss\@iki.fi", + name => "Nick Color", + description => "assign a different color for each nick", + license => "Public Domain", + url => "http://irssi.org/", + changed => "Mon 08 Jan 21:28:53 BST 2018", +); + +# Settings: +# nickcolor_colors: List of color codes to use. +# e.g. /set nickcolor_colors 2 3 4 5 6 7 9 10 11 12 13 +# (avoid 8, as used for hilights in the default theme). +# +# nickcolor_enable_prefix: Enables prefix for same nick. +# +# nickcolor_enable_truncate: Enables nick truncation. +# +# nickcolor_prefix_text: Prefix text for succesive messages. +# e.g. /set nickcolor_prefix_text - +# +# nickcolor_truncate_value: Truncate nick value. +# e.g. /set nickcolor_truncate_value -7 +# This will truncate nicknames at 7 characters and make them right aligned + +my %saved_colors; +my %session_colors = {}; +my %saved_nicks; # To store each channel's last nickname + +sub load_colors { + open my $color_fh, "<", "$ENV{HOME}/.irssi/saved_colors"; + while (<$color_fh>) { + chomp; + my($nick, $color) = split ":"; + $saved_colors{$nick} = $color; + } +} + +sub save_colors { + open COLORS, ">", "$ENV{HOME}/.irssi/saved_colors"; + + foreach my $nick (keys %saved_colors) { + print COLORS "$nick:$saved_colors{$nick}\n"; + } + + close COLORS; +} + +# If someone we've colored (either through the saved colors, or the hash +# function) changes their nick, we'd like to keep the same color associated +# with them (but only in the session_colors, ie a temporary mapping). + +sub sig_nick { + my ($server, $newnick, $nick, $address) = @_; + my $color; + + $newnick = substr ($newnick, 1) if ($newnick =~ /^:/); + + if ($color = $saved_colors{$nick}) { + $session_colors{$newnick} = $color; + } elsif ($color = $session_colors{$nick}) { + $session_colors{$newnick} = $color; + } +} + +# This gave reasonable distribution values when run across +# /usr/share/dict/words + +sub simple_hash { + my ($string) = @_; + chomp $string; + my @chars = split //, $string; + my $counter; + + foreach my $char (@chars) { + $counter += ord $char; + } + + my @colors = split / /, Irssi::settings_get_str('nickcolor_colors'); + $counter = $colors[$counter % @colors]; + + return $counter; +} + +# process public (others) messages +sub sig_public { + my ($server, $msg, $nick, $address, $target) = @_; + + my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix'); + my $enable_truncate = Irssi::settings_get_bool('nickcolor_enable_truncate'); + my $prefix_text = Irssi::settings_get_str('nickcolor_prefix_text'); + my $truncate_value = Irssi::settings_get_int('nickcolor_truncate_value'); + + # Reference for server/channel + my $tagtarget = "$server->{tag}/$target"; + + # Set default nick truncate value to 0 if option is disabled + $truncate_value = 0 if (!$enable_truncate); + + # Has the user assigned this nick a color? + my $color = $saved_colors{$nick}; + + # Have -we- already assigned this nick a color? + if (!$color) { + $color = $session_colors{$nick}; + } + + # Let's assign this nick a color + if (!$color) { + $color = simple_hash $nick; + $session_colors{$nick} = $color; + } + + $color = sprintf "\003%02d", $color; + + # Optional: We check if it's the same nickname for current target + if ($saved_nicks{$tagtarget} eq $nick && $enable_prefix) + { + # Grouped message + Irssi::command('/^format pubmsg ' . $prefix_text . '$1'); + } + else + { + # Normal message + Irssi::command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$[' . $truncate_value . ']0}}$1'); + + # Save nickname for next message + $saved_nicks{$tagtarget} = $nick; + } + +} + +# process public (me) messages +sub sig_me { + my ($server, $msg, $target) = @_; + my $nick = $server->{nick}; + + my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix'); + my $enable_truncate = Irssi::settings_get_bool('nickcolor_enable_truncate'); + my $prefix_text = Irssi::settings_get_str('nickcolor_prefix_text'); + my $truncate_value = Irssi::settings_get_int('nickcolor_truncate_value'); + + # Reference for server/channel + my $tagtarget = "$server->{tag}/$target"; + + # Set default nick truncate value to 0 if option is disabled + $truncate_value = 0 if (!$enable_truncate); + + # Optional: We check if it's the same nickname for current target + if ($saved_nicks{$tagtarget} eq $nick && $enable_prefix) + { + # Grouped message + Irssi::command('/^format own_msg ' . $prefix_text . '$1'); + } + else + { + # Normal message + Irssi::command('/^format own_msg {ownmsgnick $2 {ownnick $[' . $truncate_value . ']0}}$1'); + + # Save nickname for next message + $saved_nicks{$tagtarget} = $nick; + } + +} + +# process public (others) actions +sub sig_action_public { + my ($server, $msg, $nick, $address, $target) = @_; + + my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix'); + + # Reference for server/channel + my $tagtarget = "$server->{tag}/$target"; + + # Empty current target nick if prefix option is enabled + $saved_nicks{$tagtarget} = '' if ($enable_prefix); + +} + +# process public (me) actions +sub sig_action_me { + my ($server, $msg, $target) = @_; + my $nick = $server->{nick}; + + my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix'); + + # Reference for server/channel + my $tagtarget = "$server->{tag}/$target"; + + # Empty current target nick if prefix option is enabled + $saved_nicks{$tagtarget} = '' if ($enable_prefix); + +} + +sub cmd_color { + my ($data, $server, $witem) = @_; + my ($op, $nick, $color) = split " ", $data; + + $op = lc $op; + + if (!$op) { + Irssi::print ("No operation given (save/set/clear/list/preview)"); + } elsif ($op eq "save") { + save_colors; + } elsif ($op eq "set") { + if (!$nick) { + Irssi::print ("Nick not given"); + } elsif (!$color) { + Irssi::print ("Color not given"); + } elsif ($color < 2 || $color > 14) { + Irssi::print ("Color must be between 2 and 14 inclusive"); + } else { + $saved_colors{$nick} = $color; + } + } elsif ($op eq "clear") { + if (!$nick) { + Irssi::print ("Nick not given"); + } else { + delete ($saved_colors{$nick}); + } + } elsif ($op eq "list") { + Irssi::print ("\nSaved Colors:"); + foreach my $nick (keys %saved_colors) { + Irssi::print (chr (3) . sprintf("%02d", $saved_colors{$nick}) . "$nick" . + chr (3) . "1 ($saved_colors{$nick})"); + } + } elsif ($op eq "preview") { + Irssi::print ("\nAvailable colors:"); + foreach my $i (2..14) { + Irssi::print (chr (3) . "$i" . "Color #$i"); + } + } +} + +load_colors; + +Irssi::settings_add_str('misc', 'nickcolor_colors', '2 3 4 5 6 7 9 10 11 12 13'); +Irssi::settings_add_bool('misc', 'nickcolor_enable_prefix', 0); +Irssi::settings_add_bool('misc', 'nickcolor_enable_truncate', 0); +Irssi::settings_add_str('misc', 'nickcolor_prefix_text' => '- '); +Irssi::settings_add_int('misc', 'nickcolor_truncate_value' => 0); +Irssi::command_bind('color', 'cmd_color'); + +Irssi::signal_add('message public', 'sig_public'); +Irssi::signal_add('message own_public', 'sig_me'); +Irssi::signal_add('message irc action', 'sig_action_public'); +Irssi::signal_add('message irc own_action', 'sig_action_me'); +Irssi::signal_add('event nick', 'sig_nick'); diff --git a/.config/irssi/scripts/autorun/url_hilight.pl b/.config/irssi/scripts/autorun/url_hilight.pl @@ -0,0 +1,33 @@ +# url_hilight.pl +# +# This script is a work in progress, and will probably not do anything useful +# at the moment. Please fork and implement, or bug me on #irssi if you can +# decide what it ought to do, since I've forgotten. + + + +use strict; +use warnings; +use Irssi; + +our %IRSSI = ( + "author" => 'shabble', + "contact" => 'shabble+irssi@metavore.org, shabble@Freenode/#irssi', + "name" => 'URL Highlighter', + "description" => ' ', + "license" => 'WTFPL: http://sam.zoy.org/wtfpl/', + "version" => '0.1', + ); + +# regex taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls +my $url_regex = qr((?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))); + +sub handle_gui_print_text { + my ($win, $fg, $bg, $flags, $text, $text_dest) = @_; + if ($text =~ $url_regex) { + print "matched!"; + } +} + +Irssi::signal_add('gui print text', \&handle_gui_print_text); + diff --git a/.config/irssi/scripts/autorun/usercount.pl b/.config/irssi/scripts/autorun/usercount.pl @@ -0,0 +1,184 @@ +use strict; +use Irssi 20040119.2359 (); +use vars qw($VERSION %IRSSI); +$VERSION = "1.20"; +%IRSSI = ( + authors => 'David Leadbeater, Timo Sirainen, Georg Lukas', + contact => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de', + name => 'usercount', + description => 'Adds a usercount for a channel as a statusbar item', + sbitems => 'usercount', + license => 'GNU GPLv2 or later', + url => 'http://irssi.dgl.cx/', + changes => 'Only show halfops if server supports them', +); + +# Once you have loaded this script run the following command: +# /statusbar window add usercount +# You can also add -alignment left|right option + +# Settings: +# /toggle usercount_show_zero to show item even when there are no users +# /toggle usercount_show_ircops (default off) +# /toggle usercount_show_halfops (default on) + +# you can customize the look of this item from theme file: +# sb_usercount = "{sb %_$0%_ nicks ($1-)}"; +# sb_uc_ircops = "%_*%_$*"; +# sb_uc_ops = "%_@%_$*"; +# sb_uc_halfops = "%_%%%_$*"; +# sb_uc_voices = "%_+%_$*"; +# sb_uc_normal = "$*"; +# sb_uc_space = " "; + + +use Irssi::TextUI; + +my ($ircops, $ops, $halfops, $voices, $normal, $total); +my ($timeout_tag, $recalc); + +# Called to make the status bar item +sub usercount { + my ($item, $get_size_only) = @_; + my $wi = !Irssi::active_win() ? undef : Irssi::active_win()->{active}; + + if(!ref $wi || $wi->{type} ne "CHANNEL") { # only works on channels + return unless ref $item; + $item->{min_size} = $item->{max_size} = 0; + return; + } + + if ($recalc) { + $recalc = 0; + calc_users($wi); + } + + my $theme = Irssi::current_theme(); + my $format = $theme->format_expand("{sb_usercount}"); + if ($format) { + # use theme-specific look + my $ircopstr = $theme->format_expand("{sb_uc_ircops $ircops}", + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + my $opstr = $theme->format_expand("{sb_uc_ops $ops}", + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + my $halfopstr = $theme->format_expand("{sb_uc_halfops $halfops}", + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + my $voicestr = $theme->format_expand("{sb_uc_voices $voices}", + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + my $normalstr = $theme->format_expand("{sb_uc_normal $normal}", + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + my $space = $theme->format_expand('{sb_uc_space}', + Irssi::EXPAND_FLAG_IGNORE_EMPTY); + $space = " " unless $space; + + my $str = ""; + $str .= $ircopstr.$space if defined $ircops; + $str .= $opstr.$space if defined $ops; + $str .= $halfopstr.$space if defined $halfops; + $str .= $voicestr.$space if defined $voices; + $str .= $normalstr.$space if defined $normal; + $str =~ s/\Q$space\E$//; + + $format = $theme->format_expand("{sb_usercount $total $str}", + Irssi::EXPAND_FLAG_IGNORE_REPLACES); + } else { + # use the default look + $format = "{sb \%_$total\%_ nicks \%c(\%n"; + $format .= '*'.$ircops.' ' if (defined $ircops); + $format .= '@'.$ops.' ' if (defined $ops); + $format .= '%%'.$halfops.' ' if (defined $halfops); + $format .= "+$voices " if (defined $voices); + $format .= "$normal " if (defined $normal); + $format =~ s/ $//; + $format .= "\%c)}"; + } + + $item->default_handler($get_size_only, $format, undef, 1); +} + +sub calc_users() { + my $channel = shift; + my $server = $channel->{server}; + + $ircops = $ops = $halfops = $voices = $normal = 0; + for ($channel->nicks()) { + if ($_->{serverop}) { + $ircops++; + } + + if ($_->{op}) { + $ops++; + } elsif ($_->{halfop}) { + $halfops++; + } elsif ($_->{voice}) { + $voices++; + } else { + $normal++; + } + } + + $total = $ops+$halfops+$voices+$normal; + + if (!Irssi::settings_get_bool('usercount_show_zero')) { + $ircops = undef if ($ircops == 0); + $ops = undef if ($ops == 0); + $halfops = undef if ($halfops == 0); + $voices = undef if ($voices == 0); + $normal = undef if ($normal == 0); + } + + # Server doesn't support halfops? + if($server->can('isupport') && $server->isupport("PREFIX") !~ /\%/) { + $halfops = undef; + } else { + $halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops'); + } + + $ircops = undef unless Irssi::settings_get_bool('usercount_show_ircops'); +} + +sub refresh { + if ($timeout_tag > 0) { + Irssi::timeout_remove($timeout_tag); + $timeout_tag = 0; + } + Irssi::statusbar_items_redraw('usercount'); +} + +sub refresh_check { + my $channel = shift; + my $wi = ref Irssi::active_win() ? Irssi::active_win()->{active} : 0; + + return unless ref $wi && ref $channel; + return if $wi->{name} ne $channel->{name}; + return if $wi->{server}->{tag} ne $channel->{server}->{tag}; + + # don't refresh immediately, or we'll end up refreshing + # a lot around netsplits + $recalc = 1; + Irssi::timeout_remove($timeout_tag) if ($timeout_tag > 0); + $timeout_tag = Irssi::timeout_add(500, 'refresh', undef); +} + +sub refresh_recalc { + $recalc = 1; + refresh(); +} + +$recalc = 1; +$timeout_tag = 0; + +Irssi::settings_add_bool('usercount', 'usercount_show_zero', 1); +Irssi::settings_add_bool('usercount', 'usercount_show_ircops', 0); +Irssi::settings_add_bool('usercount', 'usercount_show_halfops', 1); + +Irssi::statusbar_item_register('usercount', undef, 'usercount'); +Irssi::statusbars_recreate_items(); + +Irssi::signal_add_last('nicklist new', 'refresh_check'); +Irssi::signal_add_last('nicklist remove', 'refresh_check'); +Irssi::signal_add_last('nick mode changed', 'refresh_check'); +Irssi::signal_add_last('setup changed', 'refresh_recalc'); +Irssi::signal_add_last('window changed', 'refresh_recalc'); +Irssi::signal_add_last('window item changed', 'refresh_recalc'); + diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf @@ -0,0 +1,4 @@ +l seek 5 +h seek -5 +j seek -60 +k seek 60 diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf @@ -0,0 +1,3 @@ +vo=gpu + +ytdl-format="(bestvideo[height<=1080]+bestaudio)[ext=webm]/bestvideo[height<=1080]+bestaudio/best[height<=1080]/bestvideo+bestaudio/best" diff --git a/.config/neofetch/config.conf b/.config/neofetch/config.conf @@ -0,0 +1,764 @@ +# 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 +} + + +# 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" + + +# 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 + + +# 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' +# 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%)' +disk_subtitle="mount" + + +# 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 +# iTunes +# juk +# lollypop +# mocp +# mopidy +# mpd +# netease-cloud-music +# pogo +# pragha +# qmmp +# quodlibet +# rhythmbox +# sayonara +# smplayer +# spotify +# strawberry +# 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 + + +# 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', +# '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: Arch and Ubuntu have 'old' logo variants. +# Change this to 'arch_old' or 'ubuntu_old' to use the old logos. +# NOTE: Ubuntu has flavor variants. +# Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME' or 'Ubuntu-Budgie' to use the flavors. +# NOTE: Arch, Crux and Gentoo have a smaller logo variant. +# Change this to 'arch_small', 'crux_small' or 'gentoo_small' to use the small logos. +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/newsboat/config b/.config/newsboat/config @@ -0,0 +1,31 @@ +#show-read-feeds no +auto-reload yes + +browser "vimb --no-maximize" +external-url-viewer "vimb --no-maximize" + +bind-key j down +bind-key k up +bind-key j next articlelist +bind-key k prev articlelist +bind-key J next-feed articlelist +bind-key K prev-feed articlelist +bind-key G end +bind-key g home +bind-key d pagedown +bind-key u pageup +bind-key l open +bind-key h quit +bind-key a toggle-article-read +bind-key n next-unread +bind-key N prev-unread +bind-key D pb-download +bind-key U show-urls +bind-key x pb-delete + +color listnormal white black +color listfocus white red bold +color listnormal_unread magenta black +color listfocus_unread magenta blue bold +color info black blue bold +color article white black diff --git a/.config/picom/config b/.config/picom/config @@ -0,0 +1,29 @@ +# compton/config +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +shadow=true +shadow-radius=10 +shadow-offset-x=-5 +shadow-offset-y=-5 + +shadow-exclude = [ + "class_g ?= 'dmenu'", + "class_g ?= 'i3bar'", +]; + +opacity-rule = [ + "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", + "90:class_g ?= 'urxvt'", + "90:class_g ?= 'i3bar'", + "100:name ?= 'fff'", + "90:class_g ?= 'vimb'", +]; + +fade-exclude = [ + "!_I3_FLOATING_WINDOW@:c", +]; + +inactive-dim = 0.2 diff --git a/.config/urxvt/ext/clipboard b/.config/urxvt/ext/clipboard @@ -0,0 +1,28 @@ +#! perl + +# Store this file as /usr/lib/urxvt/perl/xkr-clipboard +# +# To enable, add to ~/.Xresources: +# +# URxvt.perl-ext-common: default,xkr-clipboard +# URxvt.iso14755: false +# URxvt.keysym.Shift-Control-C: perl:clipboard:copy +# URxvt.keysym.Control-Insert: perl:clipboard:copy +# +# Based on +# https://wiki.archlinux.org/index.php/Rxvt-unicode#Custom_key_bindings +# rxvt-unicode-9.19 / src/perl/clipboard-osc + +sub on_user_command { + my ($self, $osc, $resp) = @_; + + return unless $osc =~ s/^clipboard:([^;]+)//; + + if ($1 eq "copy") { + my $text = $self->selection (); + $self->selection ($text, 1); + $self->selection_grab (urxvt::CurrentTime, 1); + } + + 1 +} diff --git a/.config/urxvt/ext/keyboard-select b/.config/urxvt/ext/keyboard-select @@ -0,0 +1,606 @@ +#! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# License: GPLv2 + +# Use keyboard shortcuts to select and copy text. + +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,keyboard-select +# URxvt.keysym.M-Escape: perl:keyboard-select:activate +# The following line overwrites the default Meta-s binding and allows to +# activate keyboard-select directly in backward search mode: +# URxvt.keysym.M-s: perl:keyboard-select:search + +# Use Meta-Escape to activate selection mode, then use the following keys: +# h/j/k/l: Move cursor left/down/up/right (also with arrow keys) +# g/G/0/^/$/H/M/L/f/F/;/,/w/W/b/B/e/E: More vi-like cursor movement keys +# '/'/?: Start forward/backward search +# n/N: Repeat last search, N: in reverse direction +# Ctrl-f/b: Scroll down/up one screen +# Ctrl-d/u: Scroll down/up half a screen +# v/V/Ctrl-v: Toggle normal/linewise/blockwise selection +# y/Return: Copy selection to primary buffer, Return: quit afterwards +# Y: Copy selected lines to primary buffer or cursor line and quit +# q/Escape: Quit keyboard selection mode + +# Options: +# URxvt.keyboard-select.clipboard: If true, copy to clipboard too + + +use strict; + +sub on_start{ + my ($self) = @_; + + $self->{clipboard} = $self->x_resource_boolean('keyboard-select.clipboard'); + + $self->{patterns}{'w'} = qr/\w[^\w\s]|\W\w|\s\S/; + $self->{patterns}{'W'} = qr/\s\S/; + $self->{patterns}{'b'} = qr/.*(?:\w[^\w\s]|\W\w|\s\S)/; + $self->{patterns}{'B'} = qr/.*\s\S/; + $self->{patterns}{'e'} = qr/[^\w\s](?=\w)|\w(?=\W)|\S(?=\s|$)/; + $self->{patterns}{'E'} = qr/\S(?=\s|$)/; + + () +} + + +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "keyboard-select:" . $action); +} + + +sub on_user_command { + my ($self, $cmd) = @_; + + if (not $self->{active}) { + if ($cmd eq 'keyboard-select:activate') { + activate($self); + } elsif ($cmd eq 'keyboard-select:search') { + activate($self, 1); + } + } + + () +} + + +sub key_press { + my ($self, $event, $keysym, $char) = @_; + my $key = chr($keysym); + + if (lc($key) eq 'c' && $event->{state} & urxvt::ControlMask) { + deactivate($self); + } elsif ($self->{search}) { + if ($keysym == 0xff1b) { + if ($self->{search_mode}) { + deactivate($self); + } else { + $self->{search} = ''; + status_area($self); + } + } elsif ($keysym == 0xff08) { + $self->{search} = substr($self->{search}, 0, -1); + if (not $self->{search} and $self->{search_mode}) { + deactivate($self); + } else { + status_area($self); + } + } elsif ($keysym == 0xff0d || + (lc($key) eq 'm' && $event->{state} & urxvt::ControlMask)) { + my $txt = substr($self->{search}, 1); + if ($txt) { + $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : + qr/\Q$txt\E/i; + } elsif ($self->{pattern}) { + delete $self->{pattern}; + } + $self->{search} = ''; + $self->screen_cur($self->{srhcr}, $self->{srhcc}); + if (not find_next($self)) { + if ($self->{search_mode}) { + deactivate($self); + } else { + status_area($self); + } + } + } elsif (length($char) > 0) { + $self->{search} .= $self->locale_decode($char); + my $txt = substr($self->{search}, 1); + if ($txt) { + $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : + qr/\Q$txt\E/i; + } elsif ($self->{pattern}) { + delete $self->{pattern}; + } + $self->screen_cur($self->{srhcr}, $self->{srhcc}); + find_next($self); + status_area($self); + } + } elsif ($self->{move_to}) { + if ($keysym == 0xff1b) { + $self->{move_to} = 0; + status_area($self); + } elsif (length($char) > 0) { + $self->{move_to} = 0; + $self->{patterns}{'f-1'} = qr/^.*\Q$key\E/; + $self->{patterns}{'f+1'} = qr/^.+?\Q$key\E/; + move_to($self, ';'); + status_area($self); + } + } elsif ($keysym == 0xff1b || lc($key) eq 'q') { + deactivate($self); + } elsif (lc($key) eq 'y' || $keysym == 0xff0d || + (lc($key) eq 'm' && $event->{state} & urxvt::ControlMask)) { + my $quit = 0; + if ($key eq 'Y' && $self->{select} ne 'l') { + $quit = !$self->{select}; + toggle_select($self, 'l'); + } + if ($self->{select}) { + my ($br, $bc, $er, $ec) = calc_span($self); + $ec = $self->line($er)->l if $self->{select} eq 'l'; + $self->selection_beg($br, $bc); + $self->selection_end($er, $ec); + $self->selection_make($event->{time}, $self->{select} eq 'b'); + if ($self->{clipboard}) { + $self->selection($self->selection(), 1); + $self->selection_grab($event->{time}, 1); + } + if (lc($key) eq 'y') { + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + $self->{select} = ''; + status_area($self); + $self->want_refresh(); + } else { + $quit = 1; + } + } + if ($quit) { + deactivate($self); + } + } elsif ($key eq 'V') { + toggle_select($self, 'l'); + } elsif ($key eq 'v') { + if ($event->{state} & urxvt::ControlMask) { + toggle_select($self, 'b'); + } else { + toggle_select($self, 'n'); + } + } elsif ($key eq 'k' || $keysym == 0xff52) { + move_cursor($self, 'k'); + } elsif ($key eq 'j' || $keysym == 0xff54) { + move_cursor($self, 'j'); + } elsif ($key eq 'h' || $keysym == 0xff51) { + move_cursor($self, 'h'); + } elsif ($key eq 'l' || $keysym == 0xff53) { + move_cursor($self, 'l'); + } elsif ($keysym == 0xff57) { + move_cursor($self, '$'); + } elsif ($keysym == 0xff50) { + move_cursor($self, '^'); + } elsif ('gG0^$HML' =~ m/\Q$key\E/ || + ('fbdu' =~ m/\Q$key\E/ && $event->{state} & urxvt::ControlMask)) { + move_cursor($self, $key); + } elsif (lc($key) eq 'f') { + $self->{move_to} = 1; + $self->{move_dir} = $key eq 'F' ? -1 : 1; + status_area($self, $key); + } elsif (';,wWbBeE' =~ m/\Q$key\E/) { + move_to($self, $key); + } elsif ($key eq '/' || $key eq '?') { + $self->{search} = $key; + $self->{search_dir} = $key eq '?' ? -1 : 1; + ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); + status_area($self); + } elsif (lc($key) eq 'n') { + find_next($self, $self->{search_dir} * ($key eq 'N' ? -1 : 1)); + } + + return 1; +} + + +sub move_cursor { + my ($self, $key) = @_; + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + + if ($key eq 'k' && $line->beg > $self->top_row) { + $cr = $line->beg - 1; + } elsif ($key eq 'j' && $line->end < $self->nrow - 1) { + $cr = $line->end + 1; + } elsif ($key eq 'h' && $self->{offset} > 0) { + $self->{offset} = $line->offset_of($cr, $cc) - 1; + $self->{dollar} = 0; + } elsif ($key eq 'l' && $self->{offset} < $line->l - 1) { + ++$self->{offset}; + } elsif ($key eq 'f' || $key eq 'd') { + my $vs = $self->view_start() + + ($key eq 'd' ? $self->nrow / 2 : $self->nrow - 1); + $vs = 0 if $vs > 0; + $cr += $vs - $self->view_start($vs); + } elsif ($key eq 'b' || $key eq 'u') { + my $vs = $self->view_start() - + ($key eq 'u' ? $self->nrow / 2 : $self->nrow - 1); + $vs = $self->top_row if $vs < $self->top_row; + $cr += $vs - $self->view_start($vs); + } elsif ($key eq 'g') { + ($cr, $self->{offset}) = ($self->top_row, 0); + $self->{dollar} = 0; + } elsif ($key eq 'G') { + ($cr, $self->{offset}) = ($self->nrow - 1, 0); + $self->{dollar} = 0; + } elsif ($key eq '0') { + $self->{offset} = 0; + $self->{dollar} = 0; + } elsif ($key eq '^') { + my $ltxt = $self->special_decode($line->t); + while ($ltxt =~ s/^( *)\t/$1 . " " x (8 - length($1) % 8)/e) {} + $self->{offset} = $ltxt =~ m/^ +/ ? $+[0] : 0; + $self->{dollar} = 0; + } elsif ($key eq '$') { + my $co = $line->offset_of($cr, $cc); + $self->{dollar} = $co + 1; + $self->{offset} = $line->l - 1; + } elsif ($key eq 'H') { + $cr = $self->view_start(); + } elsif ($key eq 'M') { + $cr = $self->view_start() + $self->nrow / 2; + } elsif ($key eq 'L') { + $cr = $self->view_start() + $self->nrow - 1; + } + + $line = $self->line($cr); + $cc = $self->{dollar} || $self->{offset} >= $line->l ? $line->l - 1 : + $self->{offset}; + $self->screen_cur($line->coord_of($cc)); + + status_area($self); + $self->want_refresh(); + + () +} + + +sub move_to { + my ($self, $key) = @_; + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + my $offset = $self->{offset}; + my ($dir, $pattern); + my ($wrap, $found) = (0, 0); + + if ($key eq ';' || $key eq ',') { + $dir = $self->{move_dir} * ($key eq ',' ? -1 : 1); + $pattern = $self->{patterns}{sprintf('f%+d', $dir)}; + return if not $pattern; + } else { + if (lc($key) eq 'b') { + $dir = -1; + } else { + $dir = 1; + ++$offset if lc($key) eq 'e'; + } + $pattern = $self->{patterns}{$key}; + $wrap = 1; + } + + if ($dir > 0) { + NEXTDOWN: my $text = substr($line->t, $offset); + if ($text =~ m/$pattern/) { + $offset += $+[0] - 1; + $found = 1; + } elsif ($wrap && $line->end + 1 < $self->nrow) { + $cr = $line->end + 1; + $line = $self->line($cr); + $offset = 0; + if (lc($key) eq 'e') { + goto NEXTDOWN; + } else { + $found = 1; + } + } + } elsif ($dir < 0) { + NEXTUP: my $text = substr($line->t, 0, $offset); + if ($text =~ m/$pattern/) { + $offset += $+[0] - length($text) - 1; + $found = 1; + } elsif ($wrap) { + if ($offset > 0) { + $offset = 0; + $found = 1; + } elsif ($line->beg > $self->top_row) { + $cr = $line->beg - 1; + $line = $self->line($cr); + $offset = $line->l; + goto NEXTUP; + } + } + } + + if ($found) { + $self->{dollar} = 0; + $self->{offset} = $offset; + $self->screen_cur($line->coord_of($offset)); + $self->want_refresh(); + } + + () +} + + +sub find_next { + my ($self, $dir) = @_; + + return if not $self->{pattern}; + $dir = $self->{search_dir} if not $dir; + + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + my $offset = $line->offset_of($cr, $cc); + my $text; + my $found = 0; + + ++$offset if $dir > 0; + + while (not $found) { + if ($dir > 0) { + $text = substr($line->t, $offset); + if ($text =~ m/$self->{pattern}/) { + $found = 1; + $offset += $-[0]; + } else { + last if $line->end >= $self->nrow; + $line = $self->line($line->end + 1); + $offset = 0; + } + } else { + $text = substr($line->t, 0, $offset); + if ($text =~ m/$self->{pattern}/) { + $found = 1; + $offset = $-[0] while $text =~ m/$self->{pattern}/g; + } else { + last if $line->beg <= $self->top_row; + $line = $self->line($line->beg - 1); + $offset = $line->l; + } + } + } + + if ($found) { + $self->{dollar} = 0; + $self->{offset} = $offset; + $self->screen_cur($line->coord_of($offset)); + status_area($self); + $self->want_refresh(); + } + + return $found; +} + + +sub tt_write { + return 1; +} + + +sub refresh { + my ($self) = @_; + my ($cr, $cc) = $self->screen_cur(); + + # scroll the current cursor position into visible area + if ($cr < $self->view_start()) { + $self->view_start($cr); + } elsif ($cr >= $self->view_start() + $self->nrow) { + $self->view_start($cr - $self->nrow + 1); + } + + if ($self->{select}) { + my ($hl, $reverse_cursor); + my ($br, $bc, $er, $ec) = calc_span($self); + + if ($self->x_resource('highlightColor')) { + $hl = urxvt::RS_Sel; + $reverse_cursor = 0; + } else { + $hl = urxvt::RS_RVid; + $reverse_cursor = $self->{select} ne 'l'; + } + if ($self->{select} eq 'b') { + my $co = $self->line($cr)->offset_of($cr, $cc); + my $dollar = $self->{dollar} && $co >= $self->{dollar} - 1; + + my $r = $br; + while ($r <= $er) { + my $line = $self->line($r); + if ($bc < $line->l) { + $ec = $line->l if $dollar; + my ($br, $bc) = $line->coord_of($bc); + my ($er, $ec) = $line->coord_of($ec <= $line->l ? $ec : $line->l); + $self->scr_xor_span($br, $bc, $er, $ec, $hl); + } elsif ($r == $cr) { + $reverse_cursor = 0; + } + $r = $line->end + 1; + } + } else { + $self->scr_xor_span($br, $bc, $er, $ec, $hl); + } + + if ($reverse_cursor) { + # make the cursor visible again + $self->scr_xor_span($cr, $cc, $cr, $cc + 1, $hl); + } + } + + () +} + + +sub activate { + my ($self, $search) = @_; + + $self->{active} = 1; + + $self->{select} = ''; + $self->{dollar} = 0; + $self->{move_to} = 0; + + if ($search) { + $self->{search} = '?'; + $self->{search_dir} = -1; + $self->{search_mode} = 1; + } else { + $self->{search} = ''; + $self->{search_mode} = 0; + } + + ($self->{oldcr}, $self->{oldcc}) = $self->screen_cur(); + ($self->{srhcr}, $self->{srhcc}) = $self->screen_cur(); + $self->{old_view_start} = $self->view_start(); + $self->{old_pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); + + my $line = $self->line($self->{oldcr}); + $self->{offset} = $line->offset_of($self->{oldcr}, $self->{oldcc}); + + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + + $self->enable( + key_press => \&key_press, + refresh_begin => \&refresh, + refresh_end => \&refresh, + tt_write => \&tt_write, + ); + + if ($self->{offset} >= $line->l) { + $self->{offset} = $line->l > 0 ? $line->l - 1 : 0; + $self->screen_cur($line->coord_of($self->{offset})); + $self->want_refresh(); + } + + $self->{overlay_len} = 0; + status_area($self); + + () +} + + +sub deactivate { + my ($self) = @_; + + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + + delete $self->{overlay} if $self->{overlay}; + + $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); + $self->screen_cur($self->{oldcr}, $self->{oldcc}); + $self->view_start($self->{old_view_start}); + $self->pty_ev_events($self->{old_pty_ev_events}); + + $self->want_refresh(); + + $self->{active} = 0; + + () +} + + +sub status_area { + my ($self, $extra) = @_; + my ($stat, $stat_len); + + if ($self->{search}) { + $stat_len = $self->ncol; + $stat = $self->{search} . ' ' x ($stat_len - length($self->{search})); + } else { + if ($self->{select}) { + $stat = "-V" . ($self->{select} ne 'n' ? uc($self->{select}) : "") . "- "; + } + + if ($self->top_row == 0) { + $stat .= "All"; + } elsif ($self->view_start() == $self->top_row) { + $stat .= "Top"; + } elsif ($self->view_start() == 0) { + $stat .= "Bot"; + } else { + $stat .= sprintf("%2d%%", + ($self->top_row - $self->view_start) * 100 / $self->top_row); + } + + $stat = "$extra $stat" if $extra; + $stat_len = length($stat); + } + + if (!$self->{overlay} || $self->{overlay_len} != $stat_len) { + delete $self->{overlay} if $self->{overlay}; + $self->{overlay} = $self->overlay(-1, -1, $stat_len, 1, + urxvt::OVERLAY_RSTYLE, 0); + $self->{overlay_len} = $stat_len; + } + + $self->{overlay}->set(0, 0, $self->special_encode($stat)); + $self->{overlay}->show(); + + () +} + + +sub toggle_select { + my ($self, $mode) = @_; + + if ($self->{select} eq $mode) { + $self->{select} = ''; + } else { + if (not $self->{select}) { + ($self->{ar}, $self->{ac}) = $self->screen_cur(); + } + $self->{select} = $mode; + } + + status_area($self); + $self->want_refresh(); + + () +} + + +sub calc_span { + my ($self) = @_; + my ($cr, $cc) = $self->screen_cur(); + my ($br, $bc, $er, $ec); + + if ($self->{select} eq 'b') { + $br = $self->line($cr)->beg; + $bc = $self->line($cr)->offset_of($cr, $cc); + $er = $self->line($self->{ar})->beg; + $ec = $self->line($self->{ar})->offset_of($self->{ar}, $self->{ac}); + ($br, $er) = ($er, $br) if $br > $er; + ($bc, $ec) = ($ec, $bc) if $bc > $ec; + } else { + if ($cr < $self->{ar}) { + ($br, $bc, $er, $ec) = ($cr, $cc, $self->{ar}, $self->{ac}); + } elsif ($cr > $self->{ar}) { + ($br, $bc, $er, $ec) = ($self->{ar}, $self->{ac}, $cr, $cc); + } else { + ($br, $er) = ($cr, $cr); + ($bc, $ec) = $cc < $self->{ac} ? ($cc, $self->{ac}) : ($self->{ac}, $cc); + } + } + + if ($self->{select} eq 'l') { + ($br, $er) = ($self->line($br)->beg, $self->line($er)->end); + ($bc, $ec) = (0, $self->ncol); + } else { + ++$ec; + } + + return ($br, $bc, $er, $ec); +} diff --git a/.config/urxvt/ext/resize-font b/.config/urxvt/ext/resize-font @@ -0,0 +1,169 @@ +# vim:ft=perl +# Copyright (c) 2009-, Simon Lundström <simmel@soy.se> +# Copyright (c) 2014 Maarten de Vries <maarten@de-vri.es> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +my @fonts = ( + {'name' => 'font', 'code' => 710}, + {'name' => 'boldFont', 'code' => 711}, + {'name' => 'italicFont', 'code' => 712}, + {'name' => 'boldItalicFont', 'code' => 713}, +); + +my @fixed = qw(4x6 5x7 5x8 6x9 6x10 6x12 6x13 7x13 7x14 8x13 8x16 9x15 9x18 + 10x20 12x24); +my $step; + +sub on_start { + my ($self) = @_; + + foreach (@fonts) { + $_->{'default'} = $self->resource($_->{'name'}); + } + + $step = $self->x_resource("%.step") || 2; +} + +sub on_init { + my ($self) = @_; + my $commands = { + "smaller" => "C-minus", + "bigger" => "C-plus", + "reset" => "C-equal", + "show" => "C-question", + }; + bind_hotkeys($self, $commands); + + () +} + +sub bind_hotkeys { + my ($self, $commands) = @_; + + for (keys %$commands) { + my $hotkey = $$commands{$_}; + my $hotkey_bound = $self->{'term'}->x_resource("keysym.$hotkey"); + if (!defined($hotkey_bound) ) { + # Support old-style key bindings + if ($self->x_resource("%.$_")) { + $hotkey = $self->x_resource("%.$_"); + } + + # FIXME If we're bound to a keysym, don't bind the default. + $self->bind_action($hotkey, "%:$_") or + warn "unable to register '$hotkey' as hotkey for $_"; + } + else { + if ($hotkey_bound !~ /^resize-font:/) { + warn "Hotkey $$commands{$_} already bound to $hotkey_bound, not ". + "binding to resize-font:$_ by default."; + } + } + } +} + +sub on_action { + my ($self, $string) = @_; + + if ($string eq "bigger") { + foreach (@fonts) { + next if not defined($_->{'default'}); + update_font_size($self, $_, +$step); + } + } + elsif ($string eq "smaller") { + foreach (@fonts) { + next if not defined($_->{'default'}); + update_font_size($self, $_, -$step); + } + } + elsif ($string eq "reset") { + foreach (@fonts) { + next if not defined($_->{'default'}); + set_font($self, $_, $_->{'default'}); + } + } + elsif ($string eq "show") { + + my $term = $self->{'term'}; + $term->{'resize-font'}{'overlay'} = { + ov => $term->overlay_simple(0, -1, format_font_info($self)), + to => urxvt::timer + ->new + ->start(urxvt::NOW + 1) + ->cb(sub { + delete $term->{'resize-font'}{'overlay'}; + }), + }; + } + + () +} + +sub get_font { + my ($self, $name) = @_; + return $self->resource($name); +} + +sub set_font { + my ($self, $font, $new) = @_; + $self->cmd_parse(sprintf("\33]%d;%s\007", $font->{'code'}, $new)); +} + +sub update_font_size { + my ($self, $font, $delta) = @_; + my $regex = qr"(?<=size=)(\d+)"; + my $current = get_font($self, $font->{'name'}); + + my ($index) = grep { $fixed[$_] eq $current } 0..$#fixed; + if ($index or $index eq 0) { + my $inc = $delta / abs($delta); + $index += $inc; + if ($index < 0) { $index = 0; } + if ($index > $#fixed) { $index = $#fixed; } + $current = $fixed[$index]; + } + elsif ($current =~ /^-/) { + my @font = split(/-/, $current); + # https://en.wikipedia.org/wiki/X_logical_font_description + my $newsize = $font[7]+$delta; + $font[7] = $newsize if ($newsize > 0); + $current = join('-', @font); + } + else { + my $newsize = $1+$delta if ($current =~ /$regex/); + $current =~ s/$regex/$newsize/ge if ($newsize > 0); + } + set_font($self, $font, $current); +} + +sub format_font_info { + my ($self) = @_; + + my $width = 0; + foreach (@fonts) { + my $length = length($_->{'name'}); + $width = $length > $width ? $length : $width; + } + ++$width; + + my $info = ''; + foreach (@fonts) { + $info .= sprintf("%-${width}s %s\n", $_->{'name'} . ':', + get_font($self, $_->{'name'})); + } + + return $info; +} diff --git a/.config/urxvt/ext/url-select b/.config/urxvt/ext/url-select @@ -0,0 +1,408 @@ +#! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# Based on: http://www.jukie.net/~bart/blog/urxvt-url-yank +# License: GPLv2 + +# Use keyboard shortcuts to select URLs. +# This should be used as a replacement for the default matcher extension, +# it also makes URLs clickable with the middle mouse button. + +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,url-select +# URxvt.keysym.M-u: perl:url-select:select_next + +# Use Meta-u to activate URL selection mode, then use the following keys: +# j/k: Select next downward/upward URL (also with arrow keys) +# g/G: Select first/last URL (also with home/end key) +# o/Return: Open selected URL in browser, Return: deactivate afterwards +# y: Copy (yank) selected URL and deactivate selection mode +# q/Escape: Deactivate URL selection mode + +# Options: +# URxvt.url-select.autocopy: If true, selected URLs are copied to PRIMARY +# URvxt.url-select.button: Mouse button to click-open URLs (default: 2) +# URxvt.url-select.launcher: Browser/command to open selected URL with +# URxvt.url-select.underline: If set to true, all URLs get underlined + +use strict; + +# The custom rendition bit to use for marking the cell as being underlined +# by us so we can unset it again after a line has changed. +use constant UNDERLINED => 1<<3; # arbitrarily chosen in hope of no collision + +sub on_start { + my ($self) = @_; + + # read resource settings + if ($self->x_resource('url-select.launcher')) { + @{$self->{browser}} = split /\s+/, $self->x_resource('url-select.launcher'); + } else { + @{$self->{browser}} = ('x-www-browser'); + } + if ($self->x_resource('url-select.underline') eq 'true') { + $self->enable(line_update => \&line_update); + } + if ($self->x_resource('url-select.autocopy') eq 'true') { + $self->{autocopy} = 1; + } + + $self->{state} = 0; + + for my $mod (split '', $self->x_resource("url-select.button") || + $self->x_resource("matcher.button") || 2) { + if ($mod =~ /^\d+$/) { + $self->{button} = $mod; + } elsif ($mod eq "C") { + $self->{state} |= urxvt::ControlMask; + } elsif ($mod eq "S") { + $self->{state} |= urxvt::ShiftMask; + } elsif ($mod eq "M") { + $self->{state} |= $self->ModMetaMask; + } elsif ($mod ne "-" && $mod ne " ") { + warn("invalid button/modifier in $self->{_name}<$self->{argv}[0]>: $mod\n"); + } + } + + if ($self->x_resource('matcher.pattern')) { + @{$self->{pattern}} = ($self->x_resource('matcher.pattern')); + } elsif ($self->x_resource('matcher.pattern.0')) { + my $current = 0; + + while (defined (my $res = $self->x_resource("matcher.pattern.$current"))) { + $res = $self->locale_decode($res); + utf8::encode $res; + push @{$self->{pattern}}, qr($res)x; + $current++; + } + } else { + @{$self->{pattern}} = qr{ + (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) + [\w\-\@;\/?:&=%\$.+!*\x27,~#]* + ( + \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses + | # + [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) + )+ + }x; + } + + () +} + + +sub line_update { + my ($self, $row) = @_; + + my $line = $self->line($row); + my $text = $line->t; + my $rend = $line->r; + + # clear all underlines that were set by us + for (@$rend) { + if (urxvt::GET_CUSTOM($_) & UNDERLINED) { + $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) & ~UNDERLINED) & + ~urxvt::RS_Uline; + } + } + + for my $pattern (@{$self->{pattern}}) { + while ($text =~ /$pattern/g) { + my $url = $&; + my ($beg, $end) = ($-[0], $+[0] - 1); + + for (@{$rend}[$beg .. $end]) { + unless ($_ & urxvt::RS_Uline) { + $_ = urxvt::SET_CUSTOM($_, urxvt::GET_CUSTOM($_) | UNDERLINED); + $_ |= urxvt::RS_Uline; + } + } + } + } + + $line->r($rend); + + () +} + +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "url-select:" . $action); +} + + +sub on_user_command { + my ($self, $cmd) = @_; + + if ($cmd eq 'url-select:select_next') { + if (not $self->{active}) { + activate($self); + } + select_next($self, -1); + } + + () +} + + +sub key_press { + my ($self, $event, $keysym) = @_; + my $char = chr($keysym); + + if ($keysym == 0xff1b || lc($char) eq 'q' || + (lc($char) eq 'c' && $event->{state} & urxvt::ControlMask)) { + deactivate($self); + } elsif ($keysym == 0xff0d || $char eq 'o' || + (lc($char) eq 'm' && $event->{state} & urxvt::ControlMask)) { + $self->exec_async(@{$self->{browser}}, ${$self->{found}[$self->{n}]}[4]); + deactivate($self) unless $char eq 'o'; + } elsif ($char eq 'y') { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + deactivate($self); + } elsif ($char eq 'k' || $keysym == 0xff52 || $keysym == 0xff51) { + select_next($self, -1, $event); + } elsif ($char eq 'j' || $keysym == 0xff54 || $keysym == 0xff53) { + select_next($self, 1, $event); + } elsif ($char eq 'g' || $keysym == 0xff50) { + $self->{row} = $self->top_row - 1; + delete $self->{found}; + select_next($self, 1, $event); + } elsif ($char eq 'G' || $keysym == 0xff57) { + $self->{row} = $self->nrow; + delete $self->{found}; + select_next($self, -1, $event); + } + + return 1; +} + + +sub on_button_press { + my ($self, $event) = @_; + + my $mask = $self->ModLevel3Mask | $self->ModMetaMask | + urxvt::ShiftMask | urxvt::ControlMask; + + if ($event->{button} == $self->{button} && ($event->{state} & $mask) == $self->{state}) { + my $col = $event->{col}; + my $row = $event->{row}; + my $line = $self->line($row); + my $text = $line->t; + + for my $pattern (@{$self->{pattern}}) { + while ($text =~ /$pattern/g) { + my ($url, $beg, $end) = ($&, $-[0], $+[0]); + --$end if $url =~ s/["')]$//; + + if ($col >= $beg && $col <= $end) { + $self->{button_pressed} = 1; + $self->{button_col} = $col; + $self->{button_row} = $row; + $self->{button_url} = $url; + return 1; + } + } + } + } + + () +} + +sub on_button_release { + my ($self, $event) = @_; + + if ($self->{button_pressed} && $event->{button} == $self->{button}) { + my $col = $event->{col}; + my $row = $event->{row}; + + $self->{button_pressed} = 0; + + if ($col == $self->{button_col} && $row == $self->{button_row}) { + $self->exec_async(@{$self->{browser}}, $self->{button_url}); + return 1; + } + } + + () +} + + +sub select_next { + # $dir < 0: up, > 0: down + my ($self, $dir, $event) = @_; + my $row = $self->{row}; + + if (($dir < 0 && $self->{n} > 0) || + ($dir > 0 && $self->{n} < $#{ $self->{found} })) { + # another url on current line + $self->{n} += $dir; + hilight($self); + if ($self->{autocopy}) { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + } + return; + } + + while (($dir < 0 && $row > $self->top_row) || + ($dir > 0 && $row < $self->nrow - 1)) { + my $line = $self->line($row); + $row = ($dir < 0 ? $line->beg : $line->end) + $dir; + $line = $self->line($row); + my $text = $line->t; + + for my $pattern (@{$self->{pattern}}) { + if ($text =~ /$pattern/g) { + delete $self->{found}; + + do { + my ($beg, $end) = ($-[0], $+[0]); + push @{$self->{found}}, [$line->coord_of($beg), + $line->coord_of($end), substr($text, $beg, $end - $beg)]; + } while ($text =~ /$pattern/g); + + $self->{row} = $row; + $self->{n} = $dir < 0 ? $#{$self->{found}} : 0; + hilight($self); + if ($self->{autocopy}) { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + } + return; + } + } + } + + deactivate($self) unless $self->{found}; + + () +} + + +sub hilight { + my ($self) = @_; + + if ($self->{found}) { + if ($self->{row} < $self->view_start() || + $self->{row} >= $self->view_start() + $self->nrow) { + # scroll selected url into visible area + my $top = $self->{row} - ($self->nrow >> 1); + $self->view_start($top < 0 ? $top : 0); + } + + status_area($self); + $self->want_refresh(); + } + + () +} + + +sub refresh { + my ($self) = @_; + + if ($self->{found}) { + if ($self->x_resource('highlightColor')) { + $self->scr_xor_span(@{$self->{found}[$self->{n}]}[0 .. 3], urxvt::RS_Sel); + } else { + $self->scr_xor_span(@{$self->{found}[$self->{n}]}[0 .. 3], urxvt::RS_RVid); + } + } + + () +} + + +sub status_area { + my ($self) = @_; + + my $row = $self->{row} < 0 ? + $self->{row} - $self->top_row : abs($self->top_row) + $self->{row}; + my $text = sprintf("%d,%d ", $row + 1, $self->{n} + 1); + + if ($self->top_row == 0) { + $text .= "All"; + } elsif ($self->view_start() == $self->top_row) { + $text .= "Top"; + } elsif ($self->view_start() == 0) { + $text .= "Bot"; + } else { + $text .= sprintf("%2d%", + ($self->top_row - $self->view_start) * 100 / $self->top_row); + } + + my $text_len = length($text); + + if ($self->{overlay_len} != $text_len) { + delete $self->{overlay} if $self->{overlay}; + $self->{overlay} = $self->overlay(-1, -1, $text_len, 1, + urxvt::OVERLAY_RSTYLE, 0); + $self->{overlay_len} = $text_len; + } + + $self->{overlay}->set(0, 0, $self->special_encode($text)); + $self->{overlay}->show(); + + () +} + + +sub tt_write { + return 1; +} + + +sub activate { + my ($self) = @_; + + $self->{active} = 1; + + $self->{row} = $self->view_start() + $self->nrow; + $self->{n} = 0; + $self->{overlay_len} = 0; + $self->{button_pressed} = 0; + + $self->{view_start} = $self->view_start(); + $self->{pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); + + $self->enable( + key_press => \&key_press, + refresh_begin => \&refresh, + refresh_end => \&refresh, + tt_write => \&tt_write, + ); + + () +} + + +sub deactivate { + my ($self) = @_; + + $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); + $self->view_start($self->{view_start}); + $self->pty_ev_events($self->{pty_ev_events}); + + delete $self->{overlay} if $self->{overlay}; + delete $self->{found} if $self->{found}; + + $self->want_refresh(); + + $self->{active} = 0; + + () +} diff --git a/.config/vim/autoload/commentary.vim b/.config/vim/autoload/commentary.vim @@ -0,0 +1,117 @@ +" commentary.vim - Comment stuff out +" Maintainer: Tim Pope <http://tpo.pe/> +" Version: 1.3 +" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim + +if exists("g:loaded_commentary") || v:version < 700 + finish +endif +let g:loaded_commentary = 1 + +function! s:surroundings() abort + return split(get(b:, 'commentary_format', substitute(substitute(substitute( + \ &commentstring, '^$', '%s', ''), '\S\zs%s',' %s', '') ,'%s\ze\S', '%s ', '')), '%s', 1) +endfunction + +function! s:strip_white_space(l,r,line) abort + let [l, r] = [a:l, a:r] + if l[-1:] ==# ' ' && stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0 + let l = l[:-2] + endif + if r[0] ==# ' ' && a:line[-strlen(r):] != r && a:line[1-strlen(r):] == r[1:] + let r = r[1:] + endif + return [l, r] +endfunction + +function! s:go(...) abort + if !a:0 + let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$') + return 'g@' + elseif a:0 > 1 + let [lnum1, lnum2] = [a:1, a:2] + else + let [lnum1, lnum2] = [line("'["), line("']")] + endif + + let [l, r] = s:surroundings() + let uncomment = 2 + for lnum in range(lnum1,lnum2) + let line = matchstr(getline(lnum),'\S.*\s\@<!') + let [l, r] = s:strip_white_space(l,r,line) + if len(line) && (stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r) + let uncomment = 0 + endif + endfor + + if get(b:, 'commentary_startofline') + let indent = '^' + else + let indent = '^\s*' + endif + + for lnum in range(lnum1,lnum2) + let line = getline(lnum) + if strlen(r) > 2 && l.r !~# '\\' + let line = substitute(line, + \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], + \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') + endif + if uncomment + let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','') + else + let line = substitute(line,'^\%('.matchstr(getline(lnum1),indent).'\|\s*\)\zs.*\S\@<=','\=l.submatch(0).r','') + endif + call setline(lnum,line) + endfor + let modelines = &modelines + try + set modelines=0 + silent doautocmd User CommentaryPost + finally + let &modelines = modelines + endtry + return '' +endfunction + +function! s:textobject(inner) abort + let [l, r] = s:surroundings() + let lnums = [line('.')+1, line('.')-2] + for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']] + while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r) + let lnums[index] += dir + let line = matchstr(getline(lnums[index]+dir),'\S.*\s\@<!') + let [l, r] = s:strip_white_space(l,r,line) + endwhile + endfor + while (a:inner || lnums[1] != line('$')) && empty(getline(lnums[0])) + let lnums[0] += 1 + endwhile + while a:inner && empty(getline(lnums[1])) + let lnums[1] -= 1 + endwhile + if lnums[0] <= lnums[1] + execute 'normal! 'lnums[0].'GV'.lnums[1].'G' + endif +endfunction + +command! -range -bar Commentary call s:go(<line1>,<line2>) +xnoremap <expr> <Plug>Commentary <SID>go() +nnoremap <expr> <Plug>Commentary <SID>go() +nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_' +onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(get(v:, 'operator', '') ==# 'c')<CR> +nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR> +nmap <silent> <Plug>CommentaryUndo :echoerr "Change your <Plug>CommentaryUndo map to <Plug>Commentary<Plug>Commentary"<CR> + +if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# '' + xmap gc <Plug>Commentary + nmap gc <Plug>Commentary + omap gc <Plug>Commentary + nmap gcc <Plug>CommentaryLine + if maparg('c','n') ==# '' && !exists('v:operator') + nmap cgc <Plug>ChangeCommentary + endif + nmap gcu <Plug>Commentary<Plug>Commentary +endif + +" vim:set et sw=2: diff --git a/.config/vim/autoload/repeat.vim b/.config/vim/autoload/repeat.vim @@ -0,0 +1,165 @@ +" repeat.vim - Let the repeat command repeat plugin maps +" Maintainer: Tim Pope +" Version: 1.2 +" GetLatestVimScripts: 2136 1 :AutoInstall: repeat.vim + +" Installation: +" Place in either ~/.vim/plugin/repeat.vim (to load at start up) or +" ~/.vim/autoload/repeat.vim (to load automatically as needed). +" +" License: +" Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +" See :help license +" +" Developers: +" Basic usage is as follows: +" +" silent! call repeat#set("\<Plug>MappingToRepeatCommand",3) +" +" The first argument is the mapping that will be invoked when the |.| key is +" pressed. Typically, it will be the same as the mapping the user invoked. +" This sequence will be stuffed into the input queue literally. Thus you must +" encode special keys by prefixing them with a backslash inside double quotes. +" +" The second argument is the default count. This is the number that will be +" prefixed to the mapping if no explicit numeric argument was given. The +" value of the v:count variable is usually correct and it will be used if the +" second parameter is omitted. If your mapping doesn't accept a numeric +" argument and you never want to receive one, pass a value of -1. +" +" Make sure to call the repeat#set function _after_ making changes to the +" file. +" +" For mappings that use a register and want the same register used on +" repetition, use: +" +" silent! call repeat#setreg("\<Plug>MappingToRepeatCommand", v:register) +" +" This function can (and probably needs to be) called before making changes to +" the file (as those typically clear v:register). Therefore, the call sequence +" in your mapping will look like this: +" +" nnoremap <silent> <Plug>MyMap +" \ :<C-U>execute 'silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)'<Bar> +" \ call <SID>MyFunction(v:register, ...)<Bar> +" \ silent! call repeat#set("\<lt>Plug>MyMap")<CR> + +if exists("g:loaded_repeat") || &cp || v:version < 700 + finish +endif +let g:loaded_repeat = 1 + +let g:repeat_tick = -1 +let g:repeat_reg = ['', ''] + +" Special function to avoid spurious repeats in a related, naturally repeating +" mapping when your repeatable mapping doesn't increase b:changedtick. +function! repeat#invalidate() + autocmd! repeat_custom_motion + let g:repeat_tick = -1 +endfunction + +function! repeat#set(sequence,...) + let g:repeat_sequence = a:sequence + let g:repeat_count = a:0 ? a:1 : v:count + let g:repeat_tick = b:changedtick + augroup repeat_custom_motion + autocmd! + autocmd CursorMoved <buffer> let g:repeat_tick = b:changedtick | autocmd! repeat_custom_motion + augroup END +endfunction + +function! repeat#setreg(sequence,register) + let g:repeat_reg = [a:sequence, a:register] +endfunction + + +function! s:default_register() + let values = split(&clipboard, ',') + if index(values, 'unnamedplus') != -1 + return '+' + elseif index(values, 'unnamed') != -1 + return '*' + else + return '"' + endif +endfunction + +function! repeat#run(count) + try + if g:repeat_tick == b:changedtick + let r = '' + if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1]) + " Take the original register, unless another (non-default, we + " unfortunately cannot detect no vs. a given default register) + " register has been supplied to the repeat command (as an + " explicit override). + let regname = v:register ==# s:default_register() ? g:repeat_reg[1] : v:register + if regname ==# '=' + " This causes a re-evaluation of the expression on repeat, which + " is what we want. + let r = '"=' . getreg('=', 1) . "\<CR>" + else + let r = '"' . regname + endif + endif + + let c = g:repeat_count + let s = g:repeat_sequence + let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : '')) + if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) + exe 'norm ' . r . cnt . s + elseif v:version <= 703 + call feedkeys(r . cnt, 'n') + call feedkeys(s, '') + else + call feedkeys(s, 'i') + call feedkeys(r . cnt, 'ni') + endif + else + if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) + exe 'norm! '.(a:count ? a:count : '') . '.' + else + call feedkeys((a:count ? a:count : '') . '.', 'ni') + endif + endif + catch /^Vim(normal):/ + return 'echoerr v:errmsg' + endtry + return '' +endfunction + +function! repeat#wrap(command,count) + let preserve = (g:repeat_tick == b:changedtick) + call feedkeys((a:count ? a:count : '').a:command, 'n') + exe (&foldopen =~# 'undo\|all' ? 'norm! zv' : '') + if preserve + let g:repeat_tick = b:changedtick + endif +endfunction + +nnoremap <silent> <Plug>(RepeatDot) :<C-U>exe repeat#run(v:count)<CR> +nnoremap <silent> <Plug>(RepeatUndo) :<C-U>call repeat#wrap('u',v:count)<CR> +nnoremap <silent> <Plug>(RepeatUndoLine) :<C-U>call repeat#wrap('U',v:count)<CR> +nnoremap <silent> <Plug>(RepeatRedo) :<C-U>call repeat#wrap("\<Lt>C-R>",v:count)<CR> + +if !hasmapto('<Plug>(RepeatDot)', 'n') + nmap . <Plug>(RepeatDot) +endif +if !hasmapto('<Plug>(RepeatUndo)', 'n') + nmap u <Plug>(RepeatUndo) +endif +if maparg('U','n') ==# '' && !hasmapto('<Plug>(RepeatUndoLine)', 'n') + nmap U <Plug>(RepeatUndoLine) +endif +if !hasmapto('<Plug>(RepeatRedo)', 'n') + nmap <C-R> <Plug>(RepeatRedo) +endif + +augroup repeatPlugin + autocmd! + autocmd BufLeave,BufWritePre,BufReadPre * let g:repeat_tick = (g:repeat_tick == b:changedtick || g:repeat_tick == 0) ? 0 : -1 + autocmd BufEnter,BufWritePost * if g:repeat_tick == 0|let g:repeat_tick = b:changedtick|endif +augroup END + +" vim:set ft=vim et sw=4 sts=4: diff --git a/.config/vim/autoload/surround.vim b/.config/vim/autoload/surround.vim @@ -0,0 +1,619 @@ +" surround.vim - Surroundings +" Author: Tim Pope <http://tpo.pe/> +" Version: 2.1 +" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim + +if exists("g:loaded_surround") || &cp || v:version < 700 + finish +endif +let g:loaded_surround = 1 + +" Input functions {{{1 + +function! s:getchar() + let c = getchar() + if c =~ '^\d\+$' + let c = nr2char(c) + endif + return c +endfunction + +function! s:inputtarget() + let c = s:getchar() + while c =~ '^\d\+$' + let c .= s:getchar() + endwhile + if c == " " + let c .= s:getchar() + endif + if c =~ "\<Esc>\|\<C-C>\|\0" + return "" + else + return c + endif +endfunction + +function! s:inputreplacement() + let c = s:getchar() + if c == " " + let c .= s:getchar() + endif + if c =~ "\<Esc>" || c =~ "\<C-C>" + return "" + else + return c + endif +endfunction + +function! s:beep() + exe "norm! \<Esc>" + return "" +endfunction + +function! s:redraw() + redraw + return "" +endfunction + +" }}}1 + +" Wrapping functions {{{1 + +function! s:extractbefore(str) + if a:str =~ '\r' + return matchstr(a:str,'.*\ze\r') + else + return matchstr(a:str,'.*\ze\n') + endif +endfunction + +function! s:extractafter(str) + if a:str =~ '\r' + return matchstr(a:str,'\r\zs.*') + else + return matchstr(a:str,'\n\zs.*') + endif +endfunction + +function! s:fixindent(str,spc) + let str = substitute(a:str,'\t',repeat(' ',&sw),'g') + let spc = substitute(a:spc,'\t',repeat(' ',&sw),'g') + let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g') + if ! &et + let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g') + endif + return str +endfunction + +function! s:process(string) + let i = 0 + for i in range(7) + let repl_{i} = '' + let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) + if m != '' + let m = substitute(strpart(m,1),'\r.*','','') + let repl_{i} = input(match(m,'\w\+$') >= 0 ? m.': ' : m) + endif + endfor + let s = "" + let i = 0 + while i < strlen(a:string) + let char = strpart(a:string,i,1) + if char2nr(char) < 8 + let next = stridx(a:string,char,i+1) + if next == -1 + let s .= char + else + let insertion = repl_{char2nr(char)} + let subs = strpart(a:string,i+1,next-i-1) + let subs = matchstr(subs,'\r.*') + while subs =~ '^\r.*\r' + let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*") + let subs = strpart(subs,strlen(sub)+1) + let r = stridx(sub,"\r") + let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'') + endwhile + let s .= insertion + let i = next + endif + else + let s .= char + endif + let i += 1 + endwhile + return s +endfunction + +function! s:wrap(string,char,type,removed,special) + let keeper = a:string + let newchar = a:char + let s:input = "" + let type = a:type + let linemode = type ==# 'V' ? 1 : 0 + let before = "" + let after = "" + if type ==# "V" + let initspaces = matchstr(keeper,'\%^\s*') + else + let initspaces = matchstr(getline('.'),'\%^\s*') + endif + let pairs = "b()B{}r[]a<>" + let extraspace = "" + if newchar =~ '^ ' + let newchar = strpart(newchar,1) + let extraspace = ' ' + endif + let idx = stridx(pairs,newchar) + if newchar == ' ' + let before = '' + let after = '' + elseif exists("b:surround_".char2nr(newchar)) + let all = s:process(b:surround_{char2nr(newchar)}) + let before = s:extractbefore(all) + let after = s:extractafter(all) + elseif exists("g:surround_".char2nr(newchar)) + let all = s:process(g:surround_{char2nr(newchar)}) + let before = s:extractbefore(all) + let after = s:extractafter(all) + elseif newchar ==# "p" + let before = "\n" + let after = "\n\n" + elseif newchar ==# 's' + let before = ' ' + let after = '' + elseif newchar ==# ':' + let before = ':' + let after = '' + elseif newchar =~# "[tT\<C-T><]" + let dounmapp = 0 + let dounmapb = 0 + if !maparg(">","c") + let dounmapb = 1 + " Hide from AsNeeded + exe "cn"."oremap > ><CR>" + endif + let default = "" + if newchar ==# "T" + if !exists("s:lastdel") + let s:lastdel = "" + endif + let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') + endif + let tag = input("<",default) + if dounmapb + silent! cunmap > + endif + let s:input = tag + if tag != "" + let keepAttributes = ( match(tag, ">$") == -1 ) + let tag = substitute(tag,'>*$','','') + let attributes = "" + if keepAttributes + let attributes = matchstr(a:removed, '<[^ \t\n]\+\zs\_.\{-\}\ze>') + endif + let s:input = tag . '>' + if tag =~ '/$' + let tag = substitute(tag, '/$', '', '') + let before = '<'.tag.attributes.' />' + let after = '' + else + let before = '<'.tag.attributes.'>' + let after = '</'.substitute(tag,' .*','','').'>' + endif + if newchar == "\<C-T>" + if type ==# "v" || type ==# "V" + let before .= "\n\t" + endif + if type ==# "v" + let after = "\n". after + endif + endif + endif + elseif newchar ==# 'l' || newchar == '\' + " LaTeX + let env = input('\begin{') + if env != "" + let s:input = env."\<CR>" + let env = '{' . env + let env .= s:closematch(env) + echo '\begin'.env + let before = '\begin'.env + let after = '\end'.matchstr(env,'[^}]*').'}' + endif + elseif newchar ==# 'f' || newchar ==# 'F' + let fnc = input('function: ') + if fnc != "" + let s:input = fnc."\<CR>" + let before = substitute(fnc,'($','','').'(' + let after = ')' + if newchar ==# 'F' + let before .= ' ' + let after = ' ' . after + endif + endif + elseif newchar ==# "\<C-F>" + let fnc = input('function: ') + let s:input = fnc."\<CR>" + let before = '('.fnc.' ' + let after = ')' + elseif idx >= 0 + let spc = (idx % 3) == 1 ? " " : "" + let idx = idx / 3 * 3 + let before = strpart(pairs,idx+1,1) . spc + let after = spc . strpart(pairs,idx+2,1) + elseif newchar == "\<C-[>" || newchar == "\<C-]>" + let before = "{\n\t" + let after = "\n}" + elseif newchar !~ '\a' + let before = newchar + let after = newchar + else + let before = '' + let after = '' + endif + let after = substitute(after ,'\n','\n'.initspaces,'g') + if type ==# 'V' || (a:special && type ==# "v") + let before = substitute(before,' \+$','','') + let after = substitute(after ,'^ \+','','') + if after !~ '^\n' + let after = initspaces.after + endif + if keeper !~ '\n$' && after !~ '^\n' + let keeper .= "\n" + elseif keeper =~ '\n$' && after =~ '^\n' + let after = strpart(after,1) + endif + if keeper !~ '^\n' && before !~ '\n\s*$' + let before .= "\n" + if a:special + let before .= "\t" + endif + elseif keeper =~ '^\n' && before =~ '\n\s*$' + let keeper = strcharpart(keeper,1) + endif + if type ==# 'V' && keeper =~ '\n\s*\n$' + let keeper = strcharpart(keeper,0,strchars(keeper) - 1) + endif + endif + if type ==# 'V' + let before = initspaces.before + endif + if before =~ '\n\s*\%$' + if type ==# 'v' + let keeper = initspaces.keeper + endif + let padding = matchstr(before,'\n\zs\s\+\%$') + let before = substitute(before,'\n\s\+\%$','\n','') + let keeper = s:fixindent(keeper,padding) + endif + if type ==# 'V' + let keeper = before.keeper.after + elseif type =~ "^\<C-V>" + " Really we should be iterating over the buffer + let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g') + let repl = substitute(repl,'\n',' ','g') + let keeper = substitute(keeper."\n",'\(.\{-\}\)\(\n\)',repl.'\n','g') + let keeper = substitute(keeper,'\n\%$','','') + else + let keeper = before.extraspace.keeper.extraspace.after + endif + return keeper +endfunction + +function! s:wrapreg(reg,char,removed,special) + let orig = getreg(a:reg) + let type = substitute(getregtype(a:reg),'\d\+$','','') + let new = s:wrap(orig,a:char,type,a:removed,a:special) + call setreg(a:reg,new,type) +endfunction +" }}}1 + +function! s:insert(...) " {{{1 + " Optional argument causes the result to appear on 3 lines, not 1 + let linemode = a:0 ? a:1 : 0 + let char = s:inputreplacement() + while char == "\<CR>" || char == "\<C-S>" + " TODO: use total count for additional blank lines + let linemode += 1 + let char = s:inputreplacement() + endwhile + if char == "" + return "" + endif + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let reg_save = @@ + call setreg('"',"\r",'v') + call s:wrapreg('"',char,"",linemode) + " If line mode is used and the surrounding consists solely of a suffix, + " remove the initial newline. This fits a use case of mine but is a + " little inconsistent. Is there anyone that would prefer the simpler + " behavior of just inserting the newline? + if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0 + call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"')) + endif + " This can be used to append a placeholder to the end + if exists("g:surround_insert_tail") + call setreg('"',g:surround_insert_tail,"a".getregtype('"')) + endif + if &ve != 'all' && col('.') >= col('$') + if &ve == 'insert' + let extra_cols = virtcol('.') - virtcol('$') + if extra_cols > 0 + let [regval,regtype] = [getreg('"',1,1),getregtype('"')] + call setreg('"',join(map(range(extra_cols),'" "'),''),'v') + norm! ""p + call setreg('"',regval,regtype) + endif + endif + norm! ""p + else + norm! ""P + endif + if linemode + call s:reindent() + endif + norm! `] + call search('\r','bW') + let @@ = reg_save + let &clipboard = cb_save + return "\<Del>" +endfunction " }}}1 + +function! s:reindent() " {{{1 + if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) + silent norm! '[='] + endif +endfunction " }}}1 + +function! s:dosurround(...) " {{{1 + let scount = v:count1 + let char = (a:0 ? a:1 : s:inputtarget()) + let spc = "" + if char =~ '^\d\+' + let scount = scount * matchstr(char,'^\d\+') + let char = substitute(char,'^\d\+','','') + endif + if char =~ '^ ' + let char = strpart(char,1) + let spc = 1 + endif + if char == 'a' + let char = '>' + endif + if char == 'r' + let char = ']' + endif + let newchar = "" + if a:0 > 1 + let newchar = a:2 + if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == "" + return s:beep() + endif + endif + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let append = "" + let original = getreg('"') + let otype = getregtype('"') + call setreg('"',"") + let strcount = (scount == 1 ? "" : scount) + if char == '/' + exe 'norm! '.strcount.'[/d'.strcount.']/' + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>"''`]' + exe 'norm! T'.char + if getline('.')[col('.')-1] == char + exe 'norm! l' + endif + exe 'norm! dt'.char + else + exe 'norm! d'.strcount.'i'.char + endif + let keeper = getreg('"') + let okeeper = keeper " for reindent below + if keeper == "" + call setreg('"',original,otype) + let &clipboard = cb_save + return "" + endif + let oldline = getline('.') + let oldlnum = line('.') + if char ==# "p" + call setreg('"','','V') + elseif char ==# "s" || char ==# "w" || char ==# "W" + " Do nothing + call setreg('"','') + elseif char =~ "[\"'`]" + exe "norm! i \<Esc>d2i".char + call setreg('"',substitute(getreg('"'),' ','','')) + elseif char == '/' + norm! "_x + call setreg('"','/**/',"c") + let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') + elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>]' + exe 'norm! F'.char + exe 'norm! df'.char + else + " One character backwards + call search('\m.', 'bW') + exe "norm! da".char + endif + let removed = getreg('"') + let rem2 = substitute(removed,'\n.*','','') + let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2)) + let oldtail = strpart(oldline, strlen(oldline)-strlen(rem2)) + let regtype = getregtype('"') + if char =~# '[\[({<T]' || spc + let keeper = substitute(keeper,'^\s\+','','') + let keeper = substitute(keeper,'\s\+$','','') + endif + if col("']") == col("$") && col('.') + 1 == col('$') + if oldhead =~# '^\s*$' && a:0 < 2 + let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') + endif + let pcmd = "p" + else + let pcmd = "P" + endif + if line('.') + 1 < oldlnum && regtype ==# "V" + let pcmd = "p" + endif + call setreg('"',keeper,regtype) + if newchar != "" + let special = a:0 > 2 ? a:3 : 0 + call s:wrapreg('"',newchar,removed,special) + endif + silent exe 'norm! ""'.pcmd.'`[' + if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' + call s:reindent() + endif + if getline('.') =~ '^\s\+$' && keeper =~ '^\s*\n' + silent norm! cc + endif + call setreg('"',original,otype) + let s:lastdel = removed + let &clipboard = cb_save + if newchar == "" + silent! call repeat#set("\<Plug>Dsurround".char,scount) + else + silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount) + endif +endfunction " }}}1 + +function! s:changesurround(...) " {{{1 + let a = s:inputtarget() + if a == "" + return s:beep() + endif + let b = s:inputreplacement() + if b == "" + return s:beep() + endif + call s:dosurround(a,b,a:0 && a:1) +endfunction " }}}1 + +function! s:opfunc(type, ...) abort " {{{1 + if a:type ==# 'setup' + let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$') + return 'g@' + endif + let char = s:inputreplacement() + if char == "" + return s:beep() + endif + let reg = '"' + let sel_save = &selection + let &selection = "inclusive" + let cb_save = &clipboard + set clipboard-=unnamed clipboard-=unnamedplus + let reg_save = getreg(reg) + let reg_type = getregtype(reg) + let type = a:type + if a:type == "char" + silent exe 'norm! v`[o`]"'.reg.'y' + let type = 'v' + elseif a:type == "line" + silent exe 'norm! `[V`]"'.reg.'y' + let type = 'V' + elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>" + let &selection = sel_save + let ve = &virtualedit + if !(a:0 && a:1) + set virtualedit= + endif + silent exe 'norm! gv"'.reg.'y' + let &virtualedit = ve + elseif a:type =~ '^\d\+$' + let type = 'v' + silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' + if mode() ==# 'v' + norm! v + return s:beep() + endif + else + let &selection = sel_save + let &clipboard = cb_save + return s:beep() + endif + let keeper = getreg(reg) + if type ==# "v" && a:type !=# "v" + let append = matchstr(keeper,'\_s\@<!\s*$') + let keeper = substitute(keeper,'\_s\@<!\s*$','','') + endif + call setreg(reg,keeper,type) + call s:wrapreg(reg,char,"",a:0 && a:1) + if type ==# "v" && a:type !=# "v" && append != "" + call setreg(reg,append,"ac") + endif + silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`[' + if type ==# 'V' || (getreg(reg) =~ '\n' && type ==# 'v') + call s:reindent() + endif + call setreg(reg,reg_save,reg_type) + let &selection = sel_save + let &clipboard = cb_save + if a:type =~ '^\d\+$' + silent! call repeat#set("\<Plug>Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:input,a:type) + else + silent! call repeat#set("\<Plug>SurroundRepeat".char.s:input) + endif +endfunction + +function! s:opfunc2(...) abort + if !a:0 || a:1 ==# 'setup' + let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$') + return 'g@' + endif + call s:opfunc(a:1, 1) +endfunction " }}}1 + +function! s:closematch(str) " {{{1 + " Close an open (, {, [, or < on the command line. + let tail = matchstr(a:str,'.[^\[\](){}<>]*$') + if tail =~ '^\[.\+' + return "]" + elseif tail =~ '^(.\+' + return ")" + elseif tail =~ '^{.\+' + return "}" + elseif tail =~ '^<.+' + return ">" + else + return "" + endif +endfunction " }}}1 + +nnoremap <silent> <Plug>SurroundRepeat . +nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR> +nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR> +nnoremap <silent> <Plug>CSurround :<C-U>call <SID>changesurround(1)<CR> +nnoremap <expr> <Plug>Yssurround '^'.v:count1.<SID>opfunc('setup').'g_' +nnoremap <expr> <Plug>YSsurround <SID>opfunc2('setup').'_' +nnoremap <expr> <Plug>Ysurround <SID>opfunc('setup') +nnoremap <expr> <Plug>YSurround <SID>opfunc2('setup') +vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> +vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR> +inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR> +inoremap <silent> <Plug>ISurround <C-R>=<SID>insert(1)<CR> + +if !exists("g:surround_no_mappings") || ! g:surround_no_mappings + nmap ds <Plug>Dsurround + nmap cs <Plug>Csurround + nmap cS <Plug>CSurround + nmap ys <Plug>Ysurround + nmap yS <Plug>YSurround + nmap yss <Plug>Yssurround + nmap ySs <Plug>YSsurround + nmap ySS <Plug>YSsurround + xmap S <Plug>VSurround + xmap gS <Plug>VgSurround + if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings + if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i") + imap <C-S> <Plug>Isurround + endif + imap <C-G>s <Plug>Isurround + imap <C-G>S <Plug>ISurround + endif +endif + +" vim:set ft=vim sw=2 sts=2 et: diff --git a/.config/vim/autoload/system_copy.vim b/.config/vim/autoload/system_copy.vim @@ -0,0 +1,148 @@ +if exists('g:loaded_system_copy') || v:version < 700 + finish +endif +let g:loaded_system_copy = 1 + +let s:blockwise = 'blockwise visual' +let s:visual = 'visual' +let s:motion = 'motion' +let s:linewise = 'linewise' +let s:mac = 'mac' +let s:windows = 'windows' +let s:linux = 'linux' + +function! s:system_copy(type, ...) abort + let mode = <SID>resolve_mode(a:type, a:0) + let unnamed = @@ + if mode == s:linewise + let lines = { 'start': line("'["), 'end': line("']") } + silent exe lines.start . "," . lines.end . "y" + elseif mode == s:visual || mode == s:blockwise + silent exe "normal! `<" . a:type . "`>y" + else + silent exe "normal! `[v`]y" + endif + let command = s:CopyCommandForCurrentOS() + silent call system(command, getreg('@')) + echohl String | echon 'Copied to clipboard using: ' . command | echohl None + let @@ = unnamed +endfunction + +function! s:system_paste(type, ...) abort + let mode = <SID>resolve_mode(a:type, a:0) + let command = <SID>PasteCommandForCurrentOS() + let unnamed = @@ + if mode == s:linewise + let lines = { 'start': line("'["), 'end': line("']") } + silent exe lines.start . "," . lines.end . "d" + silent exe "set paste | normal! O" . system(command) + silent exe "set nopaste" + elseif mode == s:visual || mode == s:blockwise + silent exe "normal! `<" . a:type . "`>c" . system(command) + else + silent exe "normal! `[v`]c" . system(command) + endif + echohl String | echon 'Pasted to clipboard using: ' . command | echohl None + let @@ = unnamed +endfunction + +function! s:system_paste_line() abort + let command = <SID>PasteCommandForCurrentOS() + put =system(command) + echohl String | echon 'Pasted to vim using: ' . command | echohl None +endfunction + +function! s:resolve_mode(type, arg) + let visual_mode = a:arg != 0 + if visual_mode + return (a:type == '') ? s:blockwise : s:visual + elseif a:type == 'line' + return s:linewise + else + return s:motion + endif +endfunction + +function! s:currentOS() + let os = substitute(system('uname'), '\n', '', '') + let known_os = 'unknown' + if has("gui_mac") || os ==? 'Darwin' + let known_os = s:mac + elseif has("gui_win32") || os =~? 'cygwin' || os =~? 'MINGW' + let known_os = s:windows + elseif os ==? 'Linux' + let known_os = s:linux + else + exe "normal \<Esc>" + throw "unknown OS: " . os + endif + return known_os +endfunction + +function! s:CopyCommandForCurrentOS() + if exists('g:system_copy#copy_command') + return g:system_copy#copy_command + endif + let os = <SID>currentOS() + if os == s:mac + return 'pbcopy' + elseif os == s:windows + return 'clip' + elseif os == s:linux + if !empty($WAYLAND_DISPLAY) + return 'wl-copy' + else + return 'xsel --clipboard --input' + endif + endif +endfunction + +function! s:PasteCommandForCurrentOS() + if exists('g:system_copy#paste_command') + return g:system_copy#paste_command + endif + let os = <SID>currentOS() + if os == s:mac + return 'pbpaste' + elseif os == s:windows + return 'paste' + elseif os == s:linux + if !empty($WAYLAND_DISPLAY) + return 'wl-paste -n' + else + return 'xsel --clipboard --output' + endif + endif +endfunction + +xnoremap <silent> <Plug>SystemCopy :<C-U>call <SID>system_copy(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> +nnoremap <silent> <Plug>SystemCopy :<C-U>set opfunc=<SID>system_copy<CR>g@ +nnoremap <silent> <Plug>SystemCopyLine :<C-U>set opfunc=<SID>system_copy<Bar>exe 'norm! 'v:count1.'g@_'<CR> +xnoremap <silent> <Plug>SystemPaste :<C-U>call <SID>system_paste(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> +nnoremap <silent> <Plug>SystemPaste :<C-U>set opfunc=<SID>system_paste<CR>g@ +nnoremap <silent> <Plug>SystemPasteLine :<C-U>call <SID>system_paste_line()<CR> + +if !hasmapto('<Plug>SystemCopy', 'n') || maparg('cp', 'n') ==# '' + nmap cp <Plug>SystemCopy +endif + +if !hasmapto('<Plug>SystemCopy', 'v') || maparg('cp', 'v') ==# '' + xmap cp <Plug>SystemCopy +endif + +if !hasmapto('<Plug>SystemCopyLine', 'n') || maparg('cP', 'n') ==# '' + nmap cP <Plug>SystemCopyLine +endif + +if !hasmapto('<Plug>SystemPaste', 'n') || maparg('cv', 'n') ==# '' + nmap cv <Plug>SystemPaste +endif + +if !hasmapto('<Plug>SystemPaste', 'v') || maparg('cv', 'v') ==# '' + xmap cv <Plug>SystemPaste +endif + +if !hasmapto('<Plug>SystemPasteLine', 'n') || maparg('cV', 'n') ==# '' + nmap cV <Plug>SystemPasteLine +endif +" vim:ts=2:sw=2:sts=2 diff --git a/.config/vim/colors/.vimrc b/.config/vim/colors/.vimrc diff --git a/.config/vim/colors/duochrome.vim b/.config/vim/colors/duochrome.vim @@ -0,0 +1,313 @@ +" Name: duochrome.vim +" Version: 0.1 +" Maintainer: github.com/sdothum +" License: The MIT License (MIT) +" +" Based on +" +" https://github.com/andreypopp/vim-colors-plain +" +" which in turn based on +" +" https://github.com/pbrisbin/vim-colors-off (MIT License) +" +" which in turn based on +" +" https://github.com/reedes/vim-colors-pencil (MIT License) +" +""" +hi clear + +if exists('syntax on') + syntax reset +endif + +let g:colors_name='duochrome' + +let s:black = { "gui": "#222222", "cterm": "0" } +let s:medium_gray = { "gui": "#767676", "cterm": "243" } +let s:white = { "gui": "#f7f3ee", "cterm": "15" } " flatwhite bg +let s:orange = { "gui": "#c18401", "cterm": "208" } " one color orange 2 +let s:light_black = { "gui": "#424242", "cterm": "8" } +let s:lighter_black = { "gui": "#545454", "cterm": "240" } +let s:subtle_black = { "gui": "#303030", "cterm": "236" } +let s:light_gray = { "gui": "#999999", "cterm": "249" } +let s:lighter_gray = { "gui": "#CCCCCC", "cterm": "251" } +let s:lightest_gray = { "gui": "#E5E5E5", "cterm": "251" } +let s:dark_red = { "gui": "#C30771", "cterm": "1" } +let s:light_red = { "gui": "#E32791", "cterm": "1" } +let s:dark_blue = { "gui": "#008EC4", "cterm": "4" } +let s:light_blue = { "gui": "#B6D6FD", "cterm": "153" } +let s:dark_cyan = { "gui": "#20A5BA", "cterm": "6" } +let s:light_cyan = { "gui": "#4FB8CC", "cterm": "14" } +let s:dark_green = { "gui": "#10A778", "cterm": "2" } +let s:light_green = { "gui": "#5FD7A7", "cterm": "10" } +let s:dark_purple = { "gui": "#523C79", "cterm": "5" } +let s:light_purple = { "gui": "#6855DE", "cterm": "13" } +let s:light_yellow = { "gui": "#F3E430", "cterm": "11" } +let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" } +let s:iawriter = { "gui": "#20fccf", "cterm": "51" } " iA writer cursor + +if &background == "dark" + let s:bg = s:black + let s:bg_subtle = s:light_black + let s:bg_very_subtle = s:subtle_black + let s:norm = s:lighter_gray + let s:norm_subtle = s:light_gray + let s:norm_very_subtle = s:medium_gray + let s:purple = s:light_purple + let s:cyan = s:light_cyan + let s:green = s:light_green + let s:red = s:light_red + let s:yellow = s:light_yellow + let s:visual = s:lighter_black + let s:cursor_line = s:subtle_black + let s:constant = s:light_blue + let s:comment = s:light_gray + let s:selection = s:dark_yellow + let s:selection_fg = s:black + let s:ok = s:light_green + let s:warning = s:yellow + let s:error = s:light_red +else + let s:bg = s:white + let s:bg_subtle = s:lighter_gray + let s:bg_very_subtle = s:light_gray + let s:norm = s:light_black + let s:norm_subtle = s:lighter_black + let s:norm_very_subtle = s:medium_gray + let s:purple = s:dark_purple + let s:cyan = s:dark_cyan + let s:green = s:dark_green + let s:red = s:dark_red + let s:yellow = s:dark_yellow + let s:visual = s:light_blue + let s:cursor_line = s:white " no highlight + let s:constant = s:dark_blue + let s:comment = s:orange + let s:selection = s:light_yellow + let s:selection_fg = s:light_black + let s:ok = s:light_green + let s:warning = s:yellow + let s:error = s:dark_red +endif + +" unlet s:black +unlet s:medium_gray +unlet s:white +unlet s:orange +unlet s:light_black +unlet s:lighter_black +" unlet s:subtle_black +unlet s:light_gray +unlet s:lighter_gray +unlet s:lightest_gray +unlet s:dark_red +unlet s:light_red +unlet s:dark_blue +unlet s:light_blue +unlet s:dark_cyan +unlet s:light_cyan +unlet s:dark_green +unlet s:light_green +unlet s:dark_purple +unlet s:light_purple +unlet s:light_yellow +unlet s:dark_yellow + +" https://github.com/noahfrederick/vim-hemisu/ +function! s:h(group, style) + execute "highlight" a:group + \ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE") + \ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE") + \ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE") + \ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE") + \ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE") + \ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE") + \ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE") +endfunction + +" __Normal__ +if has("gui") + call s:h("Normal", {"fg": s:norm, "bg": s:bg}) + call s:h("Cursor", {"fg": s:black, "bg": s:iawriter}) " iA writer cursor +else + call s:h("Normal", {"fg": s:norm}) + hi! link Cursor Identifier +endif +hi! link Identifier Normal +hi! link Function Identifier +hi! link Type Normal +hi! link StorageClass Type +hi! link Structure Type +hi! link Typedef Type +hi! link Special Normal +hi! link SpecialChar Special +hi! link Tag Special +hi! link Delimiter Special +hi! link SpecialComment Special +hi! link Debug Special +hi! link VertSplit Normal +hi! link PreProc Normal +hi! link Define PreProc +hi! link Macro PreProc +hi! link PreCondit Comment " highlight code sections + +" __Operator__ +call s:h("Noise", {"fg": s:norm_subtle, "gui": "NONE"}) +hi! link Operator Noise +hi! link LineNr Noise +hi! link CursorLineNr LineNr +hi! link FoldColumn LineNr +hi! link SignColumn LineNr + +" __Comment__ +call s:h("Comment", {"fg": s:comment, "gui": "italic"}) + +" __Constant__ +call s:h("Constant", {"fg": s:constant}) +hi! link Character Constant +hi! link Number Constant +hi! link Boolean Constant +hi! link Float Constant +hi! link String Constant +hi! link Directory Constant +hi! link Title Constant + +" __Statement__ +call s:h("Statement", {"fg": s:subtle_black, "gui": "bold"}) +hi! link Include Statement +hi! link Conditonal Statement +hi! link Repeat Statement +hi! link Label Statement +hi! link Keyword Statement +hi! link Exception Statement + +" __ErrorMsg__ +call s:h("ErrorMsg", {"fg": s:error}) +hi! link Error ErrorMsg +hi! link Question ErrorMsg +" __WarningMsg__ +call s:h("WarningMsg", {"fg": s:warning}) +" __MoreMsg__ +call s:h("MoreMsg", {"fg": s:norm_subtle, "cterm": "bold", "gui": "bold"}) +hi! link ModeMsg MoreMsg + +" __NonText__ +call s:h("NonText", {"fg": s:norm_very_subtle}) +hi! link Folded NonText +hi! link qfLineNr NonText + +" __Search__ +call s:h("Search", {"bg": s:selection, "fg": s:selection_fg}) +call s:h("IncSearch", {"bg": s:selection, "fg": s:selection_fg, "gui": "bold"}) + +" __Visual__ +call s:h("Visual", {"bg": s:visual}) +" __VisualNOS__ +call s:h("VisualNOS", {"bg": s:bg_subtle}) + +call s:h("Ignore", {"fg": s:bg}) + +" __DiffAdd__ +call s:h("DiffAdd", {"fg": s:green}) +" __DiffDelete__ +call s:h("DiffDelete", {"fg": s:red}) +" __DiffChange__ +call s:h("DiffChange", {"fg": s:yellow}) +" __DiffText__ +call s:h("DiffText", {"fg": s:constant}) + +if has("gui_running") + call s:h("SpellBad", {"gui": "underline", "sp": s:red}) + call s:h("SpellCap", {"gui": "underline", "sp": s:ok}) + call s:h("SpellRare", {"gui": "underline", "sp": s:error}) + call s:h("SpellLocal", {"gui": "underline", "sp": s:ok}) +else + call s:h("SpellBad", {"cterm": "underline", "fg": s:red}) + call s:h("SpellCap", {"cterm": "underline", "fg": s:ok}) + call s:h("SpellRare", {"cterm": "underline", "fg": s:error}) + call s:h("SpellLocal", {"cterm": "underline", "fg": s:ok}) +endif + +hi! link helpHyperTextEntry Title +hi! link helpHyperTextJump String + +" __StatusLine__ +call s:h("StatusLine", {"gui": "underline", "bg": s:bg, "fg": s:norm_very_subtle}) +" __StatusLineNC__ +call s:h("StatusLineNC", {"gui": "underline", "bg": s:bg, "fg": s:bg_subtle}) +" __WildMenu__ +call s:h("WildMenu", {"gui": "underline,bold", "bg": s:bg, "fg": s:norm}) + +call s:h("StatusLineOk", {"gui": "underline", "bg": s:bg, "fg": s:ok}) +call s:h("StatusLineError", {"gui": "underline", "bg": s:bg, "fg": s:error}) +call s:h("StatusLineWarning", {"gui": "underline", "bg": s:bg, "fg": s:warning}) + +" __Pmenu__ +call s:h("Pmenu", {"fg": s:norm, "bg": s:cursor_line}) +hi! link PmenuSbar Pmenu +hi! link PmenuThumb Pmenu +" __PmenuSel__ +call s:h("PmenuSel", {"fg": s:norm, "bg": s:cursor_line, "gui": "bold"}) + +hi! link TabLine Normal +hi! link TabLineSel Keyword +hi! link TabLineFill Normal + +" __CursorLine__ +call s:h("CursorLine", {"bg": s:cursor_line}) +" __CursorColumn__ +call s:h("ColorColumn", {"bg": s:cursor_line}) + +" __MatchParen__ +call s:h("MatchParen", {"bg": s:bg_subtle, "fg": s:norm}) + +hi! link htmlH1 Normal +hi! link htmlH2 Normal +hi! link htmlH3 Normal +hi! link htmlH4 Normal +hi! link htmlH5 Normal +hi! link htmlH6 Normal + +hi link diffRemoved DiffDelete +hi link diffAdded DiffAdd + +" Signify, git-gutter +hi link SignifySignAdd LineNr +hi link SignifySignDelete LineNr +hi link SignifySignChange LineNr +hi link GitGutterAdd LineNr +hi link GitGutterDelete LineNr +hi link GitGutterChange LineNr +hi link GitGutterChangeDelete LineNr + +hi link jsFlowTypeKeyword Statement +hi link jsFlowImportType Statement +hi link jsFunction Statement +hi link jsGlobalObjects Normal +hi link jsGlobalNodeObjects Normal +hi link jsArrowFunction Noise +hi link StorageClass Statement + +hi link xmlTag Constant +hi link xmlTagName xmlTag +hi link xmlEndTag xmlTag +hi link xmlAttrib xmlTag + +hi link markdownH1 Statement +hi link markdownH2 Statement +hi link markdownH3 Statement +hi link markdownH4 Statement +hi link markdownH5 Statement +hi link markdownH6 Statement +hi link markdownListMarker Constant +hi link markdownCode Constant +hi link markdownCodeBlock Constant +hi link markdownCodeDelimiter Constant +hi link markdownHeadingDelimiter Constant + +hi link yamlBlockMappingKey Statement +hi link pythonOperator Statement + + diff --git a/.config/vim/colors/plain.vim b/.config/vim/colors/plain.vim @@ -0,0 +1,294 @@ +" Name: plain.vim +" Version: 0.1 +" Maintainer: github.com/andreypopp +" License: The MIT License (MIT) +" +" Based on +" +" https://github.com/pbrisbin/vim-colors-off (MIT License) +" +" which in turn based on +" +" https://github.com/reedes/vim-colors-pencil (MIT License) +" +""" +hi clear + +if exists('syntax on') + syntax reset +endif + +let g:colors_name='plain' + +let s:none = {"cterm": "NONE"} + +let s:dark_black = {"cterm": "0"} +let s:black = {"cterm": "8"} + +let s:dark_red = {"cterm": "1"} +let s:red = {"cterm": "9"} + +let s:dark_green = {"cterm": "2"} +let s:green = {"cterm": "10"} + +let s:dark_yellow = {"cterm": "3"} +let s:yellow = {"cterm": "11"} + +let s:dark_blue = {"cterm": "4"} +let s:blue = {"cterm": "12"} + +let s:dark_magenta = {"cterm": "5"} +let s:magenta = {"cterm": "13"} + +let s:dark_cyan = {"cterm": "6"} +let s:cyan = {"cterm": "14"} + +let s:dark_white = {"cterm": "7"} +let s:white = {"cterm": "15"} + +let s:always_dark_black = {"cterm": "16"} +let s:always_black = {"cterm": "17"} + +let s:always_dark_white = {"cterm": "18"} +let s:always_white = {"cterm": "19"} + +let s:bg = s:none +let s:bg_subtle = s:dark_white +let s:norm = s:none +let s:norm_subtle = s:black +let s:visual = s:cyan +let s:visual_fg = s:white +let s:cursor_line = {"cterm": "20"} +let s:constant = s:cyan +let s:comment = s:black +let s:selection = s:yellow +let s:selection_fg = s:always_dark_black +let s:ok = s:green +let s:warning = s:dark_yellow +let s:error = s:dark_red + +" https://github.com/noahfrederick/vim-hemisu/ +function! s:h(group, style) + execute "highlight" a:group + \ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE") + \ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE") + \ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE") + \ "guisp=" (has_key(a:style, "guisp") ? a:style.guisp : "NONE") + \ "guifg=NONE" + \ "guibg=NONE" + \ "gui=NONE" +endfunction + +" __Normal__ +if has("gui") + call s:h("Normal", {"fg": s:norm, "bg": s:bg}) + call s:h("Cursor", {"fg": s:bg, "bg": s:norm}) +else + call s:h("Normal", {"fg": s:norm}) + hi! link Cursor Identifier +endif +hi! link Identifier Normal +hi! link Function Identifier +hi! link Type Normal +hi! link StorageClass Type +hi! link Structure Type +hi! link Typedef Type +hi! link Special Normal +hi! link SpecialChar Special +hi! link Tag Special +hi! link Delimiter Special +hi! link SpecialComment Special +hi! link Debug Special +hi! link VertSplit Normal +hi! link PreProc Normal +hi! link Define PreProc +hi! link Macro PreProc +hi! link PreCondit PreProc + +" __Operator__ +call s:h("Noise", {"fg": s:norm_subtle}) +hi! link Operator Noise +hi! link LineNr Noise +hi! link CursorLineNr LineNr +hi! link FoldColumn LineNr +hi! link SignColumn LineNr + +" __Comment__ +call s:h("Comment", {"fg": s:comment, "cterm": "italic"}) + +" __Constant__ +call s:h("Constant", {"fg": s:constant}) +hi! link Character Constant +hi! link Number Constant +hi! link Boolean Constant +hi! link Float Constant +hi! link String Constant +hi! link Directory Constant +hi! link Title Constant + +" __Statement__ +call s:h("Statement", {"fg": s:norm, "cterm": "bold"}) +hi! link Include Statement +hi! link Conditonal Statement +hi! link Repeat Statement +hi! link Label Statement +hi! link Keyword Statement +hi! link Exception Statement + +" __ExtraWhitespace__ +call s:h("ExtraWhitespace", {"bg": s:error}) + +" __ErrorMsg__ +call s:h("ErrorMsg", {"fg": s:error}) +hi! link Error ErrorMsg +hi! link Question ErrorMsg +" __WarningMsg__ +call s:h("WarningMsg", {"fg": s:warning}) +" __InfoMsg__ +call s:h("InfoMsg", {"fg": s:dark_magenta, "cterm": "bold"}) +" __MoreMsg__ +call s:h("MoreMsg", {"fg": s:norm_subtle, "cterm": "bold"}) +hi! link ModeMsg MoreMsg + +" __NonText__ +call s:h("NonText", {"fg": s:norm_subtle}) +hi! link Folded NonText +hi! link qfLineNr NonText + +" __Visual__ +call s:h("Visual", {"bg": s:visual, "fg": s:visual_fg}) +" __VisualNOS__ +call s:h("VisualNOS", {"bg": s:bg_subtle, "fg": s:visual_fg}) + +call s:h("Ignore", {"fg": s:bg}) + +" __DiffAdd__ +call s:h("DiffAdd", {"fg": s:dark_green}) +" __DiffDelete__ +call s:h("DiffDelete", {"fg": s:dark_red}) +" __DiffChange__ +call s:h("DiffChange", {"fg": s:dark_yellow}) +" __DiffText__ +call s:h("DiffText", {"fg": s:constant}) + +if has("gui_running") + call s:h("SpellBad", {"sp": s:dark_red}) + call s:h("SpellCap", {"sp": s:ok}) + call s:h("SpellRare", {"sp": s:error}) + call s:h("SpellLocal", {"sp": s:ok}) +else + call s:h("SpellBad", {"cterm": "underline", "fg": s:dark_red}) + call s:h("SpellCap", {"cterm": "underline", "fg": s:ok}) + call s:h("SpellRare", {"cterm": "underline", "fg": s:error}) + call s:h("SpellLocal", {"cterm": "underline", "fg": s:ok}) +endif + +hi! link helpHyperTextEntry Title +hi! link helpHyperTextJump String + +call s:h("StatusLine", { + \"cterm": "bold,underline", + \"bg": s:bg, + \"fg": s:norm + \}) +call s:h("StatusLineNC", { + \"cterm": "bold,underline", + \"bg": s:bg, + \"fg": s:bg_subtle + \}) + +" Semantic status line highlights +call s:h("StatusLineOk", { + \"cterm": "bold,underline", + \"bg": s:bg, + \"fg": s:ok + \}) +call s:h("StatusLineError", { + \"cterm": "bold,underline", + \"bg": s:bg, + \"fg": s:error + \}) +call s:h("StatusLineWarning", { + \"cterm": "bold,underline", + \"bg": s:bg, + \"fg": s:warning + \}) + +call s:h("WildMenu", {"cterm": "underline,bold", "bg": s:bg, "fg": s:norm}) + +" __Pmenu__ +call s:h("Pmenu", {"fg": s:norm, "bg": s:cursor_line}) +hi! link PmenuSbar Pmenu +hi! link PmenuThumb Pmenu +" __PmenuSel__ +call s:h("PmenuSel", {"fg": s:norm, "bg": s:cursor_line, "cterm": "bold"}) + +hi! link TabLine Normal +hi! link TabLineSel Keyword +hi! link TabLineFill Normal + +" __CursorLine__ +call s:h("CursorLine", {"bg": s:cursor_line}) +" __CursorColumn__ +call s:h("ColorColumn", {"bg": s:cursor_line}) + +" __MatchParen__ +call s:h("MatchParen", {"bg": s:yellow, "fg": s:always_dark_black}) + +hi! link htmlH1 Normal +hi! link htmlH2 Normal +hi! link htmlH3 Normal +hi! link htmlH4 Normal +hi! link htmlH5 Normal +hi! link htmlH6 Normal + +hi link diffRemoved DiffDelete +hi link diffAdded DiffAdd + +" Signify, git-gutter +hi link SignifySignAdd LineNr +hi link SignifySignDelete LineNr +hi link SignifySignChange LineNr +hi link GitGutterAdd LineNr +hi link GitGutterDelete LineNr +hi link GitGutterChange LineNr +hi link GitGutterChangeDelete LineNr + +hi link jsFlowTypeKeyword Statement +hi link jsFlowImportType Statement +hi link jsFunction Statement +hi link jsGlobalObjects Normal +hi link jsGlobalNodeObjects Normal +hi link jsArrowFunction Noise +hi link StorageClass Statement + +hi link xmlTag Constant +hi link xmlTagName xmlTag +hi link xmlEndTag xmlTag +hi link xmlAttrib xmlTag + +hi link markdownH1 Statement +hi link markdownH2 Statement +hi link markdownH3 Statement +hi link markdownH4 Statement +hi link markdownH5 Statement +hi link markdownH6 Statement +hi link markdownListMarker Constant +hi link markdownCode Constant +hi link markdownCodeBlock Constant +hi link markdownCodeDelimiter Constant +hi link markdownHeadingDelimiter Constant + +hi link yamlBlockMappingKey Statement +hi link pythonOperator Statement + +hi link ALEWarning WarningMsg +hi link ALEWarningSign WarningMsg +hi link ALEError ErrorMsg +hi link ALEErrorSign ErrorMsg +hi link ALEInfo InfoMsg +hi link ALEInfoSign InfoMsg + +" __Search__ (make sure it comes after everything else) +call s:h("Search", {"bg": s:selection, "fg": s:selection_fg}) +hi! link IncSearch Search diff --git a/.config/vim/colors/wal.vim b/.config/vim/colors/wal.vim @@ -0,0 +1,196 @@ +" wal.vim -- Vim color scheme. +" Author: Dylan Araps +" Webpage: https://github.com/dylanaraps/wal +" Description: A colorscheme that uses your terminal colors, made to work with 'wal'. + +hi clear +set background=dark + +if exists('syntax_on') + syntax reset +endif + +" Colorscheme name +let g:colors_name = 'wal' + +" highlight groups {{{ + +" set t_Co=16 +hi Normal ctermbg=NONE ctermfg=7 +hi NonText ctermbg=NONE ctermfg=0 +hi Comment ctermbg=NONE ctermfg=8 +hi Constant ctermbg=NONE ctermfg=3 +hi Error ctermbg=1 ctermfg=7 +hi Identifier ctermbg=NONE ctermfg=1 cterm=BOLD +hi Ignore ctermbg=8 ctermfg=0 +hi PreProc ctermbg=NONE ctermfg=3 +hi Special ctermbg=NONE ctermfg=6 +hi Statement ctermbg=NONE ctermfg=1 +hi String ctermbg=NONE ctermfg=2 +hi Number ctermbg=NONE ctermfg=3 +hi Todo ctermbg=2 ctermfg=0 +hi Type ctermbg=NONE ctermfg=3 +hi Underlined ctermbg=NONE ctermfg=1 cterm=underline +hi StatusLine ctermbg=7 ctermfg=0 +hi StatusLineNC ctermbg=8 ctermfg=0 +hi TabLine ctermbg=NONE ctermfg=8 +hi TabLineFill ctermbg=NONE ctermfg=8 +hi TabLineSel ctermbg=4 ctermfg=0 +hi TermCursorNC ctermbg=3 ctermfg=0 +hi VertSplit ctermbg=8 ctermfg=0 +hi Title ctermbg=NONE ctermfg=4 +hi CursorLine ctermbg=2 ctermfg=0 +hi LineNr ctermbg=NONE ctermfg=8 +hi CursorLineNr ctermbg=NONE ctermfg=8 +hi helpLeadBlank ctermbg=NONE ctermfg=7 +hi helpNormal ctermbg=NONE ctermfg=7 +hi Visual ctermbg=0 ctermfg=15 cterm=reverse term=reverse +hi VisualNOS ctermbg=NONE ctermfg=1 +hi Pmenu ctermbg=8 ctermfg=7 +hi PmenuSbar ctermbg=6 ctermfg=7 +hi PmenuSel ctermbg=4 ctermfg=0 +hi PmenuThumb ctermbg=8 ctermfg=8 +hi FoldColumn ctermbg=NONE ctermfg=7 +hi Folded ctermbg=NONE ctermfg=8 +hi WildMenu ctermbg=2 ctermfg=0 +hi SpecialKey ctermbg=NONE ctermfg=8 +hi DiffAdd ctermbg=NONE ctermfg=2 +hi DiffChange ctermbg=NONE ctermfg=8 +hi DiffDelete ctermbg=NONE ctermfg=1 +hi DiffText ctermbg=NONE ctermfg=4 +hi IncSearch ctermbg=3 ctermfg=0 +hi Search ctermbg=3 ctermfg=0 +hi Directory ctermbg=NONE ctermfg=4 +hi MatchParen ctermbg=1 ctermfg=8 +hi ColorColumn ctermbg=4 ctermfg=0 +hi signColumn ctermbg=NONE ctermfg=4 +hi ErrorMsg ctermbg=NONE ctermfg=8 +hi ModeMsg ctermbg=NONE ctermfg=2 +hi MoreMsg ctermbg=NONE ctermfg=2 +hi Question ctermbg=NONE ctermfg=4 +hi WarningMsg ctermbg=1 ctermfg=0 +hi Cursor ctermbg=NONE ctermfg=8 +hi Structure ctermbg=NONE ctermfg=5 +hi CursorColumn ctermbg=8 ctermfg=7 +hi ModeMsg ctermbg=NONE ctermfg=7 +hi SpellBad ctermbg=NONE ctermfg=1 cterm=underline +hi SpellCap ctermbg=NONE ctermfg=4 cterm=underline +hi SpellLocal ctermbg=NONE ctermfg=5 cterm=underline +hi SpellRare ctermbg=NONE ctermfg=6 cterm=underline +hi Boolean ctermbg=NONE ctermfg=5 +hi Character ctermbg=NONE ctermfg=1 +hi Conditional ctermbg=NONE ctermfg=5 +hi Define ctermbg=NONE ctermfg=5 +hi Delimiter ctermbg=NONE ctermfg=5 +hi Float ctermbg=NONE ctermfg=5 +hi Include ctermbg=NONE ctermfg=4 +hi Keyword ctermbg=NONE ctermfg=5 +hi Label ctermbg=NONE ctermfg=3 +hi Operator ctermbg=NONE ctermfg=7 +hi Repeat ctermbg=NONE ctermfg=3 +hi SpecialChar ctermbg=NONE ctermfg=5 +hi Tag ctermbg=NONE ctermfg=3 +hi Typedef ctermbg=NONE ctermfg=3 +hi vimUserCommand ctermbg=NONE ctermfg=1 cterm=BOLD + hi link vimMap vimUserCommand + hi link vimLet vimUserCommand + hi link vimCommand vimUserCommand + hi link vimFTCmd vimUserCommand + hi link vimAutoCmd vimUserCommand + hi link vimNotFunc vimUserCommand +hi vimNotation ctermbg=NONE ctermfg=4 +hi vimMapModKey ctermbg=NONE ctermfg=4 +hi vimBracket ctermbg=NONE ctermfg=7 +hi vimCommentString ctermbg=NONE ctermfg=8 +hi htmlLink ctermbg=NONE ctermfg=1 cterm=underline +hi htmlBold ctermbg=NONE ctermfg=3 cterm=BOLD +hi htmlItalic ctermbg=NONE ctermfg=5 +hi htmlEndTag ctermbg=NONE ctermfg=7 +hi htmlTag ctermbg=NONE ctermfg=7 +hi htmlTagName ctermbg=NONE ctermfg=1 cterm=BOLD +hi htmlH1 ctermbg=NONE ctermfg=7 + hi link htmlH2 htmlH1 + hi link htmlH3 htmlH1 + hi link htmlH4 htmlH1 + hi link htmlH5 htmlH1 + hi link htmlH6 htmlH1 +hi cssMultiColumnAttr ctermbg=NONE ctermfg=2 + hi link cssFontAttr cssMultiColumnAttr + hi link cssFlexibleBoxAttr cssMultiColumnAttr +hi cssBraces ctermbg=NONE ctermfg=7 + hi link cssAttrComma cssBraces +hi cssValueLength ctermbg=NONE ctermfg=7 +hi cssUnitDecorators ctermbg=NONE ctermfg=7 +hi cssValueNumber ctermbg=NONE ctermfg=7 + hi link cssValueLength cssValueNumber +hi cssNoise ctermbg=NONE ctermfg=8 +hi cssTagName ctermbg=NONE ctermfg=1 +hi cssFunctionName ctermbg=NONE ctermfg=4 +hi scssSelectorChar ctermbg=NONE ctermfg=7 +hi scssAttribute ctermbg=NONE ctermfg=7 + hi link scssDefinition cssNoise +hi sassidChar ctermbg=NONE ctermfg=1 +hi sassClassChar ctermbg=NONE ctermfg=5 +hi sassInclude ctermbg=NONE ctermfg=5 +hi sassMixing ctermbg=NONE ctermfg=5 +hi sassMixinName ctermbg=NONE ctermfg=4 +hi javaScript ctermbg=NONE ctermfg=7 +hi javaScriptBraces ctermbg=NONE ctermfg=7 +hi javaScriptNumber ctermbg=NONE ctermfg=5 +hi markdownH1 ctermbg=NONE ctermfg=7 + hi link markdownH2 markdownH1 + hi link markdownH3 markdownH1 + hi link markdownH4 markdownH1 + hi link markdownH5 markdownH1 + hi link markdownH6 markdownH1 +hi markdownAutomaticLink ctermbg=NONE ctermfg=2 cterm=underline + hi link markdownUrl markdownAutomaticLink +hi markdownError ctermbg=NONE ctermfg=7 +hi markdownCode ctermbg=NONE ctermfg=3 +hi markdownCodeBlock ctermbg=NONE ctermfg=3 +hi markdownCodeDelimiter ctermbg=NONE ctermfg=5 +hi markdownItalic cterm=Italic +hi markdownBold cterm=Bold +hi xdefaultsValue ctermbg=NONE ctermfg=7 +hi rubyInclude ctermbg=NONE ctermfg=4 +hi rubyDefine ctermbg=NONE ctermfg=5 +hi rubyFunction ctermbg=NONE ctermfg=4 +hi rubyStringDelimiter ctermbg=NONE ctermfg=2 +hi rubyInteger ctermbg=NONE ctermfg=3 +hi rubyAttribute ctermbg=NONE ctermfg=4 +hi rubyConstant ctermbg=NONE ctermfg=3 +hi rubyInterpolation ctermbg=NONE ctermfg=2 +hi rubyInterpolationDelimiter ctermbg=NONE ctermfg=3 +hi rubyRegexp ctermbg=NONE ctermfg=6 +hi rubySymbol ctermbg=NONE ctermfg=2 +hi rubyTodo ctermbg=NONE ctermfg=8 +hi rubyRegexpAnchor ctermbg=NONE ctermfg=7 + hi link rubyRegexpQuantifier rubyRegexpAnchor +hi pythonOperator ctermbg=NONE ctermfg=5 +hi pythonFunction ctermbg=NONE ctermfg=4 +hi pythonRepeat ctermbg=NONE ctermfg=5 +hi pythonStatement ctermbg=NONE ctermfg=1 cterm=Bold +hi pythonBuiltIn ctermbg=NONE ctermfg=4 +hi phpMemberSelector ctermbg=NONE ctermfg=7 +hi phpComparison ctermbg=NONE ctermfg=7 +hi phpParent ctermbg=NONE ctermfg=7 +hi cOperator ctermbg=NONE ctermfg=6 +hi cPreCondit ctermbg=NONE ctermfg=5 +hi SignifySignAdd ctermbg=NONE ctermfg=2 +hi SignifySignChange ctermbg=NONE ctermfg=4 +hi SignifySignDelete ctermbg=NONE ctermfg=1 +hi NERDTreeDirSlash ctermbg=NONE ctermfg=4 +hi NERDTreeExecFile ctermbg=NONE ctermfg=7 +hi ALEErrorSign ctermbg=NONE ctermfg=1 +hi ALEWarningSign ctermbg=NONE ctermfg=3 +hi ALEError ctermbg=NONE ctermfg=1 +hi ALEWarning ctermbg=NONE ctermfg=3 + +" }}} + +" Plugin options {{{ + +let g:limelight_conceal_ctermfg = 8 + +" }}} + diff --git a/.config/vimb/config b/.config/vimb/config @@ -0,0 +1,22 @@ +set download-path=~/general/downloads/ +set editor-command="urxvt -e vim %s" +set history-max-items=99999 +set input-autohide=true + +set home-page=file:///root/.homepage/index.html + +set smooth-scrolling=false +set webinspector=true + +shortcut-add sx=https://searx.me/?q=$0 +shortcut-add sch=https://searx.ch/?q=$0 +shortcut-add bit=https://bitchute.com/search?q=$0 +shortcut-add yt=https://youtube.com/results?search_query=$0 +shortcut-add hh=https://haydenh.gitlab.io/h/search?q=$0 +shortcut-add vl=https://voidlinux.org +shortcut-add vw=https://wiki.voidlinux.org/index.php?search=$0 +shortcut-add gh=https://github.com/search?q=$0 +shortcut-add gl=https://gitlab.com/search?search=$0 +shortcut-add ddg=https://duckduckgo.com/?q=$0 +shortcut-add wk=https://en.wikipedia.org/wiki/$0 +shortcut-add aw=https://wiki.archlinux.org/index.php?search=$0 diff --git a/.config/vimb/scripts.js b/.config/vimb/scripts.js @@ -0,0 +1,33 @@ +function addGlobalStyle(css) { + var head, style; + head = document.getElementsByTagName('head')[0]; + if (!head) { return; } + style = document.createElement('style'); + style.type = 'text/css'; + style.innerHTML = css; + head.appendChild(style); +} +var hostname = window.location.hostname; +if (hostname == "www.youtube.com") { +addGlobalStyle("#watch7-sidebar *, #watch7-content *{background-color:#141726 !important; border-radius:#141726 !important;}#masthead-positioner, #masthead-positioner-height-offset{display:none !important;}#meta-contents{margin-bottom:2vw !important;}ytd-watch-flexy #secondary{padding:2.5vw !important;}ytd-watch-flexy #player{display:none !important;}ytd-watch-flexy #primary-inner, ytd-watch-flexy #secondary-inner{padding:2.5vw !important;margin:0.5vw !important;background-color:#14172666 !important}.ytp-videowall-still-info-content *{background-color:#090711cc !important;padding:1vw;margin:0 !important;}.ytp-videowall-info-content{padding:0 !important;}a *{font-weight:bold !important;}*{color:#1e5eb3 !important;}#columns{margin:0 !important;padding-left:4vw !important;padding-right:4vw} .avatar-container *{ background-color:#141726 !important;}a{ font-weight:bold !important;}.sbdd_a *{ background-color:#141726 !important; border:0 !important;}.ytp-ad-image-overlay *{ display:none !important;}ytd-video-masthead-ad-v3-renderer{ display:none !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-mini-guide-renderer,ytd-mini-guide-renderer *{ background-color:#141726 !important;}ytd-section-list-renderer{ background-color:#070911 !important;}.ytd-page-manager{ background-color:#070911 !important;}#channel-container *{ background-color:#141726 !important;}app-toolbar *{ background-color:#141726 !important;g}ytd-guide-renderer{ background-color:#141726 !important;}ytd-clarification-renderer{ display:none !important;}::placeholder,input{font-family:monospace;}.ytd-playlist-panel-renderer{background:rgba(0,0,0,0) !important;}ytd-player #container #movie_player{background-color:#090711 !important;}#merch-shelf{display:none !important;}#columns{background-color:#090711;}#masthead-container #container{ background-color:#141726;}#masthead-container #container #logo-icon-container,#country-code,#guide-icon,#end #buttons{ display:none;}#container.ytd-searchbox input.ytd-searchbox{ color:#bbbbff !important;;}html{ font-family:monospace !important; font-size:9px !important;}#top-level-buttons{ display:none !important;}ytd-menu-renderer{ display:none !important;}#companion,#like-bar{ display:none !important;}.style-scope .ytd-sentiment-bar-renderer{ display:none !important;}#subscribe-button{ display:none !important;}ytd-rich-metadata-renderer{ display:none !important;}yt-dropdown-menu{ display:none !important;}ytd-comment-simplebox-renderer{ display:none;}.ytd-comments #header{ display:none !important;}.ytd-video-owner-renderer{ display:none;}span{ color:#ffffff;}ytd-expander{ margin-left:0 !important;;}#collapsible .style-scope .ytd-video-secondary-info-renderer{ display:none !important;}ytd-player{ background-color:#090711;}.ytp-gradient-bottom{ display:none;}.ytp-chrome-controls{ background-color:#141726;}"); +document.getElementsByTagName("html")[0].setAttribute("dark","true"); +} +if (hostname == "gitlab.com") { +var element = document.getElementsByTagName("tr"); +element.outerHTML = element.outerHTML; +addGlobalStyle("*{color:#1e5eb3 !important;}#js-tab-pipeline *{background-color:#090711 !important}form *{background-color:#090711 !important;}h1,h2,h3,h4,h5,h6{color:inherit !important;}.avatar-container *{ background-color:#141726 !important;}.top-bar{ background:#111111 !important;}aside{ background-color:#111111 !important;}.js-jobs-container{ background-color:#111111 !important;}.build-job *{ background-color:#222222 !important; border:0 !important;}body.ui-indigo .navbar-gitlab .navbar-sub-nav > li.active > button{ background-color:rgba(10,10,10,0.5) !important;}.content-block, .content-block *, .content-block * *{ background-color:#141726 !important;}.dropdown{ background-color:rgba(0,0,0,0) !important;}.file-holder *{ background-color:#141726 !important;}.banner-callout{ display:none !important;}.bg-light{ background-color:#141726 !important; border:none !important;}*{ color:#1e5eb3 !important; border-radius:0 !important;}.avatar-tile{ background-color:#141726 !important;}.avatar-container{ background-color:rgba(0,0,0,0) !important;}textarea{ border:0 !important; background-color:rgba(50,50,50,0.5) !important;}.input-group-prepend,.input-group-prepend div{ border:0 !important; background-color:rgba(25,25,25,0.5) !important;}gspan{color:#aaaaaa !important}.commit-sha-group div{ background-color:#141726 !important; border:0 !important; color:#ffffff !important;}.ci-status-link{ display:none !important;}.card, .card div{ background-color:#141726 !important;}.card{ border:0 !important;}.row-content-block{ background-color:#141726; border:0 !important;}.commit-header{ background-color:#141726 !important; border:0 !important;}body{font-family:monospace !important}.toggle-sidebar-button{ background-color:#141726; border:0 !important;}.dropdown-menu{ background-color:#141726;}input{ background:rgba(50,50,50,0.5) !important;}.cover-block{ background-color:#141726; color:#ffffff !important; padding-bottom:5vh !important;}.cover-block p,.cover-block .cover-title{ color:#ffffff !important;}.profile-link-holder{ color:#ffffff !important;}.cover-block .scrolling-tabs-container .nav-links{ border-bottom:0; position:relative; top:5vh;}.cover-block .scrolling-tabs-container .nav-links li{ border-top:#ffffff 1px solid !important;}.user-caller{display:none !important;}.avatar-container{border:0 !important;border-radius:0 !important;}article{border:0 !important;}article div{background-color:#141726 !important; border:0 !important; color:#ffffff !important;}article p{ color:#ffffff !important;}code{ background-color:rgba(15,15,15,0.5)}body{ background-color:#090711; color:#1e5eb3 !important;}#content-body input,#content-body button,#content-body.dropdown,#content-body a{ border:none; background-color:rgba(0,0,0,0) !important; color:#1e5eb3 !important;font-weight:bold !important;}header{ background-color:#141726 !important;}.nav-sidebar{ background-color:#141726 !important;}.fly-out-list{ background-color:#141726 !important; border:0; border:#393982 1px solid !important; color:#ffffff !important;}a{ color:#ffffff !important;}.info-well{ background-color:rgba(0,0,0,0); border:0;}.bs-callout{ display:none !important;}.count-badge-count{ display:none !important;}table{ border:0 !important; background-color:rgba(0,0,0,0) !important; color:#ffffff !important;}.table-holder{ border:0 !important;}thead th{ background-color:#141726 !important; border:0 !important;}tr{ border-bottom-color:#141726 !important;}tr:hover{ border-bottom-color:#141726 !important; display:}"); +} +if (hostname == "searx.me" || hostname == "searx.ch") {addGlobalStyle("*{color:#1e5eb3 !important;border-color:#1e5e3 !important;}#categories label{ background-color:#141726; border:none !important; padding:1vw; cursor:pointer; border-bottom:#5555 5px solid !important;}.result{ background-color:rgba(0,0,0,0) !important;}.highlight{ background-color:#aaa !important;}.alert{ background-color:rgba(10,10,10,0.5) !important;}.panel div{ background-color:#090711 !important; color:#1e5eb3 !important;}.panel img{ border:7.5px solid #141726}.searx-navbar{ background-color:#141726;}body{ background-color:#090711; font-family:monospace !important;}input,button{ background-color:rgba(0,0,0,0) !important;}.footer{ display:none;}");} +if (hostname == "neinchan.com") { +addGlobalStyle(".greenText{color:#3ab475 !important;}a{color:#3ab475 !important;font-weight:bold !important;font-decoration:underline !important;}*{color:#1e5eb3 !important;}fieldset{ border:0 !important;}fieldset legend{ display:none !important;}.small{ display:none !important;g}*{border-radius:0 !important; background-color:#070911 !important;font-family:monospace !important;}nav{ padding-top:2vh !important; border-bottom:#aaaaaa 1px solid !important;}nav *,nav{ background-color:#141726 !important; color:#1e5eb3 !important;}hr{ border:0 !important; border-bottom:#aaaaaa 1px solid !important;}.postCell .innerPost{ border:#aaaaaa 1px solid !important;}.deletionCheckBox{ display:none !important;}th{ border:#aaaaaa 0.5px solid !important; padding-left:1vw !important; padding-right:1vw !important;}table input,table textarea,table .dropzone,button{ border:#aaaaaa 0.5px solid !important; padding:0.5vw !important; max-width:285px !important;}") +document.getElementsByTagName("table")[0].setAttribute("cellspacing","0") +} +function wikipedia() {addGlobalStyle("#mw-panel{margin:0 !important;width:10vw !important;}body{margin-right:10vw !important;}mw-navigation{display:none !important;}*{ border-color:#333333 !important;}img{ background-color:#333 !important;}code{color:#892b2b;border:0 !important;border-bottom:#fff 1px solid !important}html *{ background-color:#090711 !important; border-radius:0 !important;}p,h1,h2,h3,h4,h5,h6{ color:#892b2b !important;}.collapsible-heading div{ display:none !important;}th,td{ color:#ffffff;}a{ color:#3ab475 !important;}div{ color:#892b2b !important;}.mw-wiki-logo{ display:none !important;}#p-logo{ display:none !important;}#content{ border:none !important;}#mp-upper *,#mp-bottom *,#mp-center *,#mp-other-content *,#mp-other-lower *{ border:0 !important;}");} +if (hostname == "en.wikipedia.org") { +wikipedia(); +} +if (hostname == "en.m.wikipedia.org") { +wikipedia(); +} +if (hostname == "duckduckgo.com") {addGlobalStyle("body *{background-color:#090711 !important;color:#1e5eb3 !important;}a *{text-decoration:underline !important;}#header_wrapper *{background-color:#141726 !important;}.header--aside{display:none !important;}#header_wrapper{width:100vw !important; background-color:#141726 !important;}.header__search{border:#1e5eb3 1px solid !important;}div.search-filters-wrap::before{display:none !important;}div.search-filters-wrap::after{display:none !important;}.results--ads{display:none !important;}#header, #header *{background-color:#141726 !important;}") +} diff --git a/.config/vimb/style.css b/.config/vimb/style.css @@ -0,0 +1,21 @@ +span[vimbhint^='label'] { + background-color:#0a542599 !important; + border:0 !important; + color:#fff !important; + opacity:1 !important; + padding:1px !important; + text-transform:uppercase !important; + font-size:16px !important; +} +*[vimbhint^='hint'] { + background-color:#0a542533 !important; +} +*[vimbhint^='hint focus'] { + background-color:#0a542533 !important; +} +*{ +border-radius:0 !important; +} +body::-webkit-scrollbar { +display: none; +} diff --git a/.config/youtube-dl/config b/.config/youtube-dl/config @@ -0,0 +1,5 @@ +-ic + +--add-metadata + +-o '%(title)s.%(ext)s' diff --git a/.inputrc b/.inputrc @@ -0,0 +1 @@ +set colored-stats on diff --git a/.licenses/gplv2.license b/.licenses/gplv2.license @@ -0,0 +1,9 @@ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. diff --git a/.licenses/mit.license b/.licenses/mit.license @@ -0,0 +1,19 @@ +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. diff --git a/.ls_colors b/.ls_colors @@ -0,0 +1,2 @@ +#!/bin/bash +export LS_COLORS="di=35:fi=0:ln=33:ex=91;01:*.sh=91:*.html=92:*.css=97:*.md=97:*.yml=93:*.c=94:*.h=94:*.h.orig=94;01:*.h.rej=94;01:*.mk=96:*LICENSE=90:*Makefile=90:*README=97:*.c.orig=94;01:*.c.rej=94;01:*.png=95:*.jpg=95:*.heic=95:*.heif=95:*.mp3=95;01:*opus=.95;01:*.m4a=95;01:*.flac=95;01:*.wav=95;01:*.mp4=95;04:*.mkv=95;04" diff --git a/.profile b/.profile @@ -0,0 +1,34 @@ +# +# .profile +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ./licenses/gplv2.license +# + +export LC_CTYPE="en_US.UTF-8" +export LANG="en_US.UTF-8" +export SCRIPTS="$HOME/.scripts/bin" +scripts=$(ls -d $SCRIPTS/*/ | tr '\n' ':') +export PATH="$PATH:$scripts" +export EDITOR="vim" +export TERMINAL="urxvt" +export BROWSER="vimb" +export work="$HOME/work" +export WORK="$HOME/work" +export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" +export PASS="$WORK/pass" +export SHELL="/usr/bin/fish" +bash ~/.ls_colors +if [ "$hostname" != "" ] +then + echo > /dev/null +elif [ "$HOSTNAME" != "" ] +then + export hostname="$HOSTNAME" +elif [ "$(command -v hostname)" != "" ] +then + export hostname=$(hostname) +else + echo "No built in way to get a hostname..." +fi diff --git a/.scripts/bin/display/hlock b/.scripts/bin/display/hlock @@ -0,0 +1,39 @@ +#!/bin/bash +# +# hlock +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +image="/tmp/screen.png" +locker="i3lock -i" + +while getopts ":n:i:l:h:b:p:r" o; do case "${o}" in + i) image=${OPTARG} ;; + r) resolution=${OPTARG} ;; + b) blur=${OPTARG} ;; + p) locker=${OPTARG} ;; + n) convert="off" ;; + h) printf "Specify an image with -i, resolution with -r, imagemagick effects with -b, and the program used for locking with -p." ;; +esac done + +if [ "$convert" == "off" ] +then + echo "All image manipulation off..." + if [ "$image" == "" ] + then + echo "No image, please specify one..." + exit 1 + fi + echo "Getting image..." + cp $image /tmp/screen.png +else + res=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/') + convert -size 320x85 canvas:none -pointsize 72 -draw "text 25,60 'Locked...'" -channel RGBA -blur 0x6 -fill white -stroke white -draw "text 20,55 'Locked...'" /tmp/lock.png + echo "Resizing & blurring..." + ffmpeg -f x11grab -video_size $res -y -i $DISPLAY -i /tmp/lock.png -filter_complex "boxblur=8:1,overlay=(main_w-overlay_w)/12:(main_h-overlay_h)/2" -vframes 1 /tmp/screen.png -loglevel quiet + convert /tmp/screen.png $blur /tmp/screen.png +fi +echo "Locking..." +$locker /tmp/screen.png -t diff --git a/.scripts/bin/display/hlock.png b/.scripts/bin/display/hlock.png Binary files differ. diff --git a/.scripts/bin/display/hlockr b/.scripts/bin/display/hlockr @@ -0,0 +1,36 @@ +#!/bin/bash +# +# hlockr +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# + +while getopts ":n:i:l:h:b:p:r" o; do case "${o}" in + i) image=${OPTARG} ;; + r) resolution=${OPTARG} ;; + b) blur=${OPTARG} ;; + p) locker=${OPTARG} ;; + n) convert="off" ;; + h) printf "Specify an image with -i, resolution with -r, imagemagick effects with -b, and the program used for locking with -p." ;; +esac done + +if [ "$convert" == "off" ] +then + echo "All image manipulation off..." + if [ "$image" == "" ] + then + echo "No image, please specify one..." + exit 1 + fi +else + echo "Generating image..." + import -window root /tmp/screen.png + image="/tmp/screen.png" + resolution=$(xdpyinfo | awk '/dimensions/{print $2}') + blur="-blur 35 -paint 2" + locker="i3lock -i" + convert $image -resize $resolution\! $blur /tmp/screen.png +fi +$locker $image diff --git a/.scripts/bin/display/monitors.sh b/.scripts/bin/display/monitors.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output LVDS1 --primary --mode 1280x800 --pos 0x280 --rotate normal --output DP1 --off --output DP2 --off --output DP3 --off --output HDMI1 --off --output HDMI2 --off --output VGA1 --mode 1920x1080 --pos 1280x0 --rotate normal --output VIRTUAL1 --off diff --git a/.scripts/bin/display/rfeh b/.scripts/bin/display/rfeh @@ -0,0 +1,71 @@ +#!/bin/bash + +if [ "$(echo $1 | awk '/help/ {print $0}')" != "" ] +then + echo 'rfeh /path/to/folder [number of monitors or "auto"] [true for locking] [program to lock with] + +Written by Hayden Hamilton <hayden@haydenvh.com>' + exit 0 +fi +dir=$1 +filetypes="png jpg jpeg jpe tiff" +getfiles() { + files+=$(ls $dir | awk "/$1/ {print}") +} + +lock="$3" +baselockwith="$4" +if [ "$baselockwith" == "" ] +then + lockwith="i3lock" + lockop="-i" +else + lockwith="$(echo $baselockwith | awk '// {print $1}') + lockopt="$(echo $baselockwith | awk '// {print $2}') +fi +monitors=$2 +if [ "$2" == "" ] +then + monitors=$(xrandr --listmonitors | awk '/Monitors/ {print $2}') +elif [ "$2" == "auto" ] +then + monitors=$(xrandr --listmonitors | awk '/Monitors/ {print $2}') +fi + +allfiles() { + for filetype in $filetypes + do + getfiles $filetype + done + if [ "$files" == "" ] + then + echo "No files found..." + exit 1 + fi + files=$(echo $files | tr " " "\n" | sed "s~^~$dir~g") +} + +randomize() { + filearray=($files) + length=${#filearray[@]} + randomn=$(($RANDOM%$length)) + echo ${filearray[$randomn]} +} + +allfiles +files=$(for i in `seq $monitors`; do randomize; done) +if [ -d ~/.cache/rfeh/ ] +then + echo > /dev/null +else + mkdir -p ~/.cache/rfeh +fi +echo $files > ~/.cache/rfeh/prev +if [ "$lock" == "true" ] +then + files=$(echo "$files" | tr " " "\n" | sed "s~^~$lockopt ~g" | tr "\n" " ") + $lockwith $files +else + files=$(echo "$files" | tr " " "\n" | sed "s~^~--bg-fill ~g" | tr "\n" " ") + feh $files +fi diff --git a/.scripts/bin/dmenu/daskpass b/.scripts/bin/dmenu/daskpass @@ -0,0 +1,11 @@ +#!/bin/bash +#!/bin/bash +# +# dmenu/daskpass +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +. $HOME/.dmenurc +$dmenu -nf "#090711" -p "$1" <&- && echo diff --git a/.scripts/bin/dmenu/dbrowse b/.scripts/bin/dmenu/dbrowse @@ -0,0 +1,9 @@ +# +# dbrowse +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 .licenses/gplv2.license +# + +dfm vimb ~/general/documents diff --git a/.scripts/bin/dmenu/dfm b/.scripts/bin/dmenu/dfm @@ -0,0 +1,156 @@ +#!/bin/bash +# +# dfm - Hayden's Dmenu File Manager +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +dmenu="dmenu" +. $HOME/.dmenurc +. $HOME/.config/dfm/config + +confdir="$HOME/.config/dfm" +conffile="$confdir/config" + +makeconfdir(){ + if [ -d $confdir ] + then + echo > /dev/null + else + mkdir -p $confdir + fi +} + +sendconf(){ + varname="$1" + varcont="$2" + makeconfdir + if [ -f conffile ] + then + if [ "$(awk "/${varname}=/ {print}" $conffile)" != "" ] + then + sed -i "/${varname}=/d" $conffile + fi + fi + echo "${varname}=\"${varcont}\"" >> $conffile + . $conffile +} + +getdot(){ + . $conffile + if [ "$DFM_DOT" == "1" ] + then + lscommand="ls -A" + elif [ "$DFM_DOT" == "0" ] + then + lscommand="ls" + else + lscommand="ls -A" + fi +} + +fmspecial(){ + if [ "$output2" == "RM - Remove file" ] + then + rm $output + elif [ "$output2" == "CMD - Specific command" ] + then + output3=$(dmenu_path | $dmenu -i -p "Select program") + $output3 $output + elif [ "$output2" == "MV - Move file" ] + then + output3=$(echo "" | $dmenu -i -p "Move to:") + mv $output $output3 + elif [ "$output2" == "EDIT - Open with $EDITOR" ] + then + $EDITOR $output + fi +} + +cd $2 +while true +do + getdot + output=$(echo "FM * .. $($lscommand)" | tr "\n" " " | tr " " "\n" | $dmenu -l 30 -i -p "Select file/directory:") + fmcmd1="MD - Make dir +MF - Make file +BM - Bookmarks +FND - Find +HIDE - Toggle Dotfiles" + fmcmd2="MV - Move file +RM - Remove file +CMD - Specific command +EDIT - Open with $EDITOR" + + if [ "$output" == "FM" ] + then + output=$(echo "$fmcmd1" | $dmenu -l 30 -i -p "Select command:") + if [ "$output" == "MD - Make dir" ] + then + output2=$(echo "" | $dmenu -i -p "Name dir:") + mkdir $output2 + elif [ "$output" == "MF - Make file" ] + then + output2=$(echo "" | $dmenu -i -p "Name file:") + touch $output2 + elif [ "$output" == "BM - Bookmarks" ] + then + mkdir ~/.config/dfm/ + touch ~/.config/dfm/bookmarks + output=$(echo "MK DEL $(cat ~/.config/dfm/bookmarks | awk '// {print $1}')" | tr "\n" " " | tr " " "\n" | $dmenu -l 30 -i -p "Select file/directory:") + if [ "$output" == "MK" ] + then + output=$(echo "" | $dmenu -i -p "Choose bookmark name(no spaces):") + output2=$(echo "" | $dmenu -i -p "Choose bookmark path(absolute):") + echo "$output $output2" >> ~/.config/dfm/bookmarks + elif [ "$output" == "DEL" ] + then + output=$(echo "$(cat ~/.config/dfm/bookmarks | awk '// {print $1}')" | $dmenu -l 30 -i -p "Select bookmark to delete:") + delete=$(cat ~/.config/dfm/bookmarks | awk "/$output/") + cat ~/.config/dfm/bookmarks | sed "/$delete/d" > ~/.config/dfm/bookmarks + else + output=$(cat ~/.config/dfm/bookmarks | awk "/$output/"' {print $2}') + output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") + fmspecial + fi + elif [ "$output" == "FND - Find" ] + then + output=$(echo "" | $dmenu -i -p "Enter name of file:") + (find . | grep "$output") + output3=$(echo "$(find . | grep "$output")" | $dmenu -i -l 30 -p "Select file:") + elif [ "$output" == "HIDE - Toggle Dotfiles" ] + then + if [ "$DFM_DOT" == "0" ] + then + export DFM_DOT="1" + sendconf "DFM_DOT" "1" + elif [ "$DFM_DOT" == "1" ] + then + export DFM_DOT="0" + sendconf "DFM_DOT" "0" + else + export DFM_DOT="0" + sendconf "DFM_DOT" "0" + fi + fi + elif [ -d "$output" ] + then + cd $output + elif [ "$output" == "exit" ] + then + exit 1 + elif [ "$output" == "" ] + then + exit 1 + else + if [ "$1" == "fm" ] + then + output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") + fmspecial + else + $1 $output + $pause + fi + fi +done diff --git a/.scripts/bin/dmenu/dmenurun b/.scripts/bin/dmenu/dmenurun @@ -0,0 +1,3 @@ +#!/bin/bash +. $HOME/.dmenurc +dmenu_path | $dmenu "$@" | ${SHELL:-"/bin/bash"} & diff --git a/.scripts/bin/dmenu/dmount b/.scripts/bin/dmenu/dmount @@ -0,0 +1,56 @@ +#!/bin/bash +. $HOME/.dmenurc + +getmount() { \ + [ -z "$chosen" ] && exit 1 + mp="$(find $1 2>/dev/null | $dmenu -i -p "Type in mount point.")" + [ "$mp" = "" ] && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | $dmenu -i -p "$mp does not exist. Create it?") + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | $dmenu -i -p "Mount which drive?" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \\( -path *%s -prune \\) \\ \n",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; + esac + notify-send "USB mounting" "$chosen mounted to $mp." + } + +mountandroid() { \ + chosen=$(echo "$anddrives" | $dmenu -i -p "Which Android device?" | cut -d : -f 1) + getmount "$HOME -maxdepth 3 -type d" + simple-mtpfs --device "$chosen" "$mp" + notify-send "Android Mounting" "Android device mounted to $mp." + } + +asktype() { \ + case $(printf "USB\\nAndroid" | $dmenu -i -p "Mount a USB drive or Android device?") in + USB) mountusb ;; + Android) mountandroid ;; + esac + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')" + +if [ -z "$usbdrives" ]; then + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/.scripts/bin/dmenu/dmpv b/.scripts/bin/dmenu/dmpv @@ -0,0 +1,6 @@ +#!/bin/bash + +. $HOME/.dmenurc + +hmpv pause $3 +dfm "mpv --input-ipc-server $2 $4" ~/$1 diff --git a/.scripts/bin/dmenu/dmpvurl b/.scripts/bin/dmenu/dmpvurl @@ -0,0 +1,18 @@ +#!/bin/bash +#!/bin/bash +# +# dmenu/dmpvurl +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# + +. $HOME/.dmenurc +socket="$1" +socket2="$2" +do_url() { + hmpv pause $socket;echo $url | xargs $1 +} +url=$(xclip -o | tr " " "\n" | awk '/http/ {print}' | $dmenu -p "URL:") +do_url "mpv --input-ipc-server=$socket2" diff --git a/.scripts/bin/dmenu/dpass b/.scripts/bin/dmenu/dpass @@ -0,0 +1,43 @@ +#!/bin/bash +# +# dmenu/dpass +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +. $HOME/.dmenurc + +lower() { + printf '%s\n' "${1,,}" +} + +if [ -f $PASS ] +then + echo "" +else + notify-send "Password file does not exist, creating it." + touch $PASS +fi +pass=$(cat $PASS | awk '// {print $1}' | $dmenu -l 50 -i -p "Select a password/generate/edit:" | tr '[:upper:]' '[:lower:]') +getpass=$(cat $PASS | awk "/$pass/ "'{print $0}') +if [ "$pass" == "" ] +then + exit 0 +elif [ "$pass" == "generate" ] +then + password=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_+=-' | fold -w 30 | head -n 1) + passname=$(echo "" | $dmenu -l 50 -i -p "Name for password (only 1 word):") + if [ "$passname" == "" ] + then + passname="pleaseeditthis" + fi + echo "$passname: $password" >> $PASS + userinput "Edit the pasword file?" "$TERMINAL -hold -e vim $PASS" +elif [ "$pass" == "edit" ] +then + $TERMINAL -hold -e vim $PASS +else + echo $getpass | sed "s/$pass.//g" | tr " " "\n" | $dmenu $2 -l 50 -p "Password:" | xclip + notify-send "Password copied to clipboard." +fi diff --git a/.scripts/bin/dmenu/dumount b/.scripts/bin/dmenu/dumount @@ -0,0 +1,39 @@ +#!/bin/bash +. $HOME/.dmenurc + +unmountusb() { + [ -z "$drives" ] && exit + chosen=$(echo "$drives" | $dmenu -i -p "Unmount which drive?" | awk '{print $1}') + [ -z "$chosen" ] && exit + sudo -A umount "$chosen" && notify-send "USB unmounting" "$chosen unmounted." + } + +unmountandroid() { \ + chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | $dmenu -i -p "Unmount which device?") + [ -z "$chosen" ] && exit + sudo -A umount -l "$chosen" && notify-send "Android unmounting" "$chosen unmounted." + } + +asktype() { \ + case "$(printf "USB\\nAndroid" | $dmenu -i -p "Unmount a USB drive or Android device?")" in + USB) unmountusb ;; + Android) unmountandroid ;; + esac + } + +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') + +if ! grep simple-mtpfs /etc/mtab; then + [ -z "$drives" ] && echo "No drives to unmount." && exit + echo "Unmountable USB drive detected." + unmountusb +else + if [ -z "$drives" ] + then + echo "Unmountable Android device detected." + unmountandroid + else + echo "Unmountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/.scripts/bin/dmenu/dvimedit b/.scripts/bin/dmenu/dvimedit @@ -0,0 +1,12 @@ +#!/bin/bash +#!/bin/bash +# +# dmenu/dvimedit +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# +. $HOME/.dmenurc + +dfm vim ~ diff --git a/.scripts/bin/dmenu/userinput b/.scripts/bin/dmenu/userinput @@ -0,0 +1,12 @@ +#!/bin/bash +# +# dmenu/userinput +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license +# + +. $HOME/.dmenurc + +[ "$(printf "No\\nYes" | $dmenu -i -p "$1")" = "Yes" ] && $2 diff --git a/.scripts/bin/i3/crefresh b/.scripts/bin/i3/crefresh @@ -0,0 +1,4 @@ +#!/bin/bash + +sleep 0.1 +killall picom; picom --config ~/.config/picom/config -b -f diff --git a/.scripts/bin/i3/ffflaunch b/.scripts/bin/i3/ffflaunch @@ -0,0 +1,13 @@ +#!/bin/bash + +. ~/.ls_colors + +export FFF_LS_COLORS=1 +export FFF_COL2=5 +export FFF_COL4=8 + +export FFF_FAV1=~/work +export FFF_FAV2=~/.wallpapers +export FFF_FAV3=~/music + +fff diff --git a/.scripts/bin/i3/hvol b/.scripts/bin/i3/hvol @@ -0,0 +1,11 @@ +#!/bin/bash +if [ $1 == "toggle" ] +then + amixer set Master $1 + volume=$(amixer sget Master | awk '/Mono/ {print $6}' | sed 's/\[//g' | sed 's/\]//g') + volume=$(echo $volume | sed -ne 's/.*/Volume set to &/p') + notify-send "$volume" +else + amixer set Master $1 + volume=$(amixer sget Master | awk '/Mono/ {print $4}' | sed 's/\[//g' | sed 's/\]//g') +fi diff --git a/.scripts/bin/i3/locker b/.scripts/bin/i3/locker @@ -0,0 +1,8 @@ +#!/bin/bash +socket1="$1" +socket2="$2" + + +echo "dmpv/rmpv: $(hmpv state $socket1)" > ~/.cache/socket; echo "dmpvurl: $(hmpv state $socket2)" >> ~/.cache/socket +hmpv pause $socket1; sleep 0.1; hmpv pause $socket2; sleep 0.1; hmpv pause $socket2; sleep 0.1; hmpv pause $socket2 +hlock; lockerexit /tmp/mpv-socket2 /tmp/mpv-socket diff --git a/.scripts/bin/i3/lockerexit b/.scripts/bin/i3/lockerexit @@ -0,0 +1,27 @@ +#!/bin/bash +socket1="$1" +socket2="$2" + +i3lock=$(ps -e | grep 'i3lock') +until [ "$i3lock" == "" ] +do + sleep 0.5 + i3lock=$(ps -e | grep 'i3lock') +done + +state=$(cat ~/.cache/socket | awk '/:/') +state1=$(echo "$state" | head -n -1 | awk '{print $2}') +echo $state1 +state2=$(echo "$state" | tail +2 | awk '{print $2}') +echo $state2 + +if [ "$state1" == "playing" ] +then + hmpv unpause $socket1 +elif [ "$state2" == "playing" ] +then + hmpv unpause $socket2 +else + echo "None playing, starting first socket..." + hmpv unpause $socket1 +fi diff --git a/.scripts/bin/i3/moveentire b/.scripts/bin/i3/moveentire @@ -0,0 +1,9 @@ +#!/bin/bash +ws="$1" + +for i in `seq 5` +do +i3-msg focus parent +done +i3-msg move container to workspace $ws +i3-msg workspace $ws diff --git a/.scripts/bin/i3/moveone b/.scripts/bin/i3/moveone @@ -0,0 +1,5 @@ +#!/bin/bash +ws="$1" + +i3-msg move container to workspace "$ws" +i3-msg workspace "$ws" diff --git a/.scripts/bin/i3/mpvlisten b/.scripts/bin/i3/mpvlisten @@ -0,0 +1,26 @@ +#!/bin/bash +socket1="$1" +socket2="$2" +apause="false" + +while true +do + state=$(hmpv state $socket1) + sleep 0.1 + if [ "$state" == "playing" ] + then + if [ "$aplay" == "false" ] + then + hmpv pause $socket2 + apause="false" + aplay="true" + fi + else + if [ "$apause" == "false" ] + then + hmpv unpause $socket2 + apause="true" + aplay="false" + fi + fi +done diff --git a/.scripts/bin/i3/wallvar b/.scripts/bin/i3/wallvar @@ -0,0 +1,9 @@ +#!/bin/bash +dir="$1" +time="$2" + +while true +do + sleep $time + rfeh $dir +done diff --git a/.scripts/bin/misc/hirssi b/.scripts/bin/misc/hirssi @@ -0,0 +1,3 @@ +#!/bin/bash +. $HOME/.config/irssi/userrc +irssi --home ~/.config/irssi/ -n $IRCUSER -c chat.freenode.net 6667 $IRCUSER:$IRCPASS diff --git a/.scripts/bin/misc/hmpv b/.scripts/bin/misc/hmpv @@ -0,0 +1,85 @@ +#!/bin/bash + +action=$1 +socket=$2 +pause() { + echo '{ "command": ["set_property", "pause", true] }' | socat - $socket > /dev/null +} +unpause() { + echo '{ "command": ["set_property", "pause", false] }' | socat - $socket > /dev/null +} +getstate() { + stateraw=$(echo '{ "command": ["get_property", "pause"] }' | socat - $socket | tr '{":0,}' ' ' | awk '// {print $2}') + if [ "$stateraw" == "true" ] + then + state="paused" + elif [ "$stateraw" == "false" ] + then + state="playing" + else + echo "No state returned..." + exit 1 + fi +} +toggle() { + getstate + if [ "$state" == "playing" ] + then + pause + elif [ "$state" == "paused" ] + then + unpause + else + echo "State is undeciferable..." + exit 1 + fi +} +seek() { + if [ "$action" == "forward" ] + then + echo '{ "command": ["seek", "10"] }' | socat - $socket > /dev/null + elif [ "$action" == "back" ] + then + echo '{ "command": ["seek", "-10"] }' | socat - $socket > /dev/null + elif [ "$action" == "next" ] + then + echo '{ "command": ["playlist-next"] }' | socat - $socket > /dev/null + elif [ "$action" == "prev" ] + then + echo '{ "command": ["playlist-prev"] }' | socat - $socket > /dev/null + fi +} +convertsecs() { + ((h=${1}/3600)) + ((m=(${1}%3600)/60)) + ((s=${1}%60)) + printf "%02d:%02d:%02d\n" $h $m $s +} +gettime() { + convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | socat - $socket | tr '{":,}' ' ' | awk '// {print $2}' | sed 's/\./ /g' | awk '// {print $1}') +} +quit() { + echo '{ "command": ["quit"] }' | socat - $socket > /dev/null +} + +if [ "$action" == "toggle" ] +then + toggle +elif [ "$action" == "quit" ] +then + quit +elif [ "$action" == "pause" ] +then + pause +elif [ "$action" == "unpause" ] +then + unpause +elif [ "$action" == "state" ] +then + getstate; echo "$state" +elif [ "$action" == "time" ] +then + gettime +else + seek +fi diff --git a/.scripts/bin/misc/ircgetpass b/.scripts/bin/misc/ircgetpass @@ -0,0 +1,3 @@ +#/bin/bash +. $HOME/.config/irssi/userrc +echo "/connect chat.freenode.net 6667 $IRCUSER:$IRCPASS" | xclip diff --git a/.scripts/bin/misc/pipes b/.scripts/bin/misc/pipes @@ -0,0 +1,385 @@ +#!/usr/bin/env bash +# pipes.sh: Animated pipes terminal screensaver. +# https://github.com/pipeseroni/pipes.sh +# +# Copyright (c) 2015-2018 Pipeseroni/pipes.sh contributors +# Copyright (c) 2013-2015 Yu-Jie Lin +# Copyright (c) 2010 Matthew Simpson +# +# 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. + + +VERSION=1.3.0 + +M=32768 # Bash RANDOM maximum + 1 +p=1 # number of pipes +f=75 # frame rate +s=13 # probability of straight fitting +r=2000 # characters limit +t=0 # iteration counter for -r character limit +w=80 # terminal size +h=24 + +# ab -> sets[][idx] = a*4 + b +# 0: up, 1: right, 2: down, 3: left +# 00 means going up , then going up -> ┃ +# 12 means going right, then going down -> ┓ +sets=( + "┃┏ ┓┛━┓ ┗┃┛┗ ┏━" + "│╭ ╮╯─╮ ╰│╯╰ ╭─" + "│┌ ┐┘─┐ └│┘└ ┌─" + "║╔ ╗╝═╗ ╚║╝╚ ╔═" + "|+ ++-+ +|++ +-" + "|/ \/-\ \|/\ /-" + ".. .... .... .." + ".o oo.o o.oo o." + "-\ /\|/ /-\/ \|" # railway + "╿┍ ┑┚╼┒ ┕╽┙┖ ┎╾" # knobby pipe +) +SETS=() # rearranged all pipe chars into individul elements for easier access + +# pipes' +x=() # current position +y=() +l=() # current directions + # 0: up, 1: right, 2: down, 3: left +n=() # new directions +v=() # current types +c=() # current escape codes + +# selected pipes' +V=() # types (indexes to sets[]) +C=() # color indices for tput setaf +VN=0 # number of selected types +CN=0 # number of selected colors +E=() # pre-generated escape codes from BOLD, NOCOLOR, and C + +# switches +RNDSTART=0 # randomize starting position and direction +BOLD=1 +NOCOLOR=0 +KEEPCT=0 # keep pipe color and type + + +# print help message in 72-char width +print_help() { + local cgap + printf -v cgap '%*s' $((15 - ${#COLORS})) '' + cat <<HELP +Usage: $(basename $0) [OPTION]... +Animated pipes terminal screensaver. + + -p [1-] number of pipes (D=1) + -t [0-$((${#sets[@]} - 1))] pipe type (D=0) + -t c[16 chars] custom pipe type + -c [0-$COLORS]${cgap}pipe color INDEX (TERM=$TERM), can be + hexadecimal with '#' prefix + (D=-c 1 -c 2 ... -c 7 -c 0) + -f [20-100] framerate (D=75) + -s [5-15] going straight probability, 1 in (D=13) + -r [0-] reset after (D=2000) characters, 0 if no reset + -R randomize starting position and direction + -B no bold effect + -C no color + -K keep pipe color and type when crossing edges + -h print this help message + -v print version number + +Note: -t and -c can be used more than once. +HELP +} + + +# parse command-line options +# It depends on a valid COLORS which is set by _CP_init_termcap_vars +parse() { + # test if $1 is a natural number in decimal, an integer >= 0 + is_N() { + [[ -n $1 && -z ${1//[0-9]} ]] + } + + + # test if $1 is a hexadecimal string + is_hex() { + [[ -n $1 && -z ${1//[0-9A-Fa-f]} ]] + } + + + # print error message for invalid argument to standard error, this + # - mimics getopts error message + # - use all positional parameters as error message + # - has a newline appended + # $arg and $OPTARG are the option name and argument set by getopts. + pearg() { + printf "%s: -$arg invalid argument -- $OPTARG; %s\n" "$0" "$*" >&2 + } + + + OPTIND=1 + while getopts "p:t:c:f:s:r:RBCKhv" arg; do + case $arg in + p) + if is_N "$OPTARG" && ((OPTARG > 0)); then + p=$OPTARG + else + pearg 'must be an integer and greater than 0' + return 1 + fi + ;; + t) + if [[ "$OPTARG" = c???????????????? ]]; then + V+=(${#sets[@]}) + sets+=("${OPTARG:1}") + elif is_N "$OPTARG" && ((OPTARG < ${#sets[@]})); then + V+=($OPTARG) + else + pearg 'must be an integer and from 0 to' \ + "$((${#sets[@]} - 1)); or a custom type" + return 1 + fi + ;; + c) + if [[ $OPTARG == '#'* ]]; then + if ! is_hex "${OPTARG:1}"; then + pearg 'unrecognized hexadecimal string' + return 1 + fi + if ((16$OPTARG >= COLORS)); then + pearg 'hexadecimal must be from #0 to' \ + "#$(printf '%X' $((COLORS - 1)))" + return 1 + fi + C+=($((16$OPTARG))) + elif is_N "$OPTARG" && ((OPTARG < COLORS)); then + C+=($OPTARG) + else + pearg "must be an integer and from 0 to $((COLORS - 1));" \ + 'or a hexadecimal string with # prefix' + return 1 + fi + ;; + f) + if is_N "$OPTARG" && ((OPTARG >= 20 && OPTARG <= 100)); then + f=$OPTARG + else + pearg 'must be an integer and from 20 to 100' + return 1 + fi + ;; + s) + if is_N "$OPTARG" && ((OPTARG >= 5 && OPTARG <= 15)); then + s=$OPTARG + else + pearg 'must be an integer and from 5 to 15' + return 1 + fi + ;; + r) + if is_N "$OPTARG"; then + r=$OPTARG + else + pearg 'must be a non-negative integer' + return 1 + fi + ;; + R) RNDSTART=1;; + B) BOLD=0;; + C) NOCOLOR=1;; + K) KEEPCT=1;; + h) + print_help + exit 0 + ;; + v) echo "$(basename -- "$0") $VERSION" + exit 0 + ;; + *) + return 1 + esac + done + + shift $((OPTIND - 1)) + if (($#)); then + printf "$0: illegal arguments -- $*; no arguments allowed\n" >&2 + return 1 + fi +} + + +cleanup() { + # clear out standard input + read -t 0.001 && cat </dev/stdin>/dev/null + + tput reset # fix for konsole, see pipeseroni/pipes.sh#43 + tput rmcup + tput cnorm + stty echo + printf "$SGR0" + exit 0 +} + + +resize() { + w=$(tput cols) h=$(tput lines) +} + + +init_pipes() { + # +_CP_init_pipes + local i + + ci=$((KEEPCT ? 0 : CN * RANDOM / M)) + vi=$((KEEPCT ? 0 : VN * RANDOM / M)) + for ((i = 0; i < p; i++)); do + (( + n[i] = 0, + l[i] = RNDSTART ? RANDOM % 4 : 0, + x[i] = RNDSTART ? w * RANDOM / M : w / 2, + y[i] = RNDSTART ? h * RANDOM / M : h / 2, + v[i] = V[vi] + )) + c[i]=${E[ci]} + ((ci = (ci + 1) % CN, vi = (vi + 1) % VN)) + done + # -_CP_init_pipes +} + + +init_screen() { + stty -echo + tput smcup + tput civis + tput clear + trap cleanup HUP TERM + + resize + trap resize SIGWINCH +} + + +main() { + # simple pre-check of TERM, tput's error message should be enough + tput -T "$TERM" sgr0 >/dev/null || return $? + + # +_CP_init_termcap_vars + COLORS=$(tput colors) # COLORS - 1 == maximum color index for -c argument + SGR0=$(tput sgr0) + SGR_BOLD=$(tput bold) + # -_CP_init_termcap_vars + + parse "$@" || return $? + + # +_CP_init_VC + # set default values if not by options + ((${#V[@]})) || V=(0) + VN=${#V[@]} + ((${#C[@]})) || C=(1 2 3 4 5 6 7 0) + CN=${#C[@]} + # -_CP_init_VC + + # +_CP_init_E + # generate E[] based on BOLD (SGR_BOLD), NOCOLOR, and C for each element in + # C, a corresponding element in E[] = + # SGR0 + # + SGR_BOLD, if BOLD + # + tput setaf C, if !NOCOLOR + local i + for ((i = 0; i < CN; i++)) { + E[i]=$SGR0 + ((BOLD)) && E[i]+=$SGR_BOLD + ((NOCOLOR)) || E[i]+=$(tput setaf ${C[i]}) + } + # -_CP_init_E + + # +_CP_init_SETS + local i j + for ((i = 0; i < ${#sets[@]}; i++)) { + for ((j = 0; j < 16; j++)) { + SETS+=("${sets[i]:j:1}") + } + } + unset i j + # -_CP_init_SETS + + init_screen + init_pipes + + # any key press exits the loop and this script + trap 'break 2' INT + + local i + while REPLY=; do + read -t 0.0$((1000 / f)) -n 1 2>/dev/null + case "$REPLY" in + P) ((s = s < 15 ? s + 1 : s));; + O) ((s = s > 3 ? s - 1 : s));; + F) ((f = f < 100 ? f + 1 : f));; + D) ((f = f > 20 ? f - 1 : f));; + B) ((BOLD = (BOLD + 1) % 2));; + C) ((NOCOLOR = (NOCOLOR + 1) % 2));; + K) ((KEEPCT = (KEEPCT + 1) % 2));; + ?) break;; + esac + for ((i = 0; i < p; i++)); do + # New position: + # l[] direction = 0: up, 1: right, 2: down, 3: left + # +_CP_newpos + ((l[i] % 2)) && ((x[i] += -l[i] + 2, 1)) || ((y[i] += l[i] - 1)) + # -_CP_newpos + + # Loop on edges (change color on loop): + # +_CP_warp + ((!KEEPCT && (x[i] >= w || x[i] < 0 || y[i] >= h || y[i] < 0))) \ + && { c[i]=${E[CN * RANDOM / M]}; ((v[i] = V[VN * RANDOM / M])); } + ((x[i] = (x[i] + w) % w, + y[i] = (y[i] + h) % h)) + # -_CP_warp + + # new turning direction: + # $((s - 1)) in $s, going straight, therefore n[i] == l[i]; + # and 1 in $s that pipe makes a right or left turn + # + # s * RANDOM / M - 1 == 0 + # n[i] == -1 + # => n[i] == l[i] + 1 or l[i] - 1 + # +_CP_newdir + (( + n[i] = s * RANDOM / M - 1, + n[i] = n[i] >= 0 ? l[i] : l[i] + (2 * (RANDOM % 2) - 1), + n[i] = (n[i] + 4) % 4 + )) + # -_CP_newdir + + # Print: + # +_CP_print + printf '\e[%d;%dH%s%s' \ + $((y[i] + 1)) $((x[i] + 1)) ${c[i]} \ + "${SETS[v[i] * 16 + l[i] * 4 + n[i]]}" + # -_CP_print + l[i]=${n[i]} + done + ((r > 0 && t * p >= r)) && tput reset && tput civis && t=0 || ((t++)) + done + + cleanup +} + + +# when being sourced, $0 == bash, only invoke main when they are the same +[[ "$0" != "$BASH_SOURCE" ]] || main "$@" diff --git a/.scripts/bin/misc/rmpv b/.scripts/bin/misc/rmpv @@ -0,0 +1,32 @@ +#!/bin/bash + +dir=$1 +count="$2" +filetypes="mp3 opus mkv mp4 flac m4a webm wav" +getfiles() { + files+=$(find $dir | awk "/$1/ {print}") +} + +allfiles() { + for filetype in $filetypes + do + getfiles $filetype + done + if [ "$files" == "" ] + then + echo "No files found..." + exit 1 + fi +} + +randomize() { + filearray=($files) + length=${#filearray[@]} + randomn=$(($RANDOM%$length)) + echo ${filearray[$randomn]} +} + +allfiles +files=$(for i in `seq $count`; do randomize; done) +mpv --input-ipc-server=/tmp/mpv-socket $files + diff --git a/.scripts/bin/misc/trimfiles b/.scripts/bin/misc/trimfiles @@ -0,0 +1,14 @@ +#!/bin/bash + +dirs=$(ls -d */ */*/ */*/*/ 2>/dev/null) +for dir in $dirs +do + cd $dir + for f in *; do mv "$f" `echo $f | tr ' ' '.'`; done + backdir=$(echo $dir | tr "/" "\n" | wc -l) + backdir=$(($backdir-1)) + for i in `seq $backdir` + do + cd ../ + done +done diff --git a/.urxvt b/.urxvt @@ -0,0 +1 @@ +.config/urxvt/ +\ No newline at end of file diff --git a/.vim b/.vim @@ -0,0 +1 @@ +.config/vim +\ No newline at end of file diff --git a/.vimrc b/.vimrc @@ -0,0 +1,30 @@ +" +" .bashrc +" Created by Hayden Hamilton +" +" haydenvh.com +" Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ./licenses/gplv2.license +" + +"VI-M not VI +set nocompatible + +"Leader +let mapleader="," + +"Tab completion +set path+=** +set wildmenu +set wildmode=longest,list,full + +"Set colourscheme +syntax on +set background=dark +set relativenumber +set number +set hlsearch + +"Set useful bindings +nmap <Leader>s !bash % +nmap <Leader>p !perl % +nmap <Leader>u !g++ -o compilefile % diff --git a/.wall b/.wall @@ -0,0 +1 @@ +/home/hayden/.wallpapers/113.png /home/hayden/.wallpapers/106.png diff --git a/.xinitrc b/.xinitrc @@ -0,0 +1,2 @@ +exec i3 +exec urxvtd -q -f -o diff --git a/.xprofile b/.xprofile @@ -0,0 +1 @@ +.profile +\ No newline at end of file