Page 2 of 16 FirstFirst 123412 ... LastLast
Results 11 to 20 of 158

Thread: Aero Snap function?

  1. #11
    Join Date
    Apr 2008
    Beans
    21

    Re: Aero Snap function?

    Thanks gotsanity, that's pretty cool!

    I got it to work but after some research realized there was a way to get the same functionality without having to input the dimensions manually. This could be useful because it would make the tutorial easier, and if you ever change your resolution it would be already set up for you. The other advantage is that when the window is dragged to the top, to be maximized, it is actually maximized rather than changing it's resolution to fit the screen. As a disclaimer, I'm no expert at bash scripting, so feel free to improve on the code. I also found the 'let <variable> =' command doesn't work within the Command lines.

    Here's the changes:
    Command Line 0:
    Code:
    WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
    Command Line 1:
    Code:
    WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
    Command Line 2:
    Code:
    wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
    Other than that it's the same, still has the same minor problems and still requires the same software to be installed. Apparently the xdpyinfo command comes preinstalled.

    Sources:
    Code:
    http://www.cyberciti.biz/faq/how-do-i-find-out-screen-resolution-of-my-linux-desktop/
    http://www.linuxforums.org/forum/linux-programming-scripting/44758-extracting-substring-string.html
    http://desk.stinkpot.org:8080/tricks/index.php/2007/01/assign-output-of-shell-command-to-variable-in-bash/
    http://www.gnu.org/software/bash/manual/bashref.html
    http://www.softpanorama.org/Scripting/Shellorama/arithmetic_expressions.shtml

    Thanks again gotsanity, I would have had no idea where to look without your guide. Still looking forward to the aero shake idea.

  2. #12
    Join Date
    Jan 2008
    Beans
    64

    Re: Aero Snap function?

    Yeah, maybe this weekend I can edit down the tutorial with your changes. As for the aero shake I think that one is gonna require some custom coding. I will do some digging and see what I can come up with.

  3. #13
    Join Date
    Apr 2007
    Beans
    15

    Re: Aero Snap function?

    For multiple monitor setups, here's the trick to get the compiz,

    Check the GL_MAX_TEXTURE_SIZE using
    Code:
    glxinfo -l | grep GL_MAX_TEXTURE_SIZE
    Mine was 2048, Now we want a horizontal resolution higher than 2048 in compiz. We can just tell compiz to ignore this limitation. BUt I did it the dirty way by changing /usr/bin/compiz script:

    Code:
    sudo vi /usr/bin/compiz
    Here I commented the line, TEXTURE_LIMIT=.<something>... and added TEXTURE_LIMIT=2944.

    Now enable compiz with Appearance settings in ubuntu. The wallpaper will be redrawn, Hence we must enable wallpaper compiz plugin from CCSM (compizconfig setting manager).

    But to enable wallpaper plugin we must disable nautilus desktop from gconf editor. I used this trick from tombuntu:

    Code:
    Launch the Run Application dialog with Alt-F2 and run gconf-editor.
    Navigate to apps->nautilus->preferences and unselect the show_desktop option.
    Your desktop icons should disappear. Now enable the wallpaper plugin from CCSM

    Now just add the lines as commands to compiz and enjoy

    My setup is

    Code:
    [TV connected to laptop via VGA]
     __________     ___________
     |1024x768|     |1920x1080|
     | laptop |---->| display |
     |________|     |_________|
    /________/
    win+1 --> move to laptop display
    Code:
    bash -c "wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -b remove,maximized_vert ;wmctrl -r :ACTIVE: -e 0,0,0,1024,768"
    win+2 --> move to VGA left half display (external monitor)
    Code:
    bash -c "wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -b remove,maximized_vert ;wmctrl -r :ACTIVE: -e 0,1025,0,960,1080"
    win+3 --> move to VGA right half display (external monitor)
    Code:
    bash -c "wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -b remove,maximized_vert ;wmctrl -r :ACTIVE: -e 0,1985,0,960,1080"

    want win+3 --> restore to original pos (does not work sometimes)
    Code:
    bash -c "wmctrl -r :ACTIVE: -b toggle,maximized_vert && wmctrl -r :ACTIVE: -b toggle,maximized_horz;"

    @frt975
    Wobble does not resize like this. I wanted to use the $WIDTH trick, but just was lazy to debug the script.

    I have compiz now!!
    Last edited by btechcs; November 15th, 2009 at 11:12 AM. Reason: now supports compiz on multiple display. Cheers!!

  4. #14
    Join Date
    Jul 2009
    Beans
    Hidden!

    Re: Aero Snap function?

    i think window wobble is what you're looking for

  5. #15
    Join Date
    Aug 2006
    Location
    Oz
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Aero Snap function?

    Thanks everyone. This works well.

    Can anyone help out with the commands for four tiles, one in each corner? That'd be sweet.

  6. #16
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Aero Snap function?

    Nice work gotsanity.
    Last edited by stinkeye; November 12th, 2009 at 12:27 PM.

  7. #17
    Join Date
    Mar 2008
    Beans
    60

    Re: Aero Snap function?

    So cool, And if have function like "Show windows side by side " in Windows

  8. #18
    scouser73's Avatar
    scouser73 is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Mar 2008
    Beans
    1,663
    Distro
    Ubuntu Development Release

    Wink Re: Aero Snap function?

    Follow these instructions OMG Ubuntu: Get Aero Snap

  9. #19
    Join Date
    Aug 2007
    Beans
    11

    Re: Aero Snap function?

    I'm having trouble setting this up because I cannot find edge bindings. I'm using ccsm version 0.7.8.

    General Options is the only option under the General category. The tabs within General Options are: General, Display Settings, Focus & Raise Behaviour, Key Bindings, Commands, and Desktop Size.

    When I run sudo apt-get install compizconfig-settings-manager wmctrl it tells me that both packages are the newest version.

    Was edge bindings removed or something?


    UPDATE: decided to do a fresh install of 9.10 and my ccsm version is now 0.8.2 and edge bindings is now available.
    Last edited by manicnerd; December 4th, 2009 at 11:19 PM.

  10. #20
    Join Date
    Dec 2009
    Beans
    2

    Re: Aero Snap function?

    Quote Originally Posted by Mahyar View Post
    Thanks everyone. This works well.

    Can anyone help out with the commands for four tiles, one in each corner? That'd be sweet.
    Execute the following script to generate the commands for GNOME and/or KDE for your resolution (without annoying overlapping windows). grid.sh:

    Code:
    #!/bin/bash
    
    echo ""
    echo "Ubuntu (GNOME) contains a nice utility Compiz Grid:"
    echo "Tile, position and resize your windows to fit an imaginary grid."
    echo "The functionality is based on Winsplit Revolution for Microsoft Windows."
    echo "For more info, demos etc. see: http://winsplit-revolution.com"
    echo ""
    echo "This script can be used to define wmctrl commands for Kubuntu (KDE)"
    echo "for your monitor resolution. These commands can be attached to"
    echo "Key Bindings (keyboard shortcuts), so you have the same functionality"
    echo "under KDE without the need to install a Tiling Window Manager like"
    echo "xmonad, awesome or ion3."
    echo ""
    echo "The commands can also be used to emulate Windows 7 Aero Snap"
    echo "without annoying overlapping windows."
    echo "For more info about this subject see youtube or for example" 
    echo "http://www.omgubuntu.co.uk/2009/11/aero-snap-ubuntu-linux.html"
    echo ""
    echo "NOTES:" 
    echo "- This scipt uses xwininfo (part of x11-utils package) and wmctrl."
    echo "  For (K)ubuntu:"
    echo "  sudo apt-get install x11-utils wmctrl"
    echo "- This script is tested with:"
    echo "  Ubuntu 9.10 (resolution 1920x1200)"
    echo "  Kubuntu 9.10 (resolution 1920x1200)"
    echo "  Kubuntu 8.10 (resolution 1600x1200)"
    
    # define maximum size of usable screen
    wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
    sleep 1
    
    WIDTH=$((`xwininfo -id $WINDOWID | grep 'Width:' | cut -f 2 -d ':'`))
    HEIGHT=$((`xwininfo -id $WINDOWID | grep 'Height:' | cut -f 2 -d ':'`))
    BORDERY=$((`xwininfo -id $WINDOWID | grep 'Corners:' | cut -f 11 -d ' ' | cut -f 2 -d '-'`))
    wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;
    sleep 1
    wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$HEIGHT
    sleep 1
    
    BORDER=$((`xwininfo -id $WINDOWID | grep 'Absolute upper-left X:' | cut -f 2 -d ':'`))
    BOTTOM=$((`xwininfo -id $WINDOWID | grep 'Corners:' | cut -f 11 -d ' ' | cut -f 2 -d '-'`))
    BORDERY=$(($BORDERY-(`xwininfo -id $WINDOWID | grep 'Corners:' | cut -f 11 -d ' ' | cut -f 2 -d '-'`)))
    TOP=$((`xwininfo -id $WINDOWID | grep 'Relative upper-left Y:' | cut -f 2 -d ':'`))
    
    if [ $TOP -eq 0 ]
    then #KDE
        echo ""
        echo "----------------------"
        echo "Assuming KDE, Correct?"
        echo "----------------------"
        WIDTH=$(((`xwininfo -id $WINDOWID | grep 'Width:' | cut -f 2 -d ':'`)-2*$BORDER))
        HEIGHT=$(((`xwininfo -id $WINDOWID | grep 'Height:' | cut -f 2 -d ':'`)-2*$BORDERY))
        TITLE=$((`xwininfo -id $WINDOWID | grep 'Absolute upper-left Y:' | cut -f 2 -d ':'`))
    
        echo ""
        echo "Below are the wmctrl commands for KDE (Kubuntu)."
        echo ""
        echo "The Key Bindings (keyboard shortcuts) can be set in the following way:"
        echo "sudo apt-get install xbindkeys xbindkeys-config"
        echo "xbindkeys --defaults > ~/.xbindkeysrc"
        echo "echo \"xbindkeys\" > ~/.kde/Autostart/startxbindkeys.sh"
        echo "chmod u+x ~/.kde/Autostart/startxbindkeys.sh"
        echo "~/.kde/Autostart/startxbindkeys.sh"
        echo "xbindkeys-config"
        echo "finally add the commands below"
        echo ""
        echo "Centre       Control+Alt+KP_Begin:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$HEIGHT"
        echo ""
        echo "Left         Control+Alt+KP_Left:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo ""
        echo "Right        Control+Alt+KP_Right:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+($BORDER))),0,$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo ""
        echo "Top          Control+Alt+KP_Up:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
        echo ""
        echo "Bottom       Control+Alt+KP_Down:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,$(($TITLE+$BORDERY+$TOP+($HEIGHT/2-($TITLE/2+$BORDERY)))),$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
        echo ""
        echo "Top Left     Control+Alt+KP_Home:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
        echo ""
        echo "Top Right    Control+Alt+KP_Prior:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+($BORDER))),0,$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
        echo ""
        echo "Bottom Left  Control+Alt+KP_End:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,$(($TITLE+$BORDERY+$TOP+($HEIGHT/2-($TITLE/2+$BORDERY)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
        echo ""
        echo "Bottum Right Control+Alt+KP_Next:"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+($BORDER))),$(($TITLE+$BORDERY+$TOP+($HEIGHT/2-($TITLE/2+$BORDERY)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDERY)))"
    else #GNOME
        echo ""
        echo "------------------------"
        echo "Assuming GNOME, Correct?"
        echo "------------------------"
        WIDTH=$((`xwininfo -id $WINDOWID | grep 'Width:' | cut -f 2 -d ':'`))
        HEIGHT=$((`xwininfo -id $WINDOWID | grep 'Height:' | cut -f 2 -d ':'`))
    
        wmctrl -r :ACTIVE: -e 0,0,$TOP,$WIDTH,$(($HEIGHT-2*$BOTTOM))
        sleep 1
        TITLE=$(((`xwininfo -id $WINDOWID | grep 'Absolute upper-left Y:' | cut -f 2 -d ':'`)-$TOP-$BORDER))
        TOP=$(($TOP-$TITLE))
        
        echo ""
        echo "Below are the wmctrl commands for GNOME (Ubuntu)."
        echo "The Key Bindings (keyboard shortcuts)"
        echo "or Edge Bindings (like Aero Snap) can be set under:"
        echo "System -> Prefences -> CompizConfig Settings Manager ->"
        echo "Commands -> Commands/Key Bindings/Edge Bindings"
        echo ""
        echo "Centre       <Control><Alt>KP_5:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(($TITLE+$TOP)),$WIDTH,$HEIGHT"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$HEIGHT"
        echo ""
        echo "Left         <Control><Alt>KP_4:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(($TITLE+$TOP)),$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo ""
        echo "Right        <Control><Alt>KP_6:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),$(($TITLE+$TOP)),$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),0,$(($WIDTH/2-$BORDER)),$HEIGHT"
        echo ""
        echo "Top          <Control><Alt>KP_8:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(($TITLE+$TOP)),$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "Bottom       <Control><Alt>KP_2:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$WIDTH,$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "Top Left     <Control><Alt>KP_7:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(($TITLE+$TOP)),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,0,$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "Top Right    <Control><Alt>KP_9:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),$(($TITLE+$TOP)),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),0,$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "Bottom Left  <Control><Alt>KP_1:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$BORDER,$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,0,$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "Bottum Right <Control><Alt>KP_3:"
        #echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo "wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 0,$(($WIDTH/2+(2*$BORDER))),$(((2*($TITLE+$BORDER))+$TOP+($HEIGHT/2-($TITLE/2+$BORDER)))),$(($WIDTH/2-$BORDER)),$(($HEIGHT/2-($TITLE/2+$BORDER)))"
        echo ""
        echo "TIP: For GNOME (Ubuntu) Key Bindings use Compiz Grid instead. Go to:"
        echo "     System -> Prefences -> CompizConfig Settings Manager ->"
        echo "     Window Management -> Grid"
    fi
    
    wmctrl -r :ACTIVE: -e 0,0,0,$WIDTH,$HEIGHT
    
    echo ""
    echo "Current used values:"
    echo "border: $BORDER pixels"
    if [ $TOP -eq 0 ]
    then #KDE
        echo "bordery: $BORDERY pixels"
    fi
    echo "width:  $WIDTH pixels"
    echo "height: $HEIGHT pixels"
    echo "bottom: $BOTTOM pixels"
    echo "top:    $TOP pixels"
    echo "title:  $TITLE pixels"

Page 2 of 16 FirstFirst 123412 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •