刚刚从淘宝上买回一个带有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)
# ORGANIZATION:
# CREATED: 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背光了。