Exemplo n.º 1
0
def notify_send(title, message=None):
    try:
        msg = get_msg(title, message)
        logger.info("NOTIFY-SEND: %s", msg)
        procutil.call(['notify-send', msg])
    except proctuil.WrappedCalledProcessError:
        logger.exception("notify-osd failed")
Exemplo n.º 2
0
def raise_window(hex_code):
    try:
        procutil.call(['wmctrl', '-i', '-a', hex_code])
        return True
    except procutil.WrappedCalledProcessError:
        logger.exception("Couldn't raise the input window...")
        return False
Exemplo n.º 3
0
def notify_send(title, message=None):
    try:
        msg = get_msg(title, message)
        logger.info("NOTIFY-SEND: %s", msg)
        procutil.call(['notify-send', msg])
    except proctuil.WrappedCalledProcessError:
        logger.exception("notify-osd failed")
Exemplo n.º 4
0
def raise_window(hex_code):
    try:
        procutil.call(['wmctrl', '-i', '-a', hex_code])
        return True
    except procutil.WrappedCalledProcessError:
        logger.exception("Couldn't raise the input window...")
        return False
Exemplo n.º 5
0
def name_from_pid(pid):
    """
    E.g.
    ps -p 23827 -o comm= 
    """
    name = procutil.call(['ps', '-p', str(pid), '-o', 'comm='])
    return name
Exemplo n.º 6
0
def name_from_pid(pid): 
    """
    E.g.
    ps -p 23827 -o comm= 
    """
    name = procutil.call(['ps', '-p', str(pid), '-o', 'comm='])
    return name
Exemplo n.º 7
0
def send_dbus(service, path, method, args=[], qdbus_args=[]):
    """
    So basically, I can't figure out threading with dbus in python, so just invoke qdbus command line program instead to send a reply...

    qdbus im.pidgin.purple.PurpleService /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleConvIm $conversation
    qdbus im.pidgin.purple.PurpleService /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleConvImSend $convIMResult 'hello world'
    """
    def stringify(xs):
        return [str(x) for x in xs]

    cmd = ["qdbus"] + stringify(qdbus_args) + [service, path, method] + stringify(args) 
    return procutil.call(cmd)
Exemplo n.º 8
0
def send_dbus(service, path, method, args=[], qdbus_args=[]):
    """
    So basically, I can't figure out threading with dbus in python, so just invoke qdbus command line program instead to send a reply...

    qdbus im.pidgin.purple.PurpleService /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleConvIm $conversation
    qdbus im.pidgin.purple.PurpleService /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleConvImSend $convIMResult 'hello world'
    """
    def stringify(xs):
        return [str(x) for x in xs]

    cmd = ["qdbus"] + stringify(qdbus_args) + [service, path, method
                                               ] + stringify(args)
    return procutil.call(cmd)