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)
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
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)
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