Skip to content

Commit

Permalink
Slightly refactored togglecaps script.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricobl committed Sep 13, 2010
1 parent 45626db commit be42d28
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/togglecaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@

CAPS = 66

vk = virtkey()
state_toggles = {
'on': 'lock_mod',
'off': 'unlock_mod',
'on': vk.lock_mod,
'off': vk.unlock_mod,
}

if len(sys.argv) <= 1:
raise SystemExit

state = sys.argv[1]

if state not in state_toggles.keys():
raise SystemExit

vk = virtkey()
toggle = getattr(vk, state_toggles[state])
toggle = state_toggles[state]
toggle(CAPS)

0 comments on commit be42d28

Please sign in to comment.