dotfiles

<-- duh.
git clone https://hhvn.uk/dotfiles
git clone git://hhvn.uk/dotfiles
Log | Files | Refs | Submodules | LICENSE

commit 9ca4c54b86cacc24893f9ddbf930ce54b9363115
parent 47e051301bc6be594590dc90dff71582dfab7239
Author: hhvn <dev@hhvn.uk>
Date:   Fri, 22 Mar 2024 19:09:28 +0000

Rename .bin to cmd

Diffstat:
D.bin/crypto | 2--
D.bin/dpass | 72------------------------------------------------------------------------
D.bin/dwmbar/Makefile | 17-----------------
D.bin/dwmbar/dwmbar | 46----------------------------------------------
D.bin/dwmbar/restart | 4----
D.bin/net/addwpa | 62--------------------------------------------------------------
D.bin/openbsd-compat/sha512sum | 2--
D.bin/wallp | 68--------------------------------------------------------------------
A.config/bspwm/bspd | 21+++++++++++++++++++++
A.config/bspwm/bspwmrc | 10++++++++++
A.config/bspwm/conf | 40++++++++++++++++++++++++++++++++++++++++
A.config/bspwm/keys | 6++++++
M.xinitrc | 32++++++++++++++++++++++----------
R.bin/addrbook -> cmd/addrbook | 0
R.bin/asplit -> cmd/asplit | 0
R.bin/backronym -> cmd/backronym | 0
Acmd/bspwm/assign-desktops | 2++
Acmd/bspwm/configure-monitors | 2++
Acmd/bspwm/main | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.bin/colotable -> cmd/colotable | 0
R.bin/convf -> cmd/convf | 0
Acmd/crypto | 2++
R.bin/cst2secs -> cmd/cst2secs | 0
R.bin/currency -> cmd/currency | 0
R.bin/deexif -> cmd/deexif | 0
R.bin/dgrep -> cmd/dgrep | 0
R.bin/diary -> cmd/diary | 0
R.bin/dmarc -> cmd/dmarc | 0
R.bin/dnsbl -> cmd/dnsbl | 0
Acmd/dpass | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.bin/dupfind -> cmd/dupfind | 0
R.bin/encsign -> cmd/encsign | 0
R.bin/fetchmail -> cmd/fetchmail | 0
R.bin/gdiffpager -> cmd/gdiffpager | 0
R.bin/geo -> cmd/geo | 0
R.bin/getascii -> cmd/getascii | 0
R.bin/gophcheck -> cmd/gophcheck | 0
R.bin/gopherdl -> cmd/gopherdl | 0
R.bin/gpgimport -> cmd/gpgimport | 0
R.bin/hvol -> cmd/hvol | 0
R.bin/imgclean -> cmd/imgclean | 0
R.bin/infowall -> cmd/infowall | 0
R.bin/lsswp -> cmd/lsswp | 0
R.bin/mailselect -> cmd/mailselect | 0
R.bin/manualpatch -> cmd/manualpatch | 0
R.bin/markwatched -> cmd/markwatched | 0
R.bin/mkmaildir -> cmd/mkmaildir | 0
R.bin/mvmailbackup -> cmd/mvmailbackup | 0
R.bin/net/autoconf -> cmd/net/autoconf | 0
R.bin/net/autoconf-bond -> cmd/net/autoconf-bond | 0
R.bin/net/bandcamp/bandcampsrch -> cmd/net/bandcamp/bandcampsrch | 0
R.bin/net/bandcamp/dl -> cmd/net/bandcamp/dl | 0
R.bin/net/download -> cmd/net/download | 0
R.bin/net/rhosts -> cmd/net/rhosts | 0
R.bin/net/scan -> cmd/net/scan | 0
R.bin/notify -> cmd/notify | 0
R.bin/notify-send -> cmd/notify-send | 0
R.bin/openbsd-compat/aliases -> cmd/openbsd-compat/aliases | 0
R.bin/openbsd-compat/seq -> cmd/openbsd-compat/seq | 0
R.bin/openbsd-compat/sha256sum -> cmd/openbsd-compat/sha256sum | 0
Acmd/openbsd-compat/sha512sum | 2++
R.bin/openbsd-compat/shuf -> cmd/openbsd-compat/shuf | 0
R.bin/openbsd-compat/tac -> cmd/openbsd-compat/tac | 0
R.bin/passgpg -> cmd/passgpg | 0
R.bin/passgpg2 -> cmd/passgpg2 | 0
R.bin/paste/hhgph -> cmd/paste/hhgph | 0
R.bin/pexelgrab -> cmd/pexelgrab | 0
R.bin/plumb -> cmd/plumb | 0
R.bin/pman -> cmd/pman | 0
R.bin/qmv -> cmd/qmv | 0
R.bin/queuevid -> cmd/queuevid | 0
R.bin/quik -> cmd/quik | 0
R.bin/rfclookup -> cmd/rfclookup | 0
R.bin/rm/patch -> cmd/rm/patch | 0
R.bin/rm/sshsockets -> cmd/rm/sshsockets | 0
R.bin/scrape/atom -> cmd/scrape/atom | 0
R.bin/scrape/debug -> cmd/scrape/debug | 0
R.bin/scrape/youtube -> cmd/scrape/youtube | 0
R.bin/screenoff -> cmd/screenoff | 0
R.bin/secs2cst -> cmd/secs2cst | 0
R.bin/service -> cmd/service | 0
R.bin/sfeed_addfeed -> cmd/sfeed_addfeed | 0
R.bin/slock_mod -> cmd/slock_mod | 0
R.bin/slopvid -> cmd/slopvid | 0
R.bin/somafm -> cmd/somafm | 0
R.bin/srxsrch -> cmd/srxsrch | 0
R.bin/sshtar -> cmd/sshtar | 0
R.bin/sttab -> cmd/sttab | 0
R.bin/sudo -> cmd/sudo | 0
R.bin/tag/clear -> cmd/tag/clear | 0
R.bin/tag/clearalbum_artist -> cmd/tag/clearalbum_artist | 0
R.bin/tag/clearsort -> cmd/tag/clearsort | 0
R.bin/tag/cover/set -> cmd/tag/cover/set | 0
R.bin/tag/cover/view -> cmd/tag/cover/view | 0
R.bin/tag/dirformat -> cmd/tag/dirformat | 0
R.bin/tag/dirformatmv -> cmd/tag/dirformatmv | 0
R.bin/tag/fileformat -> cmd/tag/fileformat | 0
R.bin/tag/fileformatmv -> cmd/tag/fileformatmv | 0
R.bin/tag/get -> cmd/tag/get | 0
R.bin/tag/interactive -> cmd/tag/interactive | 0
R.bin/tag/set -> cmd/tag/set | 0
R.bin/textdisplay -> cmd/textdisplay | 0
R.bin/thesaurus -> cmd/thesaurus | 0
R.bin/tlds -> cmd/tlds | 0
R.bin/tmuxkillshell -> cmd/tmuxkillshell | 0
R.bin/topen -> cmd/topen | 0
R.bin/torlist -> cmd/torlist | 0
R.bin/torrents -> cmd/torrents | 0
R.bin/tsclean -> cmd/tsclean | 0
R.bin/uniqfind -> cmd/uniqfind | 0
R.bin/uptimemon -> cmd/uptimemon | 0
R.bin/urlencode -> cmd/urlencode | 0
R.bin/urlhand -> cmd/urlhand | 0
R.bin/urlhand2 -> cmd/urlhand2 | 0
R.bin/wallblur -> cmd/wallblur | 0
Acmd/wallp | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.bin/wbcachemake -> cmd/wbcachemake | 0
R.bin/wordle -> cmd/wordle | 0
R.bin/yt/embedify -> cmd/yt/embedify | 0
R.bin/yt/feed -> cmd/yt/feed | 0
R.bin/yt/meta -> cmd/yt/meta | 0
R.bin/yt/search -> cmd/yt/search | 0
R.bin/yt/sorted -> cmd/yt/sorted | 0
123 files changed, 404 insertions(+), 283 deletions(-)

diff --git a/.bin/crypto b/.bin/crypto @@ -1 +0,0 @@ -currency -\ No newline at end of file diff --git a/.bin/dpass b/.bin/dpass @@ -1,72 +0,0 @@ -#!/bin/rc -# Copyright (c) 2022 hhvn <dev@hhvn.uk> - -if (~ $#PASS 0) { - PASS = $home/.local/pass -} -if (!test -f $PASS) { - touch $PASS -} - -dec = `''{dmenu -P -p 'Master password:' </dev/null | gpg -qd --passphrase-fd 0 $PASS} - -if (!~ $#* 0) { - opt = $1 - fromarg = 1 -} else { - opt = `$nl{printf '%s' $dec | awk -F: 'BEGIN {printf("GENERATE\nAPPEND\nEDIT\n")}; {print $1}' | dmenu -l 20 -i} -} - -switch ($opt) { -case GENERATE - newpass = `''{tr -dc 'a-zA-Z0-9~!@#$%^&*_+=-' < /dev/urandom | head -c 35} - newname = `$nl{dmenu -p 'Name:' </dev/null} - if (~ $newname '') { - herbe 'dpass exiting... no pass given' - exit 1 - } - dec = `''{printf '%s%s: %s\n' $dec $newname $newpass} - encfile = /tmp/$pid.plain - touch $encfile - chmod 0700 $encfile - printf '%s' $dec > $encfile - gpg --armor -e --default-recipient-self < $encfile > $PASS - shred -u $encfile - printf '%s' $newpass | xclip - @{ sleep 25; xclip </dev/null } & -case APPEND - newname = `$nl{dmenu -p 'Name:' </dev/null} - newpass = `$nl{dmenu -P -p 'Password:' </dev/null} - if (~ $newname '') { - herbe 'dpass exiting... no pass given' - exit 1 - } - dec = `''{printf '%s%s: %s\n' $dec $newname $newpass} - encfile = /tmp/$pid.plain - touch $encfile - chmod 0700 $encfile - printf '%s' $dec > $encfile - gpg --armor -e --default-recipient-self < $encfile > $PASS - shred -u $encfile - printf '%s' $newpass | xclip - @{ sleep 25; xclip </dev/null } & -case EDIT - encfile = /tmp/$pid.plain - touch $encfile - chmod 0700 $encfile - printf '%s' $dec > $encfile - if (~ $EDITOR ()) { EDITOR=vim } - $EDITOR $encfile - gpg --armor -e --default-recipient-self < $encfile > $PASS - shred -u $encfile - printf '%s' $newpass | xclip - @{ sleep 25; xclip </dev/null } & -case * - out = `$nl{printf '%s' $dec | awk -F: -v 'opt=' ^ $opt '$1 == opt { print $2 }' | sed 's/^.//'} - if (~ $fromarg 1) { - echo $out - } else { - printf '%s' $out | xclip - @{ sleep 25; xclip </dev/null } & - } -} diff --git a/.bin/dwmbar/Makefile b/.bin/dwmbar/Makefile @@ -1,17 +0,0 @@ -install: build - install -m0755 blocks/bat bat - install -m0755 blocks/cpu cpu - install -m0755 blocks/mem mem - install -m0755 blocks/vol vol - install -m0755 blocks/date date - install -m0755 blocks/time time - -build: get - [ -d blocks ] && { cd blocks; make; } || false - -get: - [ ! -d blocks ] && \ - { git clone git://hhvn.uk/s2dblocks blocks || exit 1; } || \ - { cd blocks; git pull; true; } - -.PHONY: install build get diff --git a/.bin/dwmbar/dwmbar b/.bin/dwmbar/dwmbar @@ -1,46 +0,0 @@ -#!/bin/rc - -cd `{dirname $0} - -mkdir -p /tmp/blocks -cd /tmp/blocks - -fn block { - val = `$nl{dwmbar/$1} { - if (~ $val () || ~ $val '') { - rm /tmp/blocks/$1 - } else { - printf '%s' $val > /tmp/blocks/$1 - } - } & -} - -fn sigexit { - for (p in $apids) { - kill $p - } -} - -block vol -while (true) { - block bat - block cpu - block mem - sleep 3 -} & - -while (true) { - block time - sleep 1 -} & - -while (true) { - block date - sleep 900 -} & - -printf ' ' > sep -while (true) { - sleep 0.1 - xsetroot -name ``(''){cat bat sep cpu sep mem sep date sep time sep >[2]/dev/null | tr -d '\n'} -} diff --git a/.bin/dwmbar/restart b/.bin/dwmbar/restart @@ -1,4 +0,0 @@ -#!/bin/rc - -pkill dwmbar -dwmbar/dwmbar & >/dev/null >[2=1] diff --git a/.bin/net/addwpa b/.bin/net/addwpa @@ -1,62 +0,0 @@ -#!/bin/rc - -cfile = /etc/wpa_supplicant/wpa_supplicant.conf -efile = /tmp/$pid.errors - -fn sigexit { - if (!~ $havex11 1) { - stty echo - } - if (test -f $efile) { - rm -f $efile - } -} - -if (!~ $DISPLAY ()) { - havex11 = 1 -} else { - havex11 = 0 -} - -if (!~ `{id -u} 0) { - if (~ $havex11 1) { - echo Accept | dmenu -p 'Give me root, not this stupid ' ^ `{whoami} ^ ' user!' >/dev/null - } else { - printf 'Give me root, not this stupid %s user!\n' `{whoami} >[1=2] - } - exit 1 -} - -echo Scanning for SSIDs... -networks = `{net/scan} -if (~ $havex11 1) { - choices = `{echo $networks | tr ' ' '\n' | dmenu -i -p 'SSID:'} -} else { - echo $^networks - printf 'SSID: ' - choices = `{head -n 1} -} - -for (ssid in $choices) { - if (~ $havex11 1) { - pass = `$nl{dmenu -i -p $ssid ^ ' password:' </dev/null} - } else { - stty -echo - printf '%s password: ' $ssid - pass = `$nl{head -n 1} - printf '\n' - stty echo - } - conf = `''{wpa_passphrase $ssid $pass >[2]$efile} - if (!~ $bqstatus 0) { - if (~ $havex11 1) { - echo Accept | dmenu -p `''{cat $efile} >/dev/null - } else { - cat $efile >[1=2] - } - exit 1 - } - printf '%s' $conf | grep -v '#psk' >[1=2] - echo Writing to $cfile - printf '%s' $conf >> $cfile -} diff --git a/.bin/openbsd-compat/sha512sum b/.bin/openbsd-compat/sha512sum @@ -1 +0,0 @@ -sha256sum -\ No newline at end of file diff --git a/.bin/wallp b/.bin/wallp @@ -1,68 +0,0 @@ -#!/bin/rc -# usage: wallp [-s] [-n|-r] [dir] [monitors] -# randomly select wallpaper for each monitor and apply -# -S select monitors via dmenu -# -s select subdirectory via dmenu -# -n only select new wallpaper for monitors without one -# -r don't select new wallpapers, restore from cache -# usage: wallp [-l] -# list monitors - -fn checkempty { - if ($1 ()) - exit -} - -_dir = $home/.local/wall -mkdir -p $_dir - -while (~ $1 -*) { - flags = ($flags $1) - shift -} - -if (!~ $1 ()) { - search = $1 - shift -} - -if (~ $flags -s) { - search = `$nl{find $search -type d | dmenu -i} - checkempty $search -} - -if (~ $flags -S) { - monitors = `$nl{xrandr --listactivemonitors | awk '$4 {print $4}' | dmenu -i} - checkempty $monitors -} else if (~ $1 ()) { - monitors = `$nl{xrandr --listactivemonitors | awk '$4 {print $4}'} -} else { - monitors = $* -} - -if (~ $flags -l) { - exec echo $^monitors -} - -if (~ $flags -n) { - for (m in $monitors) { - if (!test -f $_dir/$m) { - pop = ($pop $m) - } - } -} else { - pop = $monitors -} - -if (!~ $flags -r) { - wallpapers = `$nl{find $search -type f | shuf -n $#pop} - for (i in `{seq $#pop}) { - rm -f $_dir/$pop($i) - ln -s `$nl{realpath $wallpapers($i)} $_dir/$pop($i) - } -} - -for (m in $monitors) { - args = ($args --output $m --zoom $_dir/$m) -} -xwallpaper $args diff --git a/.config/bspwm/bspd b/.config/bspwm/bspd @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +import os + + +while True: + line = sys.stdin.readline() + if line == '': + sys.exit() + if line[0] != 'W': + tokens = line.rstrip('\n').split(' ') + path = os.getenv("PATH").split(':') + + for pdir in path: + script = "%s/bspwm/handler/%s" % (pdir, tokens[0]) + if os.access(script, os.X_OK): + tokens[0] = script + if (os.fork() == 0): + os.execv(script, tokens) + break diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc @@ -0,0 +1,10 @@ +#!/bin/rc + +. $home/.config/bspwm/conf + +bspwm/configure-monitors +bspc dekstop Desktop -r + +c_global_settings + +bspc subscribe all | $home/.config/bspwm/bspd diff --git a/.config/bspwm/conf b/.config/bspwm/conf @@ -0,0 +1,40 @@ +# vim: filetype=rcshell : + +fn set { bspc config $* } + +fn c_global_settings { + set split_ratio 0.5 + + set borderless_monacle true + set gapless_monacle true +} + +# Monitors & desktops {{{ +c_monpriority = (HDMI2 HDMI1 eDP1) + +c_desktops = ( + 'HDMI2 1 2 3 4' + 'HDMI1 5 6 7 8' + 'eDP1 9 10' +) +#}}} + + +# Colours and aesthetics {{{ +c_bg = '#050a10' +c_sel = '#1b364b' +c_urg = '#90222b' + +fn c_norm_border { + set $* normal_border_color $c_bg + set $* active_border_color $c_bg + set $* focused_border_color $c_sel +} + +fn c_urgent_border { + set $* normal_border_color $c_urgent + set $* active_border_color $c_urgent + set $* focused_border_color $c_sel +} + +# }}} diff --git a/.config/bspwm/keys b/.config/bspwm/keys @@ -0,0 +1,6 @@ +# Copyright (c) 2023 hhvn <dev@hhvn.uk> +# ISC license +# +# See also: git://hhvn.uk/sxhkd-rc +# +# vim: filetype=sxhkd : diff --git a/.xinitrc b/.xinitrc @@ -1,23 +1,35 @@ #!/bin/rc host = `{hostname} +wm = `{printf 'dwm\nbspwm\n' | dmenu -i} + +$host^/displays xrdb $home/.local/xres & setxkbmap haydenh & -dwmbar/dwmbar & $host^/keyboard & -$host^/mount & -xset r rate 200 40 & xmodmap -e 'keysym Control_R = Multi_key' & -barriers -c $home/.config/barrierc --disable-crypto --no-tray --name port.hhvn.uk & -sxhkd & st & -$host^/displays # displays must be set up before wallp is run -wallp -r & +switch ($wm) { +case dwm + dwmbar/dwmbar & + sxhkd & + + while (dwm > .dwm-log) { + true + } -while (dwm) { - true + pkill dwmbar +case bspwm + sxhkd $home/.config/bspwm/keys & + bspwm > .bspwm-log +case * + if (command -v $wm >/dev/null) { + $wm + } else { + echo 'No such window manager or program: ' ^ $wm + } } -pkill dwmbar + diff --git a/.bin/addrbook b/cmd/addrbook diff --git a/.bin/asplit b/cmd/asplit diff --git a/.bin/backronym b/cmd/backronym diff --git a/cmd/bspwm/assign-desktops b/cmd/bspwm/assign-desktops @@ -0,0 +1 @@ +main +\ No newline at end of file diff --git a/cmd/bspwm/configure-monitors b/cmd/bspwm/configure-monitors @@ -0,0 +1 @@ +main +\ No newline at end of file diff --git a/cmd/bspwm/main b/cmd/bspwm/main @@ -0,0 +1,100 @@ +#!/bin/rc + +. $home/.config/bspwm/conf + +# variables {{{ +monitors = `{bspc query -M --names} +desktops = `{bspc query -D --names} +report = `:$nl{bspc wm -g | sed 's/^W//'} +# }}} + +# utility functions {{{ +fn cmd { + cmds = ($cmds $*) +} + +fn die { + printf 'error: %s\n' $1 >[1=2] + exit 1 +} + +fn lshift { + _lshift=$* *=$$1 { + shift $_lshift(2) + $_lshift(1)=$* + } +} +# }}} + +cmd configure_monitors #{{{ +fn configure_monitors { + dunused = () + mmain = () + + for (m in $c_monpriority) { + if (~ $m $monitors) { + mmain = $m + break + } + } + + if (~ $mmain ()) + mmain = $monitors(1) + + for (d in $c_desktops) { + d = `' '$nl{echo $d} + m = $d(1) + lshift d + + if (! ~ $m $monitors) { + dunused = ($dunused $d) + } else if (~ $m $mmain) { + dmain = $d + } else { + assign_desktops $m $d + } + } + + dmain = `$nl{echo $dunused $dmain | tr ' ' '\n' | sort -n} + + assign_desktops $mmain $dmain + + # Delete the automatically created desktops + for (m in $monitors) { + bspc desktop Desktop -r + } >[2]/dev/null +} +# }}} +cmd assign_desktops #{{{ +fn assign_desktops { + if (~ $2 ()) + die 'usage: <monitor> desktops' + + m = $1 + shift + d = $* + + for (d in $d) { + if (~ $d $desktops) { + bspc desktop $d -m $m + } else { + bspc monitor $m -a $d + } + } +} +#}}} +cmd main #{{{ +fn main { + cd `$nl{dirname $0} + for (c in $cmds) { + ln -s main `$nl{echo $c | tr '_' '-'} + } +} +# }}} + +cmd = `$nl{basename $0 | tr '-' '_'} +if (~ $cmd $cmds) { + $cmd $* +} else { + echo 'Unrecognized command: ' ^ $cmd +} diff --git a/.bin/colotable b/cmd/colotable diff --git a/.bin/convf b/cmd/convf diff --git a/cmd/crypto b/cmd/crypto @@ -0,0 +1 @@ +currency +\ No newline at end of file diff --git a/.bin/cst2secs b/cmd/cst2secs diff --git a/.bin/currency b/cmd/currency diff --git a/.bin/deexif b/cmd/deexif diff --git a/.bin/dgrep b/cmd/dgrep diff --git a/.bin/diary b/cmd/diary diff --git a/.bin/dmarc b/cmd/dmarc diff --git a/.bin/dnsbl b/cmd/dnsbl diff --git a/cmd/dpass b/cmd/dpass @@ -0,0 +1,128 @@ +#!/bin/rc +# Copyright (c) 2022 hhvn <dev@hhvn.uk> + +if (~ $#PASS 0) { + PASS = $home/.local/pass +} + +if (~ $DISPLAY ()) { + x11 = false +} else { + x11 = true +} + +fn send { + if (~ $x11 true) { + xclip + } else { + cat + printf '\n' + } +} + +fn getpass { + if (! ~ $1 ()) { + if (~ $x11 true) { + p = (-p $1) + shift + } else { + p = $1 + shift + } + } else { + p = () + } + + if (~ $x11 true) { + dmenu $p -P < /dev/null + } else { + printf '%s: ' $p >/dev/stderr + + stty -echo + head -n 1 < /dev/tty + stty echo + } +} + +fn choose { + if (! ~ $1 '-'*) { + if (~ $x11 true) { + p = (-p $1) + shift + } else { + p = (--prompt=$1) + shift + } + } else { + p = () + } + + if (~ $x11 true) { + dmenu -i $p $* + } else { + fzf $p + } +} + +dec = `''{getpass 'Master password' | gpg -qd --passphrase-fd 0 $PASS} + +if (!~ $#* 0) { + opt = $1 + fromarg = 1 +} else { + opt = `$nl{printf '%s' $dec | awk -F: 'BEGIN {printf("GENERATE\nAPPEND\nEDIT\n")}; {print $1}' | choose -l 20} +} + +switch ($opt) { +case GENERATE + newpass = `''{tr -dc 'a-zA-Z0-9~!@#$%^&*_+=-' < /dev/urandom | head -c 35} + newname = `$nl{choose 'Name' </dev/null} + if (~ $newname '') { + herbe 'dpass exiting... no pass given' + exit 1 + } + dec = `''{printf '%s%s: %s\n' $dec $newname $newpass} + encfile = /tmp/$pid.plain + touch $encfile + chmod 0700 $encfile + printf '%s' $dec > $encfile + gpg --armor -e --default-recipient-self < $encfile > $PASS + shred -u $encfile + printf '%s' $newpass | send + @{ sleep 25; send </dev/null } & +case APPEND + newname = `$nl{choose 'Name' </dev/null} + newpass = `$nl{getpass 'Password'} + if (~ $newname '') { + herbe 'dpass exiting... no pass given' + exit 1 + } + dec = `''{printf '%s%s: %s\n' $dec $newname $newpass} + encfile = /tmp/$pid.plain + touch $encfile + chmod 0700 $encfile + printf '%s' $dec > $encfile + gpg --armor -e --default-recipient-self < $encfile > $PASS + shred -u $encfile + printf '%s' $newpass | send + @{ sleep 25; send </dev/null } & +case EDIT + encfile = /tmp/$pid.plain + touch $encfile + chmod 0700 $encfile + printf '%s' $dec > $encfile + if (~ $EDITOR ()) { EDITOR=vim } + $EDITOR $encfile + gpg --armor -e --default-recipient-self < $encfile > $PASS + shred -u $encfile + printf '%s' $newpass | send + @{ sleep 25; send </dev/null } & +case * + out = `$nl{printf '%s' $dec | awk -F: -v 'opt=' ^ $opt '$1 == opt { print $2 }' | sed 's/^.//'} + if (~ $fromarg 1) { + echo $out + } else { + printf '%s' $out | send + @{ sleep 25; send </dev/null } & + } +} diff --git a/.bin/dupfind b/cmd/dupfind diff --git a/.bin/encsign b/cmd/encsign diff --git a/.bin/fetchmail b/cmd/fetchmail diff --git a/.bin/gdiffpager b/cmd/gdiffpager diff --git a/.bin/geo b/cmd/geo diff --git a/.bin/getascii b/cmd/getascii diff --git a/.bin/gophcheck b/cmd/gophcheck diff --git a/.bin/gopherdl b/cmd/gopherdl diff --git a/.bin/gpgimport b/cmd/gpgimport diff --git a/.bin/hvol b/cmd/hvol diff --git a/.bin/imgclean b/cmd/imgclean diff --git a/.bin/infowall b/cmd/infowall diff --git a/.bin/lsswp b/cmd/lsswp diff --git a/.bin/mailselect b/cmd/mailselect diff --git a/.bin/manualpatch b/cmd/manualpatch diff --git a/.bin/markwatched b/cmd/markwatched diff --git a/.bin/mkmaildir b/cmd/mkmaildir diff --git a/.bin/mvmailbackup b/cmd/mvmailbackup diff --git a/.bin/net/autoconf b/cmd/net/autoconf diff --git a/.bin/net/autoconf-bond b/cmd/net/autoconf-bond diff --git a/.bin/net/bandcamp/bandcampsrch b/cmd/net/bandcamp/bandcampsrch diff --git a/.bin/net/bandcamp/dl b/cmd/net/bandcamp/dl diff --git a/.bin/net/download b/cmd/net/download diff --git a/.bin/net/rhosts b/cmd/net/rhosts diff --git a/.bin/net/scan b/cmd/net/scan diff --git a/.bin/notify b/cmd/notify diff --git a/.bin/notify-send b/cmd/notify-send diff --git a/.bin/openbsd-compat/aliases b/cmd/openbsd-compat/aliases diff --git a/.bin/openbsd-compat/seq b/cmd/openbsd-compat/seq diff --git a/.bin/openbsd-compat/sha256sum b/cmd/openbsd-compat/sha256sum diff --git a/cmd/openbsd-compat/sha512sum b/cmd/openbsd-compat/sha512sum @@ -0,0 +1 @@ +sha256sum +\ No newline at end of file diff --git a/.bin/openbsd-compat/shuf b/cmd/openbsd-compat/shuf diff --git a/.bin/openbsd-compat/tac b/cmd/openbsd-compat/tac diff --git a/.bin/passgpg b/cmd/passgpg diff --git a/.bin/passgpg2 b/cmd/passgpg2 diff --git a/.bin/paste/hhgph b/cmd/paste/hhgph diff --git a/.bin/pexelgrab b/cmd/pexelgrab diff --git a/.bin/plumb b/cmd/plumb diff --git a/.bin/pman b/cmd/pman diff --git a/.bin/qmv b/cmd/qmv diff --git a/.bin/queuevid b/cmd/queuevid diff --git a/.bin/quik b/cmd/quik diff --git a/.bin/rfclookup b/cmd/rfclookup diff --git a/.bin/rm/patch b/cmd/rm/patch diff --git a/.bin/rm/sshsockets b/cmd/rm/sshsockets diff --git a/.bin/scrape/atom b/cmd/scrape/atom diff --git a/.bin/scrape/debug b/cmd/scrape/debug diff --git a/.bin/scrape/youtube b/cmd/scrape/youtube diff --git a/.bin/screenoff b/cmd/screenoff diff --git a/.bin/secs2cst b/cmd/secs2cst diff --git a/.bin/service b/cmd/service diff --git a/.bin/sfeed_addfeed b/cmd/sfeed_addfeed diff --git a/.bin/slock_mod b/cmd/slock_mod diff --git a/.bin/slopvid b/cmd/slopvid diff --git a/.bin/somafm b/cmd/somafm diff --git a/.bin/srxsrch b/cmd/srxsrch diff --git a/.bin/sshtar b/cmd/sshtar diff --git a/.bin/sttab b/cmd/sttab diff --git a/.bin/sudo b/cmd/sudo diff --git a/.bin/tag/clear b/cmd/tag/clear diff --git a/.bin/tag/clearalbum_artist b/cmd/tag/clearalbum_artist diff --git a/.bin/tag/clearsort b/cmd/tag/clearsort diff --git a/.bin/tag/cover/set b/cmd/tag/cover/set diff --git a/.bin/tag/cover/view b/cmd/tag/cover/view diff --git a/.bin/tag/dirformat b/cmd/tag/dirformat diff --git a/.bin/tag/dirformatmv b/cmd/tag/dirformatmv diff --git a/.bin/tag/fileformat b/cmd/tag/fileformat diff --git a/.bin/tag/fileformatmv b/cmd/tag/fileformatmv diff --git a/.bin/tag/get b/cmd/tag/get diff --git a/.bin/tag/interactive b/cmd/tag/interactive diff --git a/.bin/tag/set b/cmd/tag/set diff --git a/.bin/textdisplay b/cmd/textdisplay diff --git a/.bin/thesaurus b/cmd/thesaurus diff --git a/.bin/tlds b/cmd/tlds diff --git a/.bin/tmuxkillshell b/cmd/tmuxkillshell diff --git a/.bin/topen b/cmd/topen diff --git a/.bin/torlist b/cmd/torlist diff --git a/.bin/torrents b/cmd/torrents diff --git a/.bin/tsclean b/cmd/tsclean diff --git a/.bin/uniqfind b/cmd/uniqfind diff --git a/.bin/uptimemon b/cmd/uptimemon diff --git a/.bin/urlencode b/cmd/urlencode diff --git a/.bin/urlhand b/cmd/urlhand diff --git a/.bin/urlhand2 b/cmd/urlhand2 diff --git a/.bin/wallblur b/cmd/wallblur diff --git a/cmd/wallp b/cmd/wallp @@ -0,0 +1,69 @@ +#!/bin/rc +# usage: wallp [-s] [-n|-r] [dir] [monitors] +# randomly select wallpaper for each monitor and apply +# -S select monitors via dmenu +# -s select subdirectory via dmenu +# -n only select new wallpaper for monitors without one +# -r don't select new wallpapers, restore from cache +# usage: wallp [-l] +# list monitors + +fn checkempty { + if ($1 ()) + exit +} + +_dir = $home/.local/wall +mkdir -p $_dir + +while (~ $1 -*) { + flags = ($flags $1) + shift +} + +if (!~ $1 ()) { + search = $1 + shift +} + +if (~ $flags -s) { + search = `$nl{find $search -type d | dmenu -i} + checkempty $search +} + +if (~ $flags -S) { + monitors = `$nl{xrandr --listactivemonitors | awk '$4 {print $4}' | dmenu -i} + checkempty $monitors +} else if (~ $1 ()) { + monitors = `$nl{xrandr --listactivemonitors | awk '$4 {print $4}'} +} else { + monitors = $* +} + +if (~ $flags -l) { + exec echo $^monitors +} + +if (~ $flags -n) { + for (m in $monitors) { + if (!test -f $_dir/$m) { + pop = ($pop $m) + } + } +} else { + pop = $monitors +} + +if (!~ $flags -r) { + wallpapers = `$nl{find $search -type f | shuf -n $#pop} + for (i in `{seq $#pop}) { + rm -f $_dir/$pop($i) + ln -s `$nl{realpath $wallpapers($i)} $_dir/$pop($i) + } +} + +args = () +for (m in $monitors) { + args = ($args --output $m --zoom $_dir/$m) +} +xwallpaper $args diff --git a/.bin/wbcachemake b/cmd/wbcachemake diff --git a/.bin/wordle b/cmd/wordle diff --git a/.bin/yt/embedify b/cmd/yt/embedify diff --git a/.bin/yt/feed b/cmd/yt/feed diff --git a/.bin/yt/meta b/cmd/yt/meta diff --git a/.bin/yt/search b/cmd/yt/search diff --git a/.bin/yt/sorted b/cmd/yt/sorted