aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc00ke <jesse@jc00ke.com>2016-07-07 12:25:15 -0700
committerjc00ke <jesse@jc00ke.com>2016-07-07 12:25:15 -0700
commit4040159af1982771b6d8ec417e503963270a40fb (patch)
tree25682a0a5d80ff0ce909a68d2b175867099af387
parentAdd v1.4 of Contributor Covenant Code of Conduct (diff)
parentFixing the bug that always maximized the window after it was moved. This chan... (diff)
downloadmove-to-next-monitor-4040159af1982771b6d8ec417e503963270a40fb.tar.gz
move-to-next-monitor-4040159af1982771b6d8ec417e503963270a40fb.tar.bz2
move-to-next-monitor-4040159af1982771b6d8ec417e503963270a40fb.zip
Merge pull request #1 from anuppuranik/master
Fixing a bug
-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