Esempio n. 1
0
def qshell(args) -> None:
    if args.socket is None:
        socket = ipc.find_sockfile()
    else:
        socket = args.socket
    client = ipc.Client(socket, is_json=args.is_json)
    cmd_object = interface.IPCCommandInterface(client)
    qsh = sh.QSh(cmd_object)
    if args.command is not None:
        qsh.process_line(args.command)
    else:
        qsh.loop()
Esempio n. 2
0
def main() -> None:
    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()

    if args.socket is None:
        socket = ipc.find_sockfile()
    else:
        socket = args.socket
    client = ipc.Client(socket, is_json=args.is_json)
    cmd_object = command_interface.IPCCommandInterface(client)
    qsh = sh.QSh(cmd_object)
    if args.pyfile is None:
        if args.command is not None:
            qsh.process_line(args.command)
        else:
            qsh.loop()
    else:
        print(qsh.process_line("run_external({})".format(args.pyfile)))
Esempio n. 3
0
def qshell(args) -> None:
    if args.socket is None:
        socket = ipc.find_sockfile()
    else:
        socket = args.socket
    client = ipc.Client(socket, is_json=args.is_json)
    cmd_object = command_interface.IPCCommandInterface(client)
    qsh = sh.QSh(cmd_object)
    if args.pyfile is None:
        if args.command is not None:
            qsh.process_line(args.command)
        else:
            qsh.loop()
    else:
        print(qsh.process_line("run_external({})".format(args.pyfile)))
Esempio n. 4
0
File: qsh.py Progetto: nicoe/qtile
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 qsh 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))
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     socket_path = ipc.find_sockfile()
     ipc_client = ipc.Client(socket_path)
     cmd_object = command.interface.IPCCommandInterface(ipc_client)
     self.qsh = sh.QSh(cmd_object)
Esempio n. 6
0
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self.client = command.Client()
     self.qsh = sh.QSh(self.client)