From 7f287bfaae79ad736a439afb87124745ab70c64f Mon Sep 17 00:00:00 2001 From: angelic-sedition Date: Mon, 16 Feb 2015 19:09:28 -0500 Subject: [PATCH] move geometry getting code into own function --- tdrop | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tdrop b/tdrop index c61ad7c..6e34820 100755 --- a/tdrop +++ b/tdrop @@ -194,8 +194,13 @@ auto_hide() { mkdir -p /tmp/tdrop/auto_hidden echo "$wid" > /tmp/tdrop/auto_hidden/wid get_class_name > /tmp/tdrop/auto_hidden/class - wininfo=$(xwininfo -id "$wid") - # save window position + get_geometry "$wid" > /tmp/tdrop/auto_hidden/geometry + xdotool windowunmap "$wid" + fi +} + +get_geometry() { + wininfo=$(xwininfo -id "$1") x=$(echo "$wininfo" | awk '/Absolute.*X/ {print $4}') y=$(echo "$wininfo" | awk '/Absolute.*Y/ {print $4}') rel_x=$(echo "$wininfo" | awk '/Relative.*X/ {print $4}') @@ -206,9 +211,7 @@ auto_hide() { if [[ $y -ne $rel_y ]]; then y=$((y-rel_y)) fi - echo -e "X=$x\nY=$y" > /tmp/tdrop/auto_hidden/geometry - xdotool windowunmap "$wid" - fi + echo -e "X=$x\nY=$y" } geometry_set() {