71 lines
1.1 KiB
Bash
Executable file
71 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
termprog="st"
|
|
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}')
|
|
|
|
wmctrl -l > ~/.wl
|
|
|
|
$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
|
|
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
|
|
}
|
|
|
|
|
|
# swap mouse buttons so we can use right button like in rio
|
|
xmodmap -e 'pointer = 3 2 1'
|
|
|
|
case $1 in
|
|
delete)
|
|
delete;;
|
|
new)
|
|
new;;
|
|
resize)
|
|
resize;;
|
|
move)
|
|
move;;
|
|
hide)
|
|
hide;;
|
|
esac
|
|
|
|
# restore original mouse config
|
|
xmodmap -e 'pointer = 1 2 3'
|