add riosh

This commit is contained in:
Iris Lightshard 2021-11-27 20:50:19 -07:00
parent 6668809aff
commit 72ef08cc8c
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 72 additions and 24 deletions

View file

@ -1,11 +1,12 @@
# [[ zenUtils ]] # [[ zenUtils ]]
### --refined UI helper scripts-- ### --refined UI/workflow helper scripts--
#### Derek Stevens <nilix@nilfm.cc> #### Derek Stevens <nilix@nilfm.cc>
## About ## About
This is a simple collection of helper scripts to round out my two common desktop sessions: This is a simple collection of helper scripts to round out my two common desktop sessions:
* ryudo * ryudo
* fluxbox * fluxbox
@ -33,6 +34,10 @@ Background worker to sync an imap mailbox.
Generate a timesheet for a given month by manipulating the output from `zeit` Generate a timesheet for a given month by manipulating the output from `zeit`
### riosh
Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM
## License ## License
This collection is released permissively under the MIT License. You can do whatever you want with it, as long as you leave my name on it. This collection is released permissively under the MIT License. You can do whatever you want with it, as long as you leave my name on it.

66
rio.sh Executable file
View file

@ -0,0 +1,66 @@
#!/bin/sh
termcmd="alacritty --option geometry="
movebind="super+v"
delete()
{
wmctrl -c :SELECT:
}
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
${termcmd}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
break
fi
done
wmctrl -i -r $lastCreatedID -e 0,$geom
rm $wl
}
resize()
{
wid=$(slop -t 9999999 -f %i)
geom=$(slop -t 0 -f %x,%y,%w,%h)
wmctrl -i -r $wid -b remove,maximized_vert,maximized_horz
wmctrl -i -r $wid -e 0,$geom
}
move()
{
wid=$(slop -t 9999999 -f %i)
wmctrl -a $wid
xdotool key $movebind
}
hide()
{
wid=$(slop -t 9999999 -f %i)
wmctrl -i -r $wid -b add,hidden
}
case $1 in
delete)
delete;;
new)
new;;
resize)
resize;;
move)
move;;
hide)
hide;;
esac

View file

@ -1,23 +0,0 @@
#!/bin/sh
# this is a simple replacmeent for an ACPI handler script
# put it somewhere accessible for single-user mode and make a runit script for it
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
acpi_listen | {
while read event; do
# if no external monitor
# if [ ! -z "$(xrandr | grep HDMI | grep disconnected)" ]; then
# if AC is offline
if [ ! -z "$(acpi -a | grep off-line)" ]; then
if [ "${event}" = "button/lid LID close" ]; then
zzz
fi
fi
# fi
done
}