def main(): opts = parse_args() lines = opts.lines seconds = opts.seconds force_start = opts.force_start client = command.Client(opts.socket) try: if not opts.raw: curses.wrapper(get_stats, client, limit=lines, seconds=seconds, force_start=force_start) else: raw_stats(client, limit=lines, force_start=force_start) except TraceNotStarted: print("tracemalloc not started on qtile, start by setting " "PYTHONTRACEMALLOC=1 before starting qtile") print("or force start tracemalloc now, but you'll lose early traces") exit(1) except TraceCantStart: print("Can't start tracemalloc on qtile, check the logs") except KeyboardInterrupt: exit(-1)
def qtile_reload_barcolor(color): c = command.Client() q = QSh(c) q.do_cd("bar") q.do_cd("top") print("set color:{}".format(color)) cmd = "eval(\"self.background=\'{0}\'\")".format(color) q.process_command(cmd) return True
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument( '--version', action='version', version='%(prog)s 0.3', ) parser.add_argument("-s", "--socket", action="store", type=str, default=None, help='Use specified socket to connect to qtile.') parser.add_argument( "-r", "--run", action="store", type=str, default=None, dest="pyfile", help='The full path to python file with the \"main\" function to call.' ) parser.add_argument("-c", "--command", action="store", type=str, default=None, help='Run the specified qshell command and exit.') parser.add_argument( "-j", "--json", action="store_true", default=False, dest="is_json", help='Use json in order to communicate with qtile server.') args = parser.parse_args() client = command.Client(args.socket, is_json=args.is_json) if args.pyfile is None: qsh = sh.QSh(client) if args.command is not None: qsh.process_command(args.command) else: qsh.loop() else: print(client.run_external(args.pyfile))
def main(): opts = parse_args() client = command.Client(opts.socket) proc = subprocess.Popen(opts.cmd) match_args = {"net_wm_pid": [proc.pid]} rule_args = { "float": opts.floating, "intrusive": opts.intrusive, "group": opts.group, "break_on_match": not opts.dont_break } rule_id = client.add_rule(match_args, rule_args) atexit.register(lambda: client.remove_rule(rule_id)) proc.wait()
#!/usr/bin/env python from libqtile import command import os lazy = command.Client() lazy.addgroup("socks") lazy.group["socks"].toscreen() os.system("urxvt -vb -rv +sb -fn 'xft:Anonymous Pro:pixelsize=18' -e bash -c '~/.bin/proxy.sh dave.tycho.ws'")
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.client = command.Client() self.qsh = sh.QSh(self.client)