コード例 #1
0
ファイル: state.py プロジェクト: Excedrin/pytyle2
def update_NET_DESKTOP_GEOMETRY(force=False):
    global properties, xinerama

    old_geom = properties["_NET_DESKTOP_GEOMETRY"]
    old_xinerama = xinerama

    time.sleep(1)

    properties["_NET_DESKTOP_GEOMETRY"] = ptxcb.XROOT.get_desktop_geometry()
    xinerama = ptxcb.connection.xinerama_get_screens()

    if old_xinerama != xinerama or force:
        if not force and len(old_xinerama) == len(xinerama):
            for mon in Workspace.iter_all_monitors():
                mid = mon.id
                mon.refresh_bounds(
                    xinerama[mid]["x"], xinerama[mid]["y"], xinerama[mid]["width"], xinerama[mid]["height"]
                )
                mon.calculate_workarea()
        else:
            for mon in Workspace.iter_all_monitors():
                for tiler in mon.tilers:
                    tiler.destroy()

            for wid in Window.WINDOWS.keys():
                Window.remove(wid)

            for wsid in Workspace.WORKSPACES.keys():
                Monitor.remove(wsid)
                Workspace.remove(wsid)

            reset_properties()
            load_properties()
コード例 #2
0
ファイル: state.py プロジェクト: Excedrin/pytyle2
def update_NET_NUMBER_OF_DESKTOPS():
    global properties, xinerama

    old = properties["_NET_NUMBER_OF_DESKTOPS"]
    properties["_NET_NUMBER_OF_DESKTOPS"] = ptxcb.XROOT.get_number_of_desktops()

    # Add destops...
    if old < properties["_NET_NUMBER_OF_DESKTOPS"]:
        for wsid in xrange(old, properties["_NET_NUMBER_OF_DESKTOPS"]):
            Workspace.add(wsid)
            Monitor.add(wsid, xinerama)

    # Remove desktops
    elif old > properties["_NET_NUMBER_OF_DESKTOPS"]:
        for wsid in xrange(properties["_NET_NUMBER_OF_DESKTOPS"], old):
            Monitor.remove(wsid)
            Workspace.remove(wsid)