voidrice/.local/bin/i3cmds/hover

15 lines
838 B
Text
Raw Normal View History

2018-10-26 22:51:35 +00:00
#!/bin/sh
2019-03-30 04:02:09 +00:00
[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right
2018-10-26 22:51:35 +00:00
current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
xdotool windowsize "$current" $newheight $newwidth
newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*")
2018-10-26 22:51:35 +00:00
2019-03-30 04:02:09 +00:00
case "$1" in
left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
esac
2018-10-26 22:51:35 +00:00
xdotool windowmove "$current" $horizontal $vertical