jhs*_*jhs 4 keyboard automation
我白天交替使用 Unicomp clicky 键盘,晚上交替使用 Apple 蓝牙键盘。
Apple 键盘物理交换Alt和Windows键。我该如何应对?
此外,由于我每天切换键盘两次,我该如何简化流程。
这是在 Ubuntu 10.04 上。
我已将此添加到我的.bashrc
:
# Output the gconf settings for enabled or disabled keyboard swapping based on whether the argument is "apple"
setting_for_alt_key () {
gconftool --get /desktop/gnome/peripherals/keyboard/kbd/options \
| ruby -e 'set = {}; STDIN.gets.strip.gsub(/\]|\[/, "").split(",").each{|x| set[x]=1}; set["altwin\taltwin:swap_lalt_lwin"]=1; STDOUT.write "[" + set.keys.select{|x| ARGV[0] == "apple" || x !~ /swap_lalt/ }.join(",") + "]"' \
"$1"
}
kmac () { gconftool --set --type=list --list-type=string /desktop/gnome/peripherals/keyboard/kbd/options "$(setting_for_alt_key apple)"; }
kpc () { gconftool --set --type=list --list-type=string /desktop/gnome/peripherals/keyboard/kbd/options "$(setting_for_alt_key)"; }
Run Code Online (Sandbox Code Playgroud)
然后当我激活 Apple 键盘时,我kmac
在终端上输入。当我停用它时,我输入kpc
. 到目前为止,我还无法证明自动检测是合理的。
(此外,如果有人有更好的 Gconf 工作方式,无论是使用gconftool-2
语言绑定还是语言绑定,我都希望听到。)
归档时间: |
|
查看次数: |
1339 次 |
最近记录: |