Exemplo n.º 1
0
def call_xinput(device, setup):
    set_mode = ["xinput", "set-mode"]
    set_prop = ["xinput", "set-prop"]
    try:
        for obj in device:
            if not obj.get_name().startswith("Virtual core XTEST"):
                nick = obj.get_source().value_nick
                matrix, mode, prop = setup.get(nick, (False, False, tuple()))
                xid = [str(GdkX11.gdk_x11_device_get_id(obj))]
                if matrix:
                    subprocess.call(set_prop + xid + matrix)
                    subprocess.call(set_mode + xid + mode)
                for param in prop:
                    subprocess.call(set_prop + xid + param)
    except OSError:
        sys.exit("cannot find xinput program")
Exemplo n.º 2
0
 def print_device(self, manager, device):
     xid = GdkX11.gdk_x11_device_get_id(device)
     print xid, device.get_source().value_nick + ':', device.get_name()