67 lines
999 B
Bash
67 lines
999 B
Bash
|
#!/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
|