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

Forum rules
Before you post please read how to get help
User avatar
pepperminty
Level 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

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

Postby pepperminty » Tue Jul 31, 2012 10:21 pm

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?
Using Mint 13 Cinnamon

User avatar
viking777
Level 14
Level 14
Posts: 5127
Joined: Mon Dec 01, 2008 11:21 am

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

Postby viking777 » Wed Aug 01, 2012 1:41 pm

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".
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).

sjr
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 5:16 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

wmctrl

Postby pepperminty » Tue Aug 07, 2012 5:22 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 5:36 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

wmctrl and keyboard shortcut

Postby pepperminty » Tue Aug 07, 2012 5:49 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 8:01 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

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

Postby pepperminty » Tue Aug 07, 2012 8:09 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 8:25 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

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

Postby pepperminty » Tue Aug 07, 2012 8:40 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 8:49 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

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

Postby pepperminty » Tue Aug 07, 2012 9:14 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Tue Aug 07, 2012 9:35 am

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!

User avatar
xpander
Level 3
Level 3
Posts: 156
Joined: Mon Sep 26, 2011 5:59 am

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

Postby xpander » Tue Aug 07, 2012 11:12 pm

quicktile is also nice.

http://ssokolow.com/quicktile/

controlling the windows is with alt+ctrl and numpad numbers
Linux Gaming Videos: http://www.youtube.com/user/Xpander666?feature=mhee
-----------
Gfire - Xfire For Pidgin

User avatar
pepperminty
Level 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

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

Postby pepperminty » Wed Aug 08, 2012 1:47 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

Quicktile

Postby pepperminty » Wed Aug 08, 2012 1:54 am

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
Level 1
Level 1
Posts: 17
Joined: Thu Jun 21, 2012 4:48 pm

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

Postby sjr » Wed Aug 08, 2012 2:19 am

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 4
Level 4
Posts: 482
Joined: Thu Jun 23, 2011 10:51 pm

Mint 13 Cinnamon just works!

Postby pepperminty » Sat Oct 20, 2012 12:38 am

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

pclausen
Level 1
Level 1
Posts: 2
Joined: Tue Jan 08, 2013 6:00 am

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

Postby pclausen » Tue Jan 08, 2013 6:12 am

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
Level 3
Level 3
Posts: 113
Joined: Thu Jul 16, 2009 8:34 am
Location: Quebec, Canada

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

Postby geoffm » Sun Aug 18, 2013 2:41 pm

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.
Custom build w/ Gigabyte Z87MX-D3h | Intel Core i5 4670 | 8GB DD3 | 250GB SSD


Return to “MATE”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests