Ejemplo n.º 1
0
def set(targets, prop, value):
    if SIMULATE:
        return

    print 'active targets:', get_active_targets().intersection(targets)

    for target in get_active_targets().intersection(targets):
        print 'xsetwacom: %s=%r on %s' % (prop, value, target)
        xsetwacom.set(target, prop, value)
Ejemplo n.º 2
0
def set(targets, prop, value):
    if SIMULATE:
        return

    print 'active targets:', get_active_targets().intersection(targets)

    for target in get_active_targets().intersection(targets):
        print 'xsetwacom: %s=%r on %s' % (prop, value, target)
        xsetwacom.set(target, prop, value)
Ejemplo n.º 3
0
def toggle(targets, prop, **mappings):
    if not mappings:
        mappings = {'on': 'off', 'off': 'on', '0': '1', '1': '0'}

    for target in get_active_targets().intersection(targets):
        old = str(xsetwacom.get(target, prop)).strip()
        if old in mappings:
            xsetwacom.set(target, prop, mappings[old])
        else:
            print "WARN: unknown value to toggle:", old
Ejemplo n.º 4
0
def set_button(button, action):
    if isinstance(action, Callable):
        _action_map[button] = action
        action = 'key +ctrl +super +shift +alt %d -alt -shift -super -ctrl' % button

    if SIMULATE:
        return

    for target in get_active_targets().intersection(pad):
        print 'xsetwacom: button %d="%s" on %s' % (button, action, target)
        xsetwacom.set(target, 'Button', button, action)
Ejemplo n.º 5
0
def set_button(button, action):
    if isinstance(action, Callable):
        _action_map[button] = action
        action = 'key +ctrl +super +shift +alt %d -alt -shift -super -ctrl' % button

    if SIMULATE:
        return

    for target in get_active_targets().intersection(pad):
        print 'xsetwacom: button %d="%s" on %s' % (button, action, target)
        xsetwacom.set(target, 'Button', button, action)
Ejemplo n.º 6
0
def toggle(targets, prop, **mappings):
    if not mappings:
        mappings = {
            'on': 'off',
            'off': 'on',
            '0': '1',
            '1': '0'
        }

    for target in get_active_targets().intersection(targets):
        old = str(xsetwacom.get(target, prop)).strip()
        if old in mappings:
            xsetwacom.set(target, prop, mappings[old])
        else:
            print "WARN: unknown value to toggle:", old