summarylogtreecommitdiffstats
path: root/keyboard_led_toggle.sh
blob: b8f5efa9ef44a44fa77f31a0e48c6320c3edde80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
#
# This script checks and toggles the backlight status of a CoolMaster Devistator
# LED keyboard
#
# - GI_Jack -  License: GPLv3
declare FLAGS
# get status of LED as a series of flags. the last set of numbers tends to vary
# with caps and numlock set. scroll lock is locked to the LED key and won't
# toggle normally. It will only toggle with the LEDs set with xset.
FLAGS=$(xset -q | awk 'NR==2{print $10}')
case $FLAGS in
  0000?00?)
    xset led on
    exit $?
    ;;
  ffffe7f?)
    xset led off
    exit $?
    ;;
esac