Linux – How to automate window tiling with a custom width? (Cinnamon)

cinnamonlinux-mintwindow-managementwmctrlxdotool

I am running Linux Mint 17 Cinnamon 2.4.8.

I really like xdotool, but it conflicts with Cinnamon's awesome snapping/tiling feature.

If I run the following command, it does NOT work if the current window is snapped to a corner/side/fullscreen.

xdotool getactivewindow windowsize 500 1080 windowmove 1420 0

I would like to keep it snapped, but with a custom width. If it is NOT snapped, it works.

Main goal: Snap a window to the right side, with 500 width (via a command)

However, it's probably impossible with xdotool.

I would prefer not to install anything else, and do it all with cinnamon, but if anyone thinks I can achieve my goal with wmctrl, then I'll give it a shot.

Desired output vs. current output

http://s115.photobucket.com/user/ericrazy2000/media/snapped.png.html

http://s115.photobucket.com/user/ericrazy2000/media/NOTsnapped.png.html

Best Answer

You might need to remove some maximization flags first:

wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;\
xdotool getactivewindow windowsize 500 1080 windowmove 1420 0;\
wmctrl -r :ACTIVE: -b add,maximized_vert