From 02566d04a9c85ebb080ba732fcad6732b4cd2a6a Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sat, 9 Dec 2023 23:49:21 -0700 Subject: [PATCH] rio.sh: use btn3 like rio; sirius.sh: fix path to socket --- README.md | 2 +- rio.sh | 23 ++++++++++++----------- sirius.sh | 24 ++++++++++++++++++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 02f1c28..54534a7 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Breakdown weekly data from `zeit` into by-day/by-project buckets for easy transf ### 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 diff --git a/rio.sh b/rio.sh index 86b24ad..d9af4d7 100755 --- a/rio.sh +++ b/rio.sh @@ -1,10 +1,6 @@ #!/bin/sh -# use slop and wmctrl to emulate rio behavior in an EWMH compliant WM -# Derek Stevens -# MIT License - -termcmd="alacritty --option geometry=" +termprog="st" movebind="super+v" delete() @@ -17,22 +13,20 @@ new() geom=$(slop -t 0 -f %x,%y,%w,%h) x=$(echo $geom | awk -F , '{print $1}') 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 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 fi done wmctrl -i -r $lastCreatedID -e 0,$geom - rm $wl + rm ~/.wl } resize() @@ -56,6 +50,10 @@ hide() 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 delete) delete;; @@ -68,3 +66,6 @@ case $1 in hide) hide;; esac + +# restore original mouse config +xmodmap -e 'pointer = 1 2 3' diff --git a/sirius.sh b/sirius.sh index 9b4fc9b..b455eff 100755 --- a/sirius.sh +++ b/sirius.sh @@ -5,18 +5,31 @@ # MIT License inbox=~/lib/mail/zoho/INBOX -tarosock=~/src/taro/taro.sock +tarosock=~/lib/taro/taro.sock if [ "$1" = "-s" ]; then oldnew=$(\ls -1 ${inbox}/new | wc -l) - msg="syncing." + dots=" " mbsync -a & 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 - msg=${msg}. done newnew=$(\ls -1 ${inbox}/new | wc -l) @@ -24,6 +37,7 @@ if [ "$1" = "-s" ]; then notify-send -c mail 'new mail' "[${newnew}]" if [ -S ${tarosock} ]; then printf "0" | socat UNIX-CONNECT:${tarosock} - + echo "pushed to socket" fi else notify-send -c mail 'mail' "[sync complete]" @@ -39,9 +53,11 @@ else notify-send -c mail 'new mail' "[${newnew}]" if [ -S ${tarosock} ]; then printf "0" | socat UNIX-CONNECT:${tarosock} - + echo "pushed to socket" fi fi oldnew=${newnew} sleep 5m + echo "slept 5m" done fi