def toemptygroup(): QTILE_CLIENT = Client() empty_groups = [grp for grp in QTILE_CLIENT.groups().keys() if len(QTILE_CLIENT.groups()[grp]['windows']) == 0] if len(empty_groups) == 0: return QTILE_CLIENT.screen.toggle_group(empty_groups[0])
def ontop(title): c = Client() if title is None: title = c.group.window.info()['name'] print(title) with open(PATH, 'w+') as f_obj: f_obj.write(title) wid = [(w['id'], w['group']) for w in c.windows() if title == w['name']] if len(wid) == 0: os.remove(PATH) return c.window[wid[0][0]].bring_to_front() c.window[wid[0][0]].togroup() # This code runs only when the current group is changed, so that # correct window is focused instead of mpv window prv_grp = wid[0][1] cur_grp = c.group.info()['name'] focusHistory = c.groups()[c.group.info()['name']]['focusHistory'] if focusHistory[-1] == title and cur_grp != prv_grp: last_wid = [ w['id'] for w in c.windows() if w['name'] == focusHistory[-2] and w['group'] == cur_grp ][0] c.window[last_wid].focus()
def __init__(self, watcher_name, widget_name, sleep_interval, update_child): self.watcher_name = watcher_name self.widget_name = widget_name self.sleep_interval = sleep_interval self.update_child = update_child self.watch_file = "{}/{}_{}".format(self.WATCHER_TMP_DIR, self.WATCHER_TMP_PREFIX, watcher_name) self.qtile_client = Client()
def get_object(argv): """ Constructs a path to object and returns given object (if it exists). """ client = Client() obj = client if argv[0] == "cmd": argv = argv[1:] # Generate full obj specification for arg in argv: try: obj = obj[arg] # check if it is an item except KeyError: try: obj = getattr(obj, arg) # check it it is an attr except AttributeError: print("Specified object does not exist " + " ".join(argv)) exit() return obj
from libqtile.command import Client c = Client() c.widget["keyboardlayout"].next_keyboard()
#!/usr/bin/env python from libqtile.command import Client import subprocess import re # connect to Qtile c = Client() # get info of windows wins = [] id_map = {} id = 0 for win in c.windows(): if win["group"]: wins.append(bytes("%i: %s (%s)" % (id, win["name"], win["group"]), 'utf-8')) id_map[id] = { 'id' : win['id'], 'group' : win['group'] } id = id +1 # call dmenu DMENU='dmenu -i -b -p ">>>" -nb #000 -nf #fff -sb #00BF32 -sf #fff' p = subprocess.Popen(DMENU.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) out = p.communicate(b"\n".join(wins))[0] # get selected window info id = int(re.match(b"^\d+", out).group()) win = id_map[id]
#!/usr/bin/env python from libqtile.command import Client import subprocess import re # connect to Qtile c = Client() # get info of windows wins = [] id_map = {} id = 0 for win in c.windows(): if win["group"]: wins.append( bytes("%i: %s (%s)" % (id, win["name"], win["group"]), 'utf-8')) id_map[id] = {'id': win['id'], 'group': win['group']} id = id + 1 # call dmenu DMENU = 'dmenu -i -b -p ">>>" -nb #000 -nf #fff -sb #00BF32 -sf #fff' p = subprocess.Popen(DMENU.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) out = p.communicate(b"\n".join(wins))[0] # get selected window info id = int(re.match(b"^\d+", out).group()) win = id_map[id]
'sublime3': "IDE", 'skype': "messangers", 'libreoffice': "docs", 'nemo': "FileBrowse", 'krusader': "FileBrowse", 'texworks': "docs", }): windowtype = window.window.get_wm_class()[0] if windowtype in windows.keys(): window.togroup(windows[windowtype]) from copy import deepcopy, copy client = Client() last_window = str() def get_name_window(window): #print window.name global last_window if window.name == None or window.name == '': display = Xlib.display.Display() window = display.get_input_focus().focus wmname = window.get_wm_name() wmclass = window.get_wm_class() if wmclass is None and wmname is None: window = window.query_tree().parent wmname = window.get_wm_name() last_window = wmname
#!/usr/bin/python from libqtile.command import Client from inspect import getmembers from pprint import pprint from var_dump import var_dump c = Client() for i in c.windows(): # var_dump(i) if (i['name'].startswith('Microsoft Excel' )) : c.window[ i['id'] ].group.toscreen() c.window[ i['id'] ].bring_to_front() c.window[ i['id'] ].disable_floating()
#!/usr/bin/env python3 # This script will logout from qtile # found here: # https://github.com/qtile/qtile-examples/blob/master/mort65/bin/qtile-logoff from libqtile.command import Client import getpass import subprocess try: client = Client() client.shutdown() except: subprocess.Popen(["loginctl", "terminate-user", getpass.getuser()])