Ejemplo n.º 1
0
def set_or_add_desktop(name):
    names = ewmh.get_desktop_names().reply()

    if name not in names:
        names.append(name)
        ewmh.set_desktop_names_checked(names).check()
        num_desks = ewmh.get_number_of_desktops().reply()
        ewmh.request_number_of_desktops_checked(num_desks + 1).check()

    ewmh.request_current_desktop_checked(names.index(name)).check()
Ejemplo n.º 2
0
def set_or_add_desktop(name):
    names = ewmh.get_desktop_names().reply()

    if name not in names:
        names.append(name)
        ewmh.set_desktop_names_checked(names).check()
        num_desks = ewmh.get_number_of_desktops().reply()
        ewmh.request_number_of_desktops_checked(num_desks + 1).check()

    ewmh.request_current_desktop_checked(names.index(name)).check()
Ejemplo n.º 3
0
def goto_window(win_name_or_id):
    wid = win_name_or_id
    if isinstance(wid, basestring):
        clients = ewmh.get_client_list().reply()
        for c in clients:
            if wid == ewmh.get_wm_name(c).reply():
                wid = c
                break

    if isinstance(wid, int):
        wdesk = ewmh.get_wm_desktop(wid).reply()
        if wdesk not in ewmh.get_visible_desktops().reply():
            ewmh.request_current_desktop_checked(wdesk).check()
        ewmh.request_active_window_checked(wid, source=2).check()
Ejemplo n.º 4
0
def goto_window(win_name_or_id):
    wid = win_name_or_id
    if isinstance(wid, basestring):
        clients = ewmh.get_client_list().reply()
        for c in clients:
            if wid == ewmh.get_wm_name(c).reply():
                wid = c
                break

    if isinstance(wid, int):
        wdesk = ewmh.get_wm_desktop(wid).reply()
        if wdesk not in ewmh.get_visible_desktops().reply():
            ewmh.request_current_desktop_checked(wdesk).check()
        ewmh.request_active_window_checked(wid, source=2).check()
Ejemplo n.º 5
0
def do_goto_window(letter):
    if letter not in marked:
        print("mark %s does not exist" % letter, file=sys.stderr)
        return

    wid = marked[letter]
    try:
        wdesk = ewmh.get_wm_desktop(wid).reply()
        desktop = ewmh.get_current_desktop().reply()
        visibles = ewmh.get_visible_desktops().reply() or [desktop]

        if wdesk is not None and wdesk not in visibles:
            ewmh.request_current_desktop_checked(wdesk).check()
        ewmh.request_active_window_checked(wid, source=1).check()
    except xproto.BadWindow:
        print("%d no longer exists" % wid, file=sys.stderr)
Ejemplo n.º 6
0
def do_goto_window(letter):
    if letter not in marked:
        print >> sys.stderr, 'mark %s does not exist' % letter
        return

    wid = marked[letter]
    try:
        wdesk = ewmh.get_wm_desktop(wid).reply()
        desktop = ewmh.get_current_desktop().reply()
        visibles = ewmh.get_visible_desktops().reply() or [desktop]

        if wdesk is not None and wdesk not in visibles:
            ewmh.request_current_desktop_checked(wdesk).check()
        ewmh.request_active_window_checked(wid, source=1).check()
    except xcb.xproto.BadWindow:
        print >> sys.stderr, '%d no longer exists' % wid
Ejemplo n.º 7
0
def setCurrentDesktop(desktop=None):
    ensureArguments(desktop)
    desktop = int(desktop)
    ewmh.request_current_desktop_checked(desktop).check()
Ejemplo n.º 8
0
#!/usr/bin/python3

# "Helper for setting current desktop's name"
# pip install xcffib xpybutil

import sys

from xpybutil import conn, root
import xpybutil.ewmh as ewmh
if len(sys.argv) != 2:
    print("Invalid argument")
    sys.exit(1)
num = int(sys.argv[1])
print("Switching to ws", num)
ewmh.request_current_desktop_checked(num).check()
Ejemplo n.º 9
0
def setCurrentDesktop(desktop=None):
    ensureArguments(desktop)
    desktop = int(desktop)
    ewmh.request_current_desktop_checked(desktop).check()
Ejemplo n.º 10
0
def set_desktop(i_or_name):
    nextdesk = get_desk(i_or_name)
    if nextdesk is not None:
        ewmh.request_current_desktop_checked(nextdesk).check()
Ejemplo n.º 11
0
def desktop_clicked(desktop):
    ewmh.request_current_desktop_checked(desktop.desk).check()
Ejemplo n.º 12
0
def set_desktop(i_or_name):
    nextdesk = get_desk(i_or_name)
    if nextdesk is not None:
        ewmh.request_current_desktop_checked(nextdesk).check()
Ejemplo n.º 13
0
def desktop_clicked(desktop):
    ewmh.request_current_desktop_checked(desktop.desk).check()