aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnup Puranik <anup.v.puranik@jpmorgan.com>2016-07-07 12:43:34 +0800
committerAnup Puranik <anup.v.puranik@jpmorgan.com>2016-07-07 12:43:34 +0800
commitd425705f3526f604497542b6677482583f3f9fa9 (patch)
tree25682a0a5d80ff0ce909a68d2b175867099af387
parentAdd v1.4 of Contributor Covenant Code of Conduct (diff)
downloadmove-to-next-monitor-d425705f3526f604497542b6677482583f3f9fa9.tar.gz
move-to-next-monitor-d425705f3526f604497542b6677482583f3f9fa9.tar.bz2
move-to-next-monitor-d425705f3526f604497542b6677482583f3f9fa9.zip
Fixing the bug that always maximized the window after it was moved. This change should make this script work on old ans well as new versions of xwininfo tool.
-rwxr-xr-xmove-to-next-monitor9
1 files changed, 7 insertions, 2 deletions
diff --git a/move-to-next-monitor b/move-to-next-monitor
index 5530d9b..400054c 100755
--- a/move-to-next-monitor
+++ b/move-to-next-monitor
@@ -19,7 +19,8 @@ display_height=`xdotool getdisplaygeometry | cut -d" " -f2`
window_id=`xdotool getactivewindow`
# Remember if it was maximized.
-window_state=`xprop -id $window_id _NET_WM_STATE | awk '{ print $3 }'`
+window_horz_maxed=`xprop -id $window_id _NET_WM_STATE | grep '_NET_WM_STATE_MAXIMIZED_HORZ'`
+window_vert_maxed=`xprop -id $window_id _NET_WM_STATE | grep '_NET_WM_STATE_MAXIMIZED_VERT'`
# Un-maximize current window so that we can move it
wmctrl -ir $window_id -b remove,maximized_vert,maximized_horz
@@ -65,6 +66,10 @@ fi
xdotool windowmove $window_id $new_x $new_y
# Maximize window again, if it was before
-if [ -n "${window_state}" ]; then
+if [ -n "${window_horz_maxed}" -a -n "${window_vert_maxed}" ]; then
wmctrl -ir $window_id -b add,maximized_vert,maximized_horz
+elif [ -n "${window_horz_maxed}" ]; then
+ wmctrl -ir $window_id -b add,maximized_horz
+elif [ -n "${window_vert_maxed}" ]; then
+ wmctrl -ir $window_id -b add,maximized_vert
fi
bgstack15