dotfiles

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

commit 5a81957052b3163b89d655226458d5779b045ad0
parent 9a198d8b74068eac8b6c4ad56019a62abfa6cb15
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Thu, 28 May 2020 23:18:37 +0100

new scripts, and revamped dwm statusbar

Diffstat:
M.config/alias | 3++-
A.config/git/config | 9+++++++++
A.config/git/hist | 1+
M.config/irssi/config | 18+++---------------
M.config/irssi/pipeline.theme | 62++++++++++++++++++++++----------------------------------------
M.config/irssi/scripts/autorun/nickcolor.pl | 137++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
M.config/nvim/init.vim | 2++
M.config/nvim/modules/term.vim | 20++++++++++++++++++++
M.config/picom/config | 1+
M.config/sxhkd/sxhkdrc | 8+++++++-
M.config/vimb/config | 2++
M.config/zsh/alias.zsh | 3++-
M.config/zsh/functions.zsh | 17+++++++++++++++--
M.config/zsh/ls.zsh | 6++++--
M.scripts/bin/display/pexelgrab | 1+
D.scripts/bin/display/sent-ascii | 1-
A.scripts/bin/display/shmenu | 26++++++++++++++++++++++++++
M.scripts/bin/display/wallblur | 7+++----
M.scripts/bin/display/wbcachemake | 5++---
M.scripts/bin/dmenu/dfm | 3++-
M.scripts/bin/dmenu/dimg | 12++++++------
M.scripts/bin/genman/hvol | 3++-
A.scripts/bin/misc/alcl | 34++++++++++++++++++++++++++++++++++
M.scripts/bin/misc/dotadd | 1+
M.scripts/bin/misc/hmpv | 5+++++
M.scripts/bin/misc/rmpv | 6+++---
M.scripts/bin/misc/srssbnbc | 35+++++++++++++++++++----------------
A.scripts/bin/misc/sxhkdrestart | 3+++
M.scripts/dwmblocks/bat | 42+++++++++++++++++-------------------------
M.scripts/dwmblocks/cal | 2+-
M.scripts/dwmblocks/cpu | 2+-
M.scripts/dwmblocks/disk | 2+-
M.scripts/dwmblocks/disk2 | 2+-
M.scripts/dwmblocks/dwmbar | 17++++++++---------
M.scripts/dwmblocks/host | 2+-
M.scripts/dwmblocks/mem | 2+-
M.scripts/dwmblocks/mpv | 2+-
M.scripts/dwmblocks/net | 2+-
M.scripts/dwmblocks/news | 15++++++++-------
M.scripts/dwmblocks/time | 2+-
M.scripts/dwmblocks/time2 | 2+-
M.scripts/dwmblocks/title | 2+-
M.scripts/dwmblocks/vol | 2+-
M.zprofile | 1+
44 files changed, 379 insertions(+), 151 deletions(-)

diff --git a/.config/alias b/.config/alias @@ -32,11 +32,12 @@ cleancache sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/share/web mkconfall mkmailpass; mkalias tmux tmux -f ~/.config/tmux/config nw pkill newsboat; newsboat -nm neomutt ; rm /tmp/mail +nm neomutt ; rm /tmp/mail ; rm /tmp/blocks/mail ; rm /tmp/dwmblocks/mail ; rm /tmp/blocks/mail ; rm /tmp/dwmblocks/mail maic sudo make all install clean homesync rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/ tmux \tmux -f $HOME/.config/tmux/config notes vim ~/.local/notes +fwknop fwknop --rc-file=$HOME/.config/fwknop/config --save-args-file=/dev/full ~d cd ~/general/downloads; ls ~do cd ~/general/documents; ls ~iw cd ~/images/wallpapers; ls diff --git a/.config/git/config b/.config/git/config @@ -0,0 +1,9 @@ +# This is Git's per-user configuration file. +[user] + name = Hayden Hamilton + email = hayden@haydenvh.com +[blame] + date = human + +[alias] + hist = !sh ~/.config/git/hist diff --git a/.config/git/hist b/.config/git/hist @@ -0,0 +1 @@ +git log --pretty=format:"%Cblue%h%Creset %Cgreen%<(16)%ad%Creset | %s%d %C(cyan)%d%Creset %>|($(tput cols))%C(yellow)%an%Creset" --date human diff --git a/.config/irssi/config b/.config/irssi/config @@ -213,19 +213,6 @@ statusbar = { more = "-- more --"; }; default = { - window = { - disabled = "no"; - type = "window"; - placement = "bottom"; - position = "1"; - visible = "active"; - items = { - barstart = { priority = "100"; }; - act = { priority = "10"; }; - more = { priority = "-1"; alignment = "right"; }; - barend = { priority = "100"; alignment = "right"; }; - }; - }; window_inact = { type = "window"; placement = "bottom"; @@ -253,9 +240,9 @@ statusbar = { }; settings = { core = { - real_name = "haydenh"; + real_name = "haydenvh.com"; user_name = "haydenh"; - nick = "haydenh_"; + nick = "blerghghgh"; recode_transliterate = "no"; timestamp_format = "%H:%M:%S"; }; @@ -267,3 +254,4 @@ settings = { }; "irc/core" = { alternate_nick = "haydenh_"; }; }; +logs = { }; diff --git a/.config/irssi/pipeline.theme b/.config/irssi/pipeline.theme @@ -51,10 +51,10 @@ abstracts = { # some kind of comment is printed #comment = "$*"; - comment = "%b[%n$*%b]%n"; + comment = "%b$*%n"; # reason for something is printed (part, quit, kick, ..) - reason = "{comment %_$*%_}"; + reason = "{comment $*}"; # mode change is printed ([+o nick]) #mode = "{comment %n[%W$*]%n}"; @@ -64,14 +64,6 @@ abstracts = { ## 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"; @@ -113,8 +105,7 @@ abstracts = { # 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"; + pubmsgmenick = "$0$1%K %_#%_%n %|"; # public highlighted message in channel # $0 = highlight color, $1 = nick mode, $2 = nick @@ -130,7 +121,7 @@ abstracts = { # private message from you, $0 = "msg", $1 = target nick #ownprivmsg = "%b.%c.%C.%n[%cmsg%n(%c$1%n)] "; - ownprivmsg = "{msgnick $*}"; + ownprivmsg = "{msgnick $*}"; # own private message in query ownprivmsgnick = "{msgnick %W$*%w}"; @@ -144,24 +135,15 @@ abstracts = { ## # used internally by this theme - action_core = "%W*%w $*%n"; + action_core = "%w*%w %_$0%_ $1"; # 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 @@ -212,7 +194,7 @@ abstracts = { ## # background of statusbar - sb_background = "%N"; + sb_background = "%0"; isbstart = "%0" @@ -242,29 +224,29 @@ abstracts = { # %r%n%_$0%_$1%K |%n %| formats = { "fe-common/core" = { - pubmsg = "{pubmsgnick $2 {pubnick $[-16]0}}$1"; - join = " %_%B--->%_%K |%n %g{channick_hilight $0}%K!%n{chanhost_hilight $1}"; - part = " %_%G<---%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $3}"; - kick = " %_%G<<<!%_%K |%n %r{channick $0} %nby {nick $2} from {channel $1}: {reason $3}"; - quit = " %_%G<<--%_%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}"; + pubmsg = "{pubmsgnick $2 {pubnick $0}}$1"; + join = "%_%B+%_{pubnick $0} %n$1"; + part = "%_%G-{pubnick $0} %n$1 {reason $3}"; + kick = "%_%G!{pubnick $0} %nby {pubnick $2} from {channel $1} {reason $3}"; + quit = "%_%G<{pubnick $0} %n$1 {reason $2}"; + nick_changed = "{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}"; + pubmsg_me = "{pubmsgmenick $2 {pubnick $0}}$1"; + pubmsg_me_channel = "{pubmsgmenick $3 {pubnick $[-16]0}{msgchannel $1}}$2"; + pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2"; + pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2"; + chanmode_change = " {$channel $0} %W{pubnick $2} %nsets mode %B{$mode $1}"; + channel_mode = " {$channel $0} %W{pubnick $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}"; + chanmode_change = "%y{pubnick $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}"; + 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"; + own_action = "{action_core $0 $1}"; + action_public = "{action_core $0 $1}"; }; }; diff --git a/.config/irssi/scripts/autorun/nickcolor.pl b/.config/irssi/scripts/autorun/nickcolor.pl @@ -127,13 +127,142 @@ sub sig_public { else { # Normal message - Irssi::command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$[' . $truncate_value . ']0}}$1'); + Irssi::command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$0}}$1'); + Irssi::command('/^format part %_%G-{pubnick ' . $color . '$0} %n%w$1 {reason $3}'); + Irssi::command('/^format kick %_%G!{pubnick ' . $color . '$0} %nb%wy {pubnick $2} from ${channel $1} {reason $3}'); + Irssi::command('/^format join %_%B+%_{pubnick ' . $color . '$0} %n%w$1'); # Save nickname for next message $saved_nicks{$tagtarget} = $nick; } } +sub sig_quit { + my ($server, $nick, $address, $reason) = @_; + + 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 + + # 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 + Irssi::command('/^format quit %_%G<{pubnick ' . $color . '$0} %n%w$1 {reason $2}'); + +} + +# 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:"); + } + } # process public (me) messages sub sig_me { @@ -247,6 +376,12 @@ 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 join', 'sig_public'); +Irssi::signal_add('message part', 'sig_public'); +Irssi::signal_add('message quit', 'sig_public'); +Irssi::signal_add('message quit', 'sig_quit'); +Irssi::signal_add('message kick', 'sig_public'); +Irssi::signal_add('message nick', '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'); diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -187,6 +187,8 @@ noremap <c-y> "* nnoremap <leader>Tt :vsplit term://zsh<CR><c-h><c-l> nnoremap <leader>TT :split term://zsh<CR><c-k><c-j> tnoremap <leader><Esc> <C-\><C-n> +nnoremap <leader>shs :call Shmenu("~/.scripts/", "select a script")<CR> +nnoremap <leader>sho :let file=system("cat /tmp/shmenu-out")<CR>:execute 'edit! ' . file<CR> "Modules source ~/.config/nvim/modules/abbrs.vim diff --git a/.config/nvim/modules/term.vim b/.config/nvim/modules/term.vim @@ -6,6 +6,26 @@ function! Termstart() endif endfunction +function! Shmenu(dir, prompt) + call Shwin() + setlocal winhl=Normal:Float + execute 'silent! terminal find ' . a:dir . ' | shmenu ' . a:prompt . ' > /tmp/shmenu-out' + startinsert +endfunction + +function! Shwin() + let width=(&columns-(&columns/3)-10) + let height=(&lines-(&lines/3)-5) + let top=(&lines-height)/2 + let left=(&columns-width)/2 + let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} + let opts.row += 1 + let opts.height -= 2 + let opts.col += 2 + let opts.width -= 4 + call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts) +endfunction + augroup terminal autocmd WinNew,BufNew,BufNewFile,BufEnter,WinEnter * call Termstart() augroup END diff --git a/.config/picom/config b/.config/picom/config @@ -22,6 +22,7 @@ opacity-rule = [ "100:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_FULLSCREEN'", "100:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_FULLSCREEN'", "100:_NET_WM_STATE@[5]:32a *= '_NET_WM_STATE_FULLSCREEN'", + "100:class_g ?= 'slop'", "87:class_g ?= 'urxvt' && !focused", "84:class_g ?= 'urxvt' && focused", "87:class_g ?= 'st-256color' && !focused", diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc @@ -53,7 +53,7 @@ super + ctrl + u dmpv general/music/ /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz super + alt + {y,u} - rmpv ~/general/{videos,music}/ 50 + rmpv ~/general/{videos,music}/ 100 super + ctrl + {i,p} hmpv {back,forward} /tmp/mpv-socket @@ -63,3 +63,9 @@ super + alt + {i,p} super + {ctrl,alt} + o hmpv {toggle,quit} /tmp/mpv-socket + +super + {minus,equal} + hvol 3%{-,+} + +super + shift {minus,equal} + hvol 6%{-,+} diff --git a/.config/vimb/config b/.config/vimb/config @@ -19,6 +19,8 @@ nnoremap vh :sh! vimbhist<CR> nnoremap Q :q!<CR> nmap B :sh! mpv "$(xclip -o)"<CR> +nnoremap h <C-o> + shortcut-add sx=https://searx.me/ shortcut-add sch=https://occusearch.de/?q=$0 shortcut-add bit=https://bitchute.com/search?q=$0 diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh @@ -45,11 +45,12 @@ alias cleancache=" sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/sh alias mkconfall=" mkmailpass; mkalias" alias tmux=" tmux -f ~/.config/tmux/config" alias nw=" pkill newsboat; newsboat" -alias nm=" neomutt ; rm /tmp/mail" +alias nm=" neomutt ; rm /tmp/mail ; rm /tmp/blocks/mail ; rm /tmp/dwmblocks/mail ; rm /tmp/blocks/mail ; rm /tmp/dwmblocks/mail" alias maic=" sudo make all install clean" alias homesync=" rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/" alias tmux=" \tmux -f $HOME/.config/tmux/config" alias notes=" vim ~/.local/notes" +alias fwknop=" fwknop --rc-file=$HOME/.config/fwknop/config --save-args-file=/dev/full" alias ~d=" cd ~/general/downloads; ls" alias ~do=" cd ~/general/documents; ls" alias ~iw=" cd ~/images/wallpapers; ls" diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh @@ -1,11 +1,15 @@ 0x0(){ - curl -n -F "file=<-" http://0x0.st < /dev/stdin | tee /dev/stderr | xclip + curl -n -F "file=@/dev/stdin" https://0x0.st < /dev/stdin | tee /dev/stderr | xclip } ix(){ curl -n -F "f:1=<-" http://ix.io < /dev/stdin | tee /dev/stderr | xclip } +yt(){ + cgo "haydenh.null/7/exec/idiot/youtube/gopher.dcgi" +} + me0w(){ echo "gopher://me0w.net/0/pit/$(nc me0w.net 31415 < /dev/stdin)" | tee /dev/stderr |xclip } @@ -47,10 +51,19 @@ diary(){ echo "===private===" > ~/.local/privated echo "#Daily Entry - $wdate" > ~/.local/public.gph - phlog="$HOME/web/alcl/write" + phlog="$HOME/net/alcl/write" mkdir -p $phlog/daily.entries ~/.local/diary vim -O ~/.local/public.gph ~/.local/privated printf '.txt or .gph?'; read ftype < /dev/tty mv ~/.local/public.gph $phlog/daily.entries/entry.of.$date.$ftype mv ~/.local/privated ~/.local/diary/$date } + +sttab(){ + nohup tabbed st -w > /tmp/txid & +} + +newtab(){ + read txid < /tmp/txid + nohup st -w $txid -e cgo haydenh.null > /dev/null & +} diff --git a/.config/zsh/ls.zsh b/.config/zsh/ls.zsh @@ -28,10 +28,12 @@ export LS_COLORS="$(echo 'di=35 :*.heic=95 :*.heif=95 :*.mp3=95;01 -:*.opus=.95;01 -:*.m4a=95;01 +:*.opus=95;01 +:*.ogg=95;01 :*.flac=95;01 :*.wav=95;01 +:*.m4a=95;04 :*.mp4=95;04 :*.mkv=95;04 +:*.ogv=95;04 :*.webm=95;04' | tr -d '\n')" diff --git a/.scripts/bin/display/pexelgrab b/.scripts/bin/display/pexelgrab @@ -1,3 +1,4 @@ +#!/bin/sh # # pexelgrab # Created by Hayden Hamilton diff --git a/.scripts/bin/display/sent-ascii b/.scripts/bin/display/sent-ascii @@ -1 +0,0 @@ -#!/bin/sh diff --git a/.scripts/bin/display/shmenu b/.scripts/bin/display/shmenu @@ -0,0 +1,26 @@ +#!/bin/bash + +[ -z $1 ] && echo "usage: shmenu prompt + +stdin is given to the user to search through +stdout contains the selection +stderr contains the user interface" && exit + +cleanup(){ + echo "$files" | grep "$query" | tail -n 1 + exit +} + +files=$(cat /dev/stdin) + +while true +do + clear > /dev/stderr + query=".*$(echo "$prev" | sed 's/./&\.\*/g')" + echo "$files" | grep "$query" > /dev/stderr + printf "$1> $prev" > /dev/stderr + read -rsn1 key < /dev/tty + [ "$key" = "$(echo -e '')" ] && cleanup "$2" + newkey=$(echo "$key" | grep '[[:print:]]') + [ "$newkey" = "" ] && prev=$(echo "$prev" | sed 's/.$//') || prev="${prev}${newkey}" +done diff --git a/.scripts/bin/display/wallblur b/.scripts/bin/display/wallblur @@ -5,8 +5,7 @@ # # haydenvh.com -${XDG_CACHE_HOME:=$HOME/.cache} -cache=$XDG_CACHE_HOME +cache=$HOME/general/cache/ backend="xwallpaper" args=$(echo "$@" | sed 's/--force//g;s/force//g') @@ -21,7 +20,7 @@ donorm(){ } files="$files $1" } -input=$(cat $cache/rfeh/prev) +input=$(cat $XDG_CACHE_HOME/rfeh/prev) count=0 files="" mkdir -p $cache/wallblur/ @@ -31,7 +30,7 @@ do count=$(($count+1)) [ "$(echo "$@" | grep "force")" = "" ] && { [ -f $cache/wallblur/$(basename $file) ] && { - files="$cache/wallblur/$(basename $file) $files" + files="$files $cache/wallblur/$(basename $file)" } || { donorm "$cache/wallblur/$(basename $file)" } diff --git a/.scripts/bin/display/wbcachemake b/.scripts/bin/display/wbcachemake @@ -6,8 +6,7 @@ # haydenvh.com # Copyright (c) 2020 Hayden Hamilton -${XDG_CACHE_HOME:=$HOME/.cache} -cache="$XDG_CACHE_HOME" +cache=$HOME/general/cache/ donorm(){ [ "$args" = "" ] && { @@ -22,7 +21,7 @@ donorm(){ mkdir -p $cache/wallblur rm $cache/wallblur/* -files=$(find images/wallpapers -type f -name "*.png") +files=$(find images/wallpapers/ -type f -name "*.png") half=$(echo "$files" | wc -l) half=$(($half/2)) top=$(echo "$files" | head -n $half) diff --git a/.scripts/bin/dmenu/dfm b/.scripts/bin/dmenu/dfm @@ -9,7 +9,7 @@ if [ "$(echo $1 | awk '/help/ {print}')" != "" ] then - echo "dfm [fm for standard mode/name of program for file-selection] [/path/to/dir - enter at start] + echo "dfm <fm for standard mode/name of program for file-selection> </path/to/dir - enter at start> $(tput bold)CONFIG:$(tput sgr0) DFM_CONF_DIR=[insert /path/to/confdir] <-- Default: $HOME/.config/dfm DFM_DOT=[0/1 to show dotfiles] <-- Default: 1 @@ -25,6 +25,7 @@ When in standard file management mode, you will now get the option to automatica Written by Hayden Hamilton <haydenvh.com>" exit 0 fi + forn1="$1" lsforce="$3" if [ "$1" = "" ] diff --git a/.scripts/bin/dmenu/dimg b/.scripts/bin/dmenu/dimg @@ -10,12 +10,7 @@ ${XDG_CACHE_HOME:=$HOME/.cache} cache=$XDG_CACHE_HOME printf '' > /tmp/dimg -[ ! -z $1 ] && dir="$1" || dir="$HOME/general/images/wallpapers" - -case $(printf 'wallpaper\nview' | dmenu -i -p 'Select option:') in - view) sxiv $(find $dir -type f | shuf | dmenu -i -p "Select image:") ;; - wallpaper) setwall ;; -esac +[ ! -z $1 ] && dir="$1" || dir="$HOME/general/images/wallpapers/" setwall(){ monitors=$(xrandr --listmonitors | awk '/Monitors/{print $2}') @@ -27,3 +22,8 @@ setwall(){ echo "$files" | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > $cache/rfeh/prev fehffile $cache/rfeh/prev } + +case $(printf 'wallpaper\nview' | dmenu -i -p 'Select option:') in + view) sxiv $(find $dir -type f | shuf | dmenu -i -p "Select image:") ;; + wallpaper) setwall ;; +esac diff --git a/.scripts/bin/genman/hvol b/.scripts/bin/genman/hvol @@ -4,8 +4,9 @@ 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 + +$HOME/.scripts/dwmblocks/vol > /tmp/blocks/vol diff --git a/.scripts/bin/misc/alcl b/.scripts/bin/misc/alcl @@ -0,0 +1,34 @@ +#!/bin/sh + +PHLOG="$HOME/net/alcl/write" +RSSBNB="$HOME/net/phlog.rssbnb" + +_list(){ + for f in $(find $PHLOG/$1 -type f -name "*.gph" -o -name "*.txt" -not -name "links.gph") + do + echo "$(stat -c '%y' $f)##$f" + done | sort -r | sed "s/^.*##//;s~$PHLOG/$1[/]*~~g" | + while IFS= read -r line + do + echo "$line $(grep '^#[[:space:]A-Z0-9a-z]' < $PHLOG/$1/$line)" + done | head -n "$(($(tput lines)-2))" +} + +_new(){ + [ -d "$PHLOG/$1" ] && dir="$PHLOG/$1" && shift || dir="$PHLOG" + name="$@" + filename=$(echo "$@" | tr '[[:space:]]' '.' | tr -dc '[A-Za-z0-9-.+=%#!]') + echo "#$name" >> $dir/$filename + $EDITOR $dir/$filename +} + +case "$1" in + ls) _list "$2" ;; + new) _new "$2" ;; + *) echo 'usage: alcl <subcommand> + +SUBCOMMANDS: + ls + new' ;; +esac + diff --git a/.scripts/bin/misc/dotadd b/.scripts/bin/misc/dotadd @@ -32,6 +32,7 @@ git add .config/neomutt/neomuttrc git add .config/neomutt/colours git add .config/neomutt/sidebar git add .config/neomutt/mailcap +git add .config/git/ git add .config/nvim/ git rm --cache .config/nvim/.netrwhist git rm --cache .config/zsh/.zcompdump diff --git a/.scripts/bin/misc/hmpv b/.scripts/bin/misc/hmpv @@ -66,6 +66,10 @@ gettime() { } quit() { echo '{ "command": ["quit"] }' | socat - $socket > /dev/null + rm /tmp/blocks/mpv + rm /tmp/dwmblocks/mpv + rm /tmp/blocks/mpv + rm /tmp/dwmblocks/mpv } if [ "$action" = "toggle" ] @@ -89,3 +93,4 @@ then else seek fi +$HOME/.scripts/dwmblocks/mpv > /tmp/blocks/mpv diff --git a/.scripts/bin/misc/rmpv b/.scripts/bin/misc/rmpv @@ -9,11 +9,11 @@ dir=$1 count="$2" filetypes="mp3 opus mkv mp4 flac m4a webm wav" -getfiles() { - files+=$(find $dir | awk "/$1/ {print}") +getfiles(){ + files+=$(find $dir | awk "/$1/"' {print}') } -allfiles() { +allfiles(){ for filetype in $filetypes do getfiles $filetype diff --git a/.scripts/bin/misc/srssbnbc b/.scripts/bin/misc/srssbnbc @@ -6,16 +6,6 @@ # haydenvh.com # Copyright (c) 2020 Hayden Hamilton # -# 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 @@ -23,6 +13,11 @@ # 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. +# +# This work is free. You can redistribute it and/or modify it under the +# terms of the Do What The Fuck You Want To Public License, Version 2, +# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. + cache=${XDG_CACHE_HOME:=$HOME/.cache} config=${XDG_CONFIG_HOME:=$HOME/.config} @@ -62,8 +57,9 @@ parsefile(){ $1 != "main" { count++ - if (system("test -f " cachedir"/"count".txt") != "0") - printf("Read : unread\nTitle : %s\nLink : %s\n\n%s\n", $2, $3, $4) > cachedir"/"count".txt" + vcount=sprintf("%06d", count) + if (system("test -f " cachedir"/"vcount".txt") != "0") + printf("Read : unread\nTitle : %s\nLink : %s\n\n%s\n", $2, $3, $4) > cachedir"/"vcount".txt" } ' @@ -106,14 +102,21 @@ _ui(){ grep 'Read[[:space:]]*:[[:space:]]*unread' < $file >/dev/null && echo "$num $name $(tput bold)*UNREAD*$(tput sgr0)" || echo "$num $name" done > $temp tail -n 20 < $temp | cat main.txt /dev/stdin | sed 's/&#58;/:/g;s/&#44;/,/g' - printf "\n\nSelect an item, 'list' to veiw all items, or 'q' to go back: " + printf "\n\nSelect an item, 'list' - list all entries, 'q' - go back, 'a' - mark all as read: " read choice < /dev/tty [ "$choice" = "list" ] && less $temp && printf "\n\nSelect an item: " && read choice < /dev/tty [ "$choice" = "q" ] && break + [ "$choice" = "a" ] && { + for f in $(find -type f); do out=$(sed '/^Read[[:space:]]*:[[:space:]]*unread/d' < $f); echo "$out" > $f; done + continue + } fchoice=$(echo "$files" | grep "^[[:space:]]*$choice[[:space:]]*" | awk '{$1="";print $0}' | sed 's/[[:space:]]//g') - tr '\f\t' '\t\n' < $fchoice | sed 's/&#58;/:/g;s/&#44;/,/g' | less - out=$(sed '/^Read[[:space:]]*:[[:space:]]*unread/d' < $fchoice) - echo "$out" > $fchoice + [ -f $fchoice ] && { + tr '\f\t' '\t\n' < $fchoice | sed 's/&#58;/:/g;s/&#44;/,/g' | less + out=$(sed '/^Read[[:space:]]*:[[:space:]]*unread/d' < $fchoice) + echo "$out" > $fchoice + } || echo 'entry does not exist' + rm $temp done done } diff --git a/.scripts/bin/misc/sxhkdrestart b/.scripts/bin/misc/sxhkdrestart @@ -0,0 +1,3 @@ +#!/bin/sh + +kill -s SIGUSR1 $(pgrep sxhkd) diff --git a/.scripts/dwmblocks/bat b/.scripts/dwmblocks/bat @@ -1,36 +1,28 @@ #!/bin/bash # -# i3blocks/bat +# dwmblocks/bat # Created by Hayden Hamilton # # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. - -setunfull(){ - [ "$full" != "y" ] && unfull="y" -} - -unset unfull +total=0 +charge=0 for b in $(find /sys/class/power_supply -name "BAT*") do - read charge < $b/capacity - read stat < $b/status - - case "$stat" in - Charging) stat="^c#00ff00^+" && setunfull;; - Discharging) stat="^c#aa5555^-" && setunfull ;; - Full) stat="^c#00ff00^^r0,3,10,9^^f2^^c#00ff00^!^c#00ff00^^f8^" ; charge="" ; full="y" ;; - *) stat="^c#aaaaaa^" ;; - esac - - - [ "$charge" = "100" ] || [ "$charge" = "99" ] && stat="^c#00ff00^^r0,3,10,9^^f2^^c#00ff00^!^c#00ff00^^f2^" && charge="" || setunfull - [ $charge -le 10 ] && stat="^c#ff0000^!!!" - - printf "%s:%s%s" "^c#aaaaaa^$(echo "$b" | grep -o "[0-9]*$")" "$stat" "$charge" - unset full -done > /tmp/bat -[ "$unfull" = "y" ] && read output < /tmp/bat && printf "[B $output]" + total=$(($total+100)) + read cap < $b/capacity + charge=$(($charge+$cap)) + grep -i 'charg' < $b/status >/dev/null && charging='y' + grep -i 'discharg' < $b/status >/dev/null && discharging='y' +done +num=$(echo "scale=2; ($charge/$total)*21" | bc | sed 's~\..*$~~') +colour="#aa6600" +[ "$charging" = "y" ] && colour="#00aa00" +[ $num -ge 19 ] && colour="#00aa00" +[ "$discharging" = "y" ] && colour="#aa0000" +echo "^r0,5,2,4^^r2,2,22,10^^c#000000^^r3,3,20,8^^c$colour^^r$((23-$num)),3,$num,8^^d^^f24^" > /tmp/bat +read output < /tmp/bat +printf "[B $output]" echo echo echo \#C625C8 diff --git a/.scripts/dwmblocks/cal b/.scripts/dwmblocks/cal @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/cal +# dwmblocks/cal # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/cpu b/.scripts/dwmblocks/cpu @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/cpu +# dwmblocks/cpu # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/disk b/.scripts/dwmblocks/disk @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/disk +# dwmblocks/disk # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/disk2 b/.scripts/dwmblocks/disk2 @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/disk2 +# dwmblocks/disk2 # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/dwmbar b/.scripts/dwmblocks/dwmbar @@ -6,13 +6,13 @@ block(){ } block host +block vol fetchmail & while true do block bat block cpu block mem - block vol sleep 3 done & @@ -35,15 +35,14 @@ do sleep 20 done & -cd /tmp/blocks +mkdir /tmp/dwmblocks +cd /tmp/dwmblocks while true do sleep 0.1 - xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat mpv bat cpu disk disk2 mem net news mail rem vol time time2 host | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#ffaaaa\^/;2~2s/^/\^c#aaaaff\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ') " + for f in /tmp/blocks/* + do + grep '[[:alnum:]]' < $f >/dev/null && cp $f /tmp/dwmblocks + done + xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat mpv bat cpu disk disk2 mem net news mail rem vol time time2 host | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#ffaaaa\^/;2~2s/^/\^c#aaaaff\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ') " done & - -while true -do - sleep 200 - nohup cvrestart & -done diff --git a/.scripts/dwmblocks/host b/.scripts/dwmblocks/host @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/host +# dwmblocks/host # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/mem b/.scripts/dwmblocks/mem @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/mem +# dwmblocks/mem # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/mpv b/.scripts/dwmblocks/mpv @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/mpv +# dwmblocks/mpv # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/net b/.scripts/dwmblocks/net @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/net +# dwmblocks/net # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/news b/.scripts/dwmblocks/news @@ -1,14 +1,15 @@ #!/bin/bash # -# i3blocks/news +# dwmblocks/news # Created by Hayden Hamilton # # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -newsboat -x reload 2>/dev/null -unread=$(newsboat -x print-unread | sed 's/ unread articles//g') -[ "$unread" = "0" ] || [ "$unread" = "" ] && exit 1 -echo "[NWS $unread]" -echo -echo \#498364 +newsboat -x reload 2>/dev/null && { + unread=$(newsboat -x print-unread | sed 's/ unread articles//g') + [ "$unread" = "0" ] || [ "$unread" = "" ] && exit 1 + echo "[NWS $unread]" + echo + echo \#498364 +} diff --git a/.scripts/dwmblocks/time b/.scripts/dwmblocks/time @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/time +# dwmblocks/time # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/time2 b/.scripts/dwmblocks/time2 @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/time2 +# dwmblocks/time2 # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/title b/.scripts/dwmblocks/title @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/title +# dwmblocks/title # Created by Hayden Hamilton # # haydenvh.com diff --git a/.scripts/dwmblocks/vol b/.scripts/dwmblocks/vol @@ -1,6 +1,6 @@ #!/bin/bash # -# i3blocks/vol +# dwmblocks/vol # Created by Hayden Hamilton # # haydenvh.com diff --git a/.zprofile b/.zprofile @@ -13,6 +13,7 @@ export SCRIPTS="$HOME/.scripts/bin" scripts=$(ls -d $SCRIPTS/*/ | tr '\n' ':') export PATH="$PATH:$scripts" export EDITOR="nvim" +export PAGER="less" export TERMINAL="st" export BROWSER="vimb" export work="$HOME/work"