剛剛從淘寶上買回一個帶有Led背光的鍵盤(黑爵戰神x5 背光升級版);
然后發現在Linux中背光燈並不亮,在Windows中就可以按下Scroll Lock鍵點亮;
在網上探索了一番,覺得應該可以使用xset和設定快捷鍵來實現Scroll Lock鍵點亮和熄滅Led燈;
1. 編輯腳本:~/bin/ledctrl
#!/bin/bash - #=============================================================================== # # FILE: ledctrl # # USAGE: ./ledctrl # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: linkscue (scue), linkscue@gmail.com # ORGANIZATION: # CREATED: 2014年02月13日 13時16分55秒 CST # REVISION: --- #=============================================================================== status=/tmp/keyboard_led_status if [[ ${1} == "on" ]] || [[ ! -e ${status} ]]; then xset led named 'Scroll Lock' && echo "on" > ${status} else xset -led named 'Scroll Lock' && rm -f ${status} fi
chmod a+x ~/bin/ledctrl
2. 在XUbuntu 13.10中設置Scroll Lock鍵調用這個腳本:
依次打開 Setttings -- Keyboard -- Application Shortcuts -- Add -- 輸入“~/bin/ledctrl” -- OK -- 按下“Scroll Lock”鍵。
之后,就可以通過按下Scroll Lock鍵來打開和關閉鍵盤的Led背光了。