Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way to enable Windows Snap in Gnome3 Classic? I've been using KDE4 and there it's out of the box. Right now I'm testing Kali Llinux and I'm trying to get it work.

I want a lightweight environment and I need only snapping. Any ideas, besides building own Kali with KDE or using compiz?

share|improve this question

1 Answer 1

I don't think that you can activate snap without compositing (Gnome3 classic). It does come out of the box on full Gnome3 (I think) and definately does with Cinnamon. Anyway, I have written a script which essentially does the same thing.

It will not work automatically, that is it won't be activated just by dragging a window to the edge of the screen, but you can assign shortcuts to it. For example, Ctrl+R to snap to the right hand side etc.

The script requires disper, xdpyinfo and wmctrl, all of which should be easily available and are in the debian repos (which kali uses). If you save the script as snap_windows.sh, you can use it as follows:

  • snap_windows.sh will maximize/unmaximize the current window.
  • snap_windows.sh l will snap the current window to the left hand side of the screen
  • snap_windows.sh r will snap the current window to the right hand side of the screen

If you are using two screens, it will always snap to the left/right side of the right hand side screen. It is not perfect and I haven't used it since I switched to Cinnammon so let me know if you have trouble with it.

Here's the script:


## If no side has been given, toggle maximizing the current window and exit
if [ ! $1 ]
    wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz

## If a side has been given, continue
## How many screens are there?
screens=`disper -l | grep -c display`
## Get screen dimensions
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'`;

## If we are running on one screen, snap to edge of screen
if [ $screens == '1' ]
    ## Snap to the left hand side
    if [ $side == 'l' ]
        ## wmctrl format: gravity,posx,posy,width,height
        wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
    ## Snap to the right hand side
        wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1 
## If we are running on two screens, snap to edge of right hand screen
## I use 1600 because I know it is the size of my laptop display
## and that it is not the same as that of my 2nd monitor.
    LAPTOP=1600; ## Change this as approrpiate for your setup.
    let "WIDTH-=LAPTOP";
    if [ $side == 'l' ]
        wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$LAPTOP,0,$HALF,-1
    let "SCREEN += HALF+2";
        wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$SCREEN,0,$HALF,-1;
share|improve this answer
I think switching to Cinnamon is a better option :) I've installed Cinnamon (1.6.7) on Kali (based on Debian Wheezy) on VirtualBox and now it seems that 3D is not working properly. Cinnamon works, but it's terribly slow. Cinnamon is heavier than KDE? because KDE works like a charm. I have Intel 4000 HD. –  Simon Mar 22 '13 at 11:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.