Results 1 to 7 of 7

Thread: Gnome Shell Move window to other monitor shortcut

  1. #1
    Join Date
    Dec 2008
    Location
    UK
    Beans
    19
    Distro
    Ubuntu 11.04 Natty Narwhal

    Talking Gnome Shell Move window to other monitor shortcut

    Hi,

    I am running Gnome Shell (3.3) on my 11.10 version of ubuntu with Dual Monitors, my question is:
    Is there a keyboard shortcut to move a window from one monitor to the other?

    I couldn't see it in the list of shortcuts, is there an application that could do this for me?

    Cheers

  2. #2
    Join Date
    Apr 2012
    Location
    Darkstar
    Beans
    348

    Re: Gnome Shell Move window to other monitor shortcut

    I thought you could just drag it. No?

  3. #3
    Join Date
    Jun 2006
    Location
    Brisbane Australia
    Beans
    713

    Re: Gnome Shell Move window to other monitor shortcut

    Quote Originally Posted by irvingswiftj86 View Post
    I couldn't see it in the list of shortcuts, is there an application that could do this for me?
    If you are a programmer then it would not be hard to modify https://github.com/paulswartz/gnome-shell-grid to do what you want.

  4. #4
    Join Date
    Dec 2008
    Location
    UK
    Beans
    19
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Gnome Shell Move window to other monitor shortcut

    codingman: Any excuse not to use the mouse! I like to use it as little as possible.

    markbl: That is fantastic, I will have a crack at that.

  5. #5
    Join Date
    Dec 2012
    Beans
    1

    Re: Gnome Shell Move window to other monitor shortcut

    Following is a crude hack of the above script. It removes some code I don't need, but it is less elegant and less correct. It assumes 2 monitors aligned horizontally with the same horizontal resolution. Works for me for gnome-shell, might not work for you.

    Code:
    #!/usr/bin/env python
    import Xlib.display, gtk
    from Xlib import X, XK
    import wnck
    
    # Ctrl-Alt-Shift
    KEY_MODIFIER_MASK = X.Mod1Mask | X.ControlMask | X.ShiftMask 
    
    display = Xlib.display.Display()
    root = display.screen().root
    root.change_attributes(event_mask = X.KeyReleaseMask)
    screen = wnck.screen_get_default()
    screen.force_update()
    
    # register keys and modifiers
    for keysym in [XK.XK_Right, XK.XK_Left]:
        root.grab_key(display.keysym_to_keycode(keysym), KEY_MODIFIER_MASK, 
                True, X.GrabModeAsync, X.GrabModeAsync)
    
    while True:
        # Needed for correct window selection
        while gtk.events_pending():
            gtk.main_iteration()
        event = root.display.next_event()
        if event.type == X.KeyRelease:
            win = screen.get_active_window()
            x, y, w, h = pos = win.get_geometry()
            keysym = display.keycode_to_keysym(event.detail, 0)
            if keysym == XK.XK_Right:
                if x+screen.get_width()/2 < screen.get_width():
                    x += screen.get_width()/2
            elif keysym == XK.XK_Left:
                if x-screen.get_width()/2 >= 0:
                    x -= screen.get_width()/2
            else:
                continue
            win.set_geometry(0, 3, x-4, y-25, w, h)

  6. #6
    Join Date
    May 2006
    Beans
    34

    Re: Gnome Shell Move window to other monitor shortcut

    This extension perfectly solves the problem:
    https://extensions.gnome.org/extension/39/put-windows/

  7. #7
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: Gnome Shell Move window to other monitor shortcut

    Old thread closed.

Tags for this Thread

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
  •