rio.sh: use btn3 like rio; sirius.sh: fix path to socket

This commit is contained in:
Iris Lightshard 2023-12-09 23:49:21 -07:00
parent 000dfce9fc
commit 02566d04a9
Signed by: Iris Lightshard
GPG key ID: F54E0D40695271D4
3 changed files with 33 additions and 16 deletions

View file

@ -40,7 +40,7 @@ Breakdown weekly data from `zeit` into by-day/by-project buckets for easy transf
### riosh ### riosh
Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM; requires `wmctrl`, `slop`, `xdotool`, and `xmodmap`
### desks ### desks

23
rio.sh
View file

@ -1,10 +1,6 @@
#!/bin/sh #!/bin/sh
# use slop and wmctrl to emulate rio behavior in an EWMH compliant WM termprog="st"
# Derek Stevens <nilix@nilfm.cc>
# MIT License
termcmd="alacritty --option geometry="
movebind="super+v" movebind="super+v"
delete() delete()
@ -17,22 +13,20 @@ new()
geom=$(slop -t 0 -f %x,%y,%w,%h) geom=$(slop -t 0 -f %x,%y,%w,%h)
x=$(echo $geom | awk -F , '{print $1}') x=$(echo $geom | awk -F , '{print $1}')
y=$(echo $geom | awk -F , '{print $2}') y=$(echo $geom | awk -F , '{print $2}')
wl=$(mktemp .windowlistXXX)
wmctrl -l >> $wl wmctrl -l > ~/.wl
${termcmd}80x24+${x}+${y}& $termprog -g 80x24+${x}+${y}&
while true; do while true; do
lastCreatedID=$(wmctrl -l | tail -n 1 | awk '{print $1}') lastCreatedID=$(wmctrl -l | tail -n 1 | awk '{print $1}')
if [ "$lastCreatedID" != "$(tail -n 1 $wl | awk '{print $1}')" ]; then if [ "$lastCreatedID" != "$(tail -n 1 ~/.wl | awk '{print $1}')" ]; then
break break
fi fi
done done
wmctrl -i -r $lastCreatedID -e 0,$geom wmctrl -i -r $lastCreatedID -e 0,$geom
rm $wl rm ~/.wl
} }
resize() resize()
@ -56,6 +50,10 @@ hide()
wmctrl -i -r $wid -b add,hidden wmctrl -i -r $wid -b add,hidden
} }
# swap mouse buttons so we can use right button like in rio
xmodmap -e 'pointer = 3 2 1'
case $1 in case $1 in
delete) delete)
delete;; delete;;
@ -68,3 +66,6 @@ case $1 in
hide) hide)
hide;; hide;;
esac esac
# restore original mouse config
xmodmap -e 'pointer = 1 2 3'

View file

@ -5,18 +5,31 @@
# MIT License # MIT License
inbox=~/lib/mail/zoho/INBOX inbox=~/lib/mail/zoho/INBOX
tarosock=~/src/taro/taro.sock tarosock=~/lib/taro/taro.sock
if [ "$1" = "-s" ]; then if [ "$1" = "-s" ]; then
oldnew=$(\ls -1 ${inbox}/new | wc -l) oldnew=$(\ls -1 ${inbox}/new | wc -l)
msg="syncing." dots=" "
mbsync -a & mbsync -a &
while pgrep mbsync; do while pgrep mbsync; do
notify-send -c mail 'mail' "[${msg}]" case $dots in
"...")
dots=" ..";;
" ..")
dots=" .";;
" .")
dots=" ";;
" ")
dots=". ";;
". ")
dots=".. ";;
".. ")
dots="...";;
esac
notify-send -c mail 'mail' "[syncing${dots}]"
sleep 1 sleep 1
msg=${msg}.
done done
newnew=$(\ls -1 ${inbox}/new | wc -l) newnew=$(\ls -1 ${inbox}/new | wc -l)
@ -24,6 +37,7 @@ if [ "$1" = "-s" ]; then
notify-send -c mail 'new mail' "[${newnew}]" notify-send -c mail 'new mail' "[${newnew}]"
if [ -S ${tarosock} ]; then if [ -S ${tarosock} ]; then
printf "0" | socat UNIX-CONNECT:${tarosock} - printf "0" | socat UNIX-CONNECT:${tarosock} -
echo "pushed to socket"
fi fi
else else
notify-send -c mail 'mail' "[sync complete]" notify-send -c mail 'mail' "[sync complete]"
@ -39,9 +53,11 @@ else
notify-send -c mail 'new mail' "[${newnew}]" notify-send -c mail 'new mail' "[${newnew}]"
if [ -S ${tarosock} ]; then if [ -S ${tarosock} ]; then
printf "0" | socat UNIX-CONNECT:${tarosock} - printf "0" | socat UNIX-CONNECT:${tarosock} -
echo "pushed to socket"
fi fi
fi fi
oldnew=${newnew} oldnew=${newnew}
sleep 5m sleep 5m
echo "slept 5m"
done done
fi fi