From f75a8b0cbc300447609810153b166e86accd082a Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sat, 29 Aug 2020 16:54:04 +0200 Subject: [PATCH] improved hover function --- .local/bin/tools/hover | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .local/bin/tools/hover diff --git a/.local/bin/tools/hover b/.local/bin/tools/hover new file mode 100755 index 0000000..c64cd70 --- /dev/null +++ b/.local/bin/tools/hover @@ -0,0 +1,24 @@ +#!/bin/sh + +[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right +current=$(xdotool getwindowfocus) +newwidth=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) +newheight=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) +centerwidth=$(( $(xdotool getdisplaygeometry | awk '{print $1}') / 2)) +newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') +#newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") +borderwidth=3 +baroffset=47 + +case "$1" in + left) horizontal=borderwidth; + vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newheight - 2 * borderwidth )) ;; + right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth - 2 * borderwidth )) + vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newheight - 2 * borderwidth )) ;; + center) horizontal=$(( ( $(xdotool getdisplaygeometry | awk '{print $1}') - centerwidth ) / 2 )); + vertical=$baroffset + newheight=$(( $(xdotool getdisplaygeometry | awk '{print $2}' ) - baroffset -5)) + newwidth=$centerwidth;; +esac +xdotool windowsize "$current" $newwidth $newheight +xdotool windowmove "$current" $horizontal $vertical