How to Snap window to half the screen size in Mint 13 Mate?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

How to Snap window to half the screen size in Mint 13 Mate?

Post by pepperminty »

In Windows 7, we can Snap a a window to half the screen size (Aero Snap) using WindowsKey+Left or WindowsKey+Right. How can we do this in Linux Mint MATE 13?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
viking777

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by viking777 »

Dear pepperminty, you have been a member of the forum for over 1 year and you have made (to date) 189 posts. You are not a newbie so please don't post in that section any more. If you do this again the posts will be deleted, it is just laziness that prevents you from thinking about which is the correct place to put your support questions and it is also contrary to forum rules:

[Forum Rule 3] Consider Which Forum Section To Post
Posting to specific sections can make it easier for others to provide assistance and for future searches. For example, if you are having a specific software issue, post to "Software and Applications" section instead of "Newbie Questions".
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

The following simple trick works for me in Mate 13. To set up left "aero snap" install the package wmctrl. Then make a text file with the following line:

wmctrl -r :ACTIVE: -e 0,0,0,w,h

where w is half the width of your screen (in pixels) and h is the height. Make the file executable and assign it to any key you want.

For right aero snap, use the command

wmctrl -r :ACTIVE: -e 0,w,0,w,h

Note that this blindly sets the relocated window height to the height of the screen. For fancier variations on this, have a look at the wmctrl man page.
Last edited by sjr on Tue Aug 07, 2012 5:25 am, edited 1 time in total.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

wmctrl

Post by pepperminty »

SJR,
thanks for your reply. I have installed wmctrl.

Do I have to run the commands in terminal? Is there a way to program "WindowsKey+LeftArrow" and "WindowsKey+RightArrow" to get the same outcome as in Windows 7?
Last edited by pepperminty on Wed Aug 08, 2012 1:52 am, edited 1 time in total.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

pepperminty,
OK, decide where you want to keep the file. then (in Caja) right click on the file, select properties, then the "Permissions" tab, and check "allow executing file as program."

Now open "Keyboard Shortcuts" in the Control Center, click the "Add" button, give your command a name of your choosing, and in the "command" field provide the full path of the file you have created.

Next (still in keyboard shortcuts) your new command will have its own line. Click that line in the "shortcuts" column, and press whatever key combination you desire.

Voila!
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

wmctrl and keyboard shortcut

Post by pepperminty »

Dear SJR,


I created a text file in /home/peperminty/programs/aero_snap/. I called the file left_aero_snap. Inside the file, I pasted:
wmctrl -r :ACTIVE: -e 0,0,0,w,h

I then made it executable by going to Properties/Permission. Then, in Keyboard Shortcut, I added a new shortcut. For the command I used:

Code: Select all

'/home/pepperminty/programs/aero_snap/left_aero_snap' 
But that didn't work.
I also tried the quotation-mark-less version:

Code: Select all

/home/pepperminty/programs/aero_snap/left_aero_snap
But that also did not work.

Please help.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

Dear peperminty,
You must replace "w" by half the width of your screen, in pixels, and "h" by the height of your screen in pixels.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by pepperminty »

What command can I run in Terminal to determine how many pixel there are vertically and horizontally?
Last edited by pepperminty on Wed Aug 08, 2012 1:52 am, edited 1 time in total.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

peperminty,
For screen width and height, go to the control center and click on monitors. Width is the first number.

Also, you don't need the quotes that you mentioned.

If you want to use the commandline to get info about your monitor, try xdpyinfo.
Last edited by sjr on Tue Aug 07, 2012 8:41 am, edited 1 time in total.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by pepperminty »

SJR,
I've replaced h and w with the right numbers but the keyboard shortcuts still don't work.
Last edited by pepperminty on Wed Aug 08, 2012 1:53 am, edited 1 time in total.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

peperminty,
To debug, you can try running your new command from a terminal. That should "aero-snap" your terminal window. If that works (and it should) then you should mess around with the keyboard shortcuts program until you're sure that you are using it correctly. For example, try to make a keyboard shortcut for showing the desktop or something, and see if that works. Of course there is always the possibility that something strange about your system is getting in the way, but I think that is extremely unlikely. Good luck!
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by pepperminty »

SJR,
I ran

Code: Select all

 wmctrl -r :ACTIVE: -e 0,0,0,683,768
In a full-screen terminal window and nothing happened.
Last edited by pepperminty on Wed Aug 08, 2012 1:53 am, edited 1 time in total.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

peperminty,
Does it work if the terminal window is not full-screen? If so, then I suggest that you modify your script file to read as follows:

wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
wmctrl -r :ACTIVE: -e 0,0,0,683,768

The effect of the first line is to cancel the maximization state. I just tested this and it works fine. Me, I have a separate keyboard shortcut to toggle maximization, and I'm in the habit of using that before an aero-snap, so the problem never occured to me. Anyway, try this!
xpander

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by xpander »

quicktile is also nice.

http://ssokolow.com/quicktile/

controlling the windows is with alt+ctrl and numpad numbers
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by pepperminty »

sjr wrote:peperminty,
Does it work if the terminal window is not full-screen?
Yes, the one-line command works when terminal window is not full-screen.
sjr wrote: If so, then I suggest that you modify your script file to read as follows:

wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
wmctrl -r :ACTIVE: -e 0,0,0,683,768

The effect of the first line is to cancel the maximization state. I just tested this and it works fine. Me, I have a separate keyboard shortcut to toggle maximization, and I'm in the habit of using that before an aero-snap, so the problem never occured to me. Anyway, try this!
I changed my script file to left_aero_snap file to:

Code: Select all

wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
wmctrl -r :ACTIVE: -e 0,0,0,683,768
Now, a full-screen Caja becomes unmaximized, but the window does not snap to the left half of the monitor.
Are we missing some "punctuation" between the two commands?
Last edited by pepperminty on Wed Aug 08, 2012 2:09 am, edited 2 times in total.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Quicktile

Post by pepperminty »

xpander wrote:quicktile is also nice.

http://ssokolow.com/quicktile/

controlling the windows is with alt+ctrl and numpad numbers
Thanks, Xpander. I'll try quicktile if wmctrl doesn't work.
sjr

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by sjr »

peperminty,

No, there is no problem with terminating the line.

So now we have a script that works on my machine but not yours. I'm puzzled... Maybe it is a timing problem.

You can try putting the command

sleep .2s

between the two commands of your script file. If that doesn't work then I'm not sure I have another move. There are various scripts out there that do what you want, but as far as I know they all use wmctrl. Sorry I couldn't be of more help.

Of course you coud do what I do, and have a shortcut key to toggle maximization, and another two for left and right aero snap.
User avatar
pepperminty
Level 6
Level 6
Posts: 1064
Joined: Thu Jun 23, 2011 10:51 pm

Mint 13 Cinnamon just works!

Post by pepperminty »

I am trying out Mint 13 Cinnamon and snapping to half the window just works. No need to install/configure anything.
pclausen

Re: How to Snap window to half the screen size in Mint 13 Ma

Post by pclausen »

I'm now using Mate on all my systems, even my productive ones - its stable, reliable and I'm loving it. This feature is the only thing I miss from cinnamon/gnome/XFCE (and even XFCE has it!).

+1 for quicktile.py which is definately the next best thing. Download, extract, modify ~/.config/quicktile.cfg (I changed line 4 to "ModMask = Mod1"), set Start apps to /some-path/quicktile.py --daemonize

With this, Left Alt (Mod1) and NumPad Keys works brilliant!

Keep up the great work everyone.
geoffm

[solved] Re: How to Snap window to half the screen size in M

Post by geoffm »

Try dragging windows around while holding SHIFT. :idea: Works in MATE 1.6
You'll see there are several snaps programmed, it's just users aren't communicated the feature.
Locked

Return to “MATE”