2021-11-28 03:50:19 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-12-10 06:49:21 +00:00
|
|
|
termprog="st"
|
2021-11-28 03:50:19 +00:00
|
|
|
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}')
|
|
|
|
|
2023-12-10 06:49:21 +00:00
|
|
|
wmctrl -l > ~/.wl
|
2021-11-28 03:50:19 +00:00
|
|
|
|
2023-12-10 06:49:21 +00:00
|
|
|
$termprog -g 80x24+${x}+${y}&
|
2021-11-28 03:50:19 +00:00
|
|
|
|
|
|
|
while true; do
|
|
|
|
lastCreatedID=$(wmctrl -l | tail -n 1 | awk '{print $1}')
|
2023-12-10 06:49:21 +00:00
|
|
|
if [ "$lastCreatedID" != "$(tail -n 1 ~/.wl | awk '{print $1}')" ]; then
|
2021-11-28 03:50:19 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
wmctrl -i -r $lastCreatedID -e 0,$geom
|
2023-12-10 06:49:21 +00:00
|
|
|
rm ~/.wl
|
2021-11-28 03:50:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-12-10 06:49:21 +00:00
|
|
|
|
|
|
|
# swap mouse buttons so we can use right button like in rio
|
|
|
|
xmodmap -e 'pointer = 3 2 1'
|
|
|
|
|
2021-11-28 03:50:19 +00:00
|
|
|
case $1 in
|
|
|
|
delete)
|
|
|
|
delete;;
|
|
|
|
new)
|
|
|
|
new;;
|
|
|
|
resize)
|
|
|
|
resize;;
|
|
|
|
move)
|
|
|
|
move;;
|
|
|
|
hide)
|
|
|
|
hide;;
|
|
|
|
esac
|
2023-12-10 06:49:21 +00:00
|
|
|
|
|
|
|
# restore original mouse config
|
|
|
|
xmodmap -e 'pointer = 1 2 3'
|