Esempio n. 1
0
"""
A couple of functions that support retrieving information about
all active physical heads. This is done through the Xinerama
extension, which implicitly supports RandR and TwinView.

The 'get_physical_mapping' function will produce a list of
monitor indices in a physical ordering (left to right, top to
bottom). These indices can then be used in the list returned by
'get_monitors'.
"""
import xcb.xinerama

from xpybutil import conn

ext = conn(xcb.xinerama.key)


def get_monitors():
    """
    Returns a list of Xinerama screen rectangles.
    They come in the order that the Xinerama extension specifies.

    :rtype: List of (x, y, w, h) rectangles
    """
    retval = []
    ms = ext.QueryScreens().reply()
    if ms:
        for m in ms.screen_info:
            retval.append((m.x_org, m.y_org, m.width, m.height))

    return retval
Esempio n. 2
0
A couple of functions that support retrieving information about
all active physical heads. This is done through the Xinerama
extension, which implicitly supports RandR and TwinView.

The 'get_physical_mapping' function will produce a list of
monitor indices in a physical ordering (left to right, top to
bottom). These indices can then be used in the list returned by
'get_monitors'.
"""
from xpybutil.compat import xinerama

from xpybutil import conn

ext = None
if conn is not None:
    ext = conn(xinerama.key)


def get_monitors():
    """
    Returns a list of Xinerama screen rectangles.
    They come in the order that the Xinerama extension specifies.

    :rtype: List of (x, y, w, h) rectangles
    """
    retval = []
    ms = ext.QueryScreens().reply()
    if ms:
        for m in ms.screen_info:
            retval.append((m.x_org, m.y_org, m.width, m.height))
Esempio n. 3
0
    w = ewmh.get_supporting_wm_check(xpybutil.root).reply()
    if w:
        childw = ewmh.get_supporting_wm_check(w).reply()
        if childw == w:
            wmrunning = True
            wmname = ewmh.get_wm_name(childw).reply()
            print '%s window manager is running...' % wmname
            sys.stdout.flush()

    if not wmrunning:
        time.sleep(1)

import config
from keymousebind import keybinds

xinerama = xpybutil.conn(xinerama.key)

gtk_display = gtk.gdk.display_get_default()
gtk_screen = gtk_display.get_default_screen()
gtk_root = gtk_screen.get_root_window()
gtk_rootwin = gtk.Invisible()

gtk_root.set_user_data(gtk_rootwin)
gtk_root.set_events(gtk.gdk.PROPERTY_CHANGE_MASK | gtk.gdk.KEY_PRESS_MASK)

# Initial setup
if config.desktops:
    ewmh.set_desktop_names_checked(config.desktops).check()
    ewmh.set_desktop_layout_checked(ewmh.Orientation.Horz, 
                                    len(config.desktops), 1, 
                                    ewmh.StartingCorner.TopLeft).check()
Esempio n. 4
0
    w = ewmh.get_supporting_wm_check(xpybutil.root).reply()
    if w:
        childw = ewmh.get_supporting_wm_check(w).reply()
        if childw == w:
            wmrunning = True
            wmname = ewmh.get_wm_name(childw).reply()
            print '%s window manager is running...' % wmname
            sys.stdout.flush()

    if not wmrunning:
        time.sleep(1)

import config
from keymousebind import keybinds

xinerama = xpybutil.conn(xinerama.key)

gtk_display = gtk.gdk.display_get_default()
gtk_screen = gtk_display.get_default_screen()
gtk_root = gtk_screen.get_root_window()
gtk_rootwin = gtk.Invisible()

gtk_root.set_user_data(gtk_rootwin)
gtk_root.set_events(gtk.gdk.PROPERTY_CHANGE_MASK | gtk.gdk.KEY_PRESS_MASK)

# Initial setup
if config.desktops:
    ewmh.set_desktop_names_checked(config.desktops).check()
    ewmh.set_desktop_layout_checked(ewmh.Orientation.Horz,
                                    len(config.desktops), 1,
                                    ewmh.StartingCorner.TopLeft).check()
Esempio n. 5
0
A couple of functions that support retrieving information about
all active physical heads. This is done through the Xinerama
extension, which implicitly supports RandR and TwinView.

The 'get_physical_mapping' function will produce a list of
monitor indices in a physical ordering (left to right, top to
bottom). These indices can then be used in the list returned by
'get_monitors'.
"""
from xpybutil.compat import xinerama

from xpybutil import conn

ext = None
if conn is not None:
    ext = conn(xinerama.key)

def get_monitors():
    '''
    Returns a list of Xinerama screen rectangles.
    They come in the order that the Xinerama extension specifies.

    :rtype: List of (x, y, w, h) rectangles
    '''
    retval = []
    ms = ext.QueryScreens().reply()
    if ms:
        for m in ms.screen_info:
            retval.append((m.x_org, m.y_org, m.width, m.height))

    return retval
Esempio n. 6
0
A couple of functions that support retrieving information about
all active physical heads. This is done through the Xinerama
extension, which implicitly supports RandR and TwinView.

The 'get_physical_mapping' function will produce a list of
monitor indices in a physical ordering (left to right, top to
bottom). These indices can then be used in the list returned by
'get_monitors'.
"""
import xcb.xinerama

from xpybutil import conn

ext = None
if conn is not None:
    ext = conn(xcb.xinerama.key)


def get_monitors():
    '''
    Returns a list of Xinerama screen rectangles.
    They come in the order that the Xinerama extension specifies.

    :rtype: List of (x, y, w, h) rectangles
    '''
    retval = []
    ms = ext.QueryScreens().reply()
    if ms:
        for m in ms.screen_info:
            retval.append((m.x_org, m.y_org, m.width, m.height))