有馬総一郎のブログ

(彼氏の事情)

2014年05月19日 23:56:00 JST - 3 minute read - Comments - Linux

ChromebookでショートカットをUbuntuでも有効にする。

Ubuntu 14.04

Ubuntuをインストールできて、めでたし、めでたしなわけだが、キーボードの最上部にあるF1からF10は当然ながら、Chromebookで作動したどおりに動かない。

以下のような素晴らしいサイトがあった。 Acer C720 Chromebook (日本語) - ArchWiki

基本、上記サイト通りに。

xbindkeys、xbindkeysをインストール(元から入ってたかな?)

~/.xbindkeysrc ファイルを作成

中身は以下の通り

~/.xbindkeysrc

# For the benefit of emacs users: -*- shell-script -*-
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.8.6
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey' and put one of the two lines in this file.
#
# The format of a command line is:
#    "command to start"
#       associated key
#
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier:
#   Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#   Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#

# The release modifier is not a standard X modifier, but you can
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers
# NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.

#keystate_numlock = enable
#keystate_capslock = enable
#keystate_scrolllock= enable

# Examples of commands:

"xbindkeys_show" 
  control+shift + q

# set directly keycode (here control + f with my keyboard)
#"xterm"
#  c:41 + m:0x4

# specify a mouse button
#"xterm"
#  control + b:2

#"xterm -geom 50x20+20+20"
#   Shift+Mod2+alt + s
#
## set directly keycode (here control+alt+mod2 + f with my keyboard)
#"xterm"
#  alt + c:0x29 + m:4 + mod2
#
## Control+Shift+a  release event starts rxvt
#"rxvt"
#  release+control+shift + a
#
## Control + mouse button 2 release event starts rxvt
#"rxvt"
#  Control + b:2 + Release

# Backward, Forward, Full Screen & Refresh is just for web browser
#Backward
"xvkbd -xsendevent -text "\A\[Left]""
    m:0x0 + c:67
    F1 

#Full Screen
"xvkbd -xsendevent -text "\[F11]""
    m:0x0 + c:70
    F4 

#Forward
"xvkbd -xsendevent -text "\A\[Right]""
    m:0x0 + c:68
    F2 

#Refresh
"xvkbd -xsendevent -text "\Cr""
    m:0x0 + c:69
    F3 

# on ChromeBook, it "Enter Overview mode, which shows all windows (F5)", see also https://support.google.com/chromebook/answer/1047364?hl
# here it work at KDE, it "Switch to next focused window", see also http://community.linuxmint.com/tutorial/view/47
#Switch Window
#"xvkbd -xsendevent -text "\A\t""
"xfce4-screenshooter -w"
    m:0x0 + c:71
    F5 

#Backlight Down
"xbacklight -dec 5"
    m:0x0 + c:72
    F6 

#Backlight Up
"xbacklight -inc 5"
    m:0x0 + c:73
    F7 

#Mute
#"amixer set Master toggle"
"pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo toggle"
    m:0x0 + c:74
    F8 

#Decrease Volume
#"amixer set Master 5- unmute"
"pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo -- -5%"
    m:0x0 + c:75
    F9 

#Increase Volume
#"amixer set Master 5+ unmute"
"pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo -- +5%"
    m:0x0 + c:76
    F10 

# added Home, End, Pg Up, Pg Down, and Del keys using the Alt+arrow key combos
#Delete
"xvkbd -xsendevent -text '\[Delete]'"
    m:0x8 + c:22
    Alt + BackSpace 

#End
"xvkbd -xsendevent -text '\[End]'"
    m:0x8 + c:114
    Alt + Right 

#Home
"xvkbd -xsendevent -text '\[Home]'"
    m:0x8 + c:113
    Alt + Left 

#Page Down
"xvkbd -xsendevent -text '\[Page_Down]'"
    m:0x8 + c:116
    Alt + Down 

#Page Up
"xvkbd -xsendevent -text '\[Page_Up]'"
    m:0x8 + c:111
    Alt + Up 

#vim paste
"xvkbd -xsendevent -text '\[Shift]\[Insert]'"
    m:0x1 + c:108
    Shift + Alt_R

#Ctrl + End
"xvkbd -xsendevent -text '\[Control]\[End]'"
    m:0xc + m:0x8 + c:114
    Control + Alt + Right 

#Ctrl + Home
"xvkbd -xsendevent -text '\[Control]\[Home]'"
    m:0xc + m:0x8 + c:113
    Control + Alt + Left 

# End of xbindkeys configuration #
##################################

そして、
~/.xinitrc
上記ファイルを作成し、

xbindkeys

追記、そして、ログアウトすれば、 xbindkeysrcの設定が反映されている。

上記サイトと変えたのは

  • #Mute
  • #Decrease Volume
  • #Increase Volume

の部分、 amixerはインストールできなかった。

また、 #Switch Window xvkbd -xsendevent -text "\A\t" も作動しなかったので、アクティブなウィンドウをスクリーンショット形に変更。普通にxvkbdでscreenshotを送信できないのかな?とか調べたら、「こんなキー必要?」みないに公式(?)サイトに書かれた。確かにShutterというアプリあるからあんま使わないだろうけど。

あと、自分はエディターとしてvimを使っている関係上、 Shift+Insertを送信できるようになっておきたいので( Ctrl+r→プラスとか0~9でクリップボード、レジスタから貼れるけど、日本語入力モードになっていると戻さなきゃいけないので・・・)。

xvkbd使っていると、ついつい、 Alt+RightEndとして作動するから、 Ctrl+Alt+Right入力すれば Ctrl+Endが送信されると勘違いしそうになるが、そうはならない。その場合は、 Ctrl+Alt+Right同時入力時の設定する必要がある。

ってなわけで、 Ctrl+Home、Ctrl+Endでファイルの先頭、最後に行けるように Ctrl + End、Ctrl + Homeの設定もしておく。これで大分、使いやすくなったかな?

Tags: Ubuntu Desktop Chromebook

UbuntuでKindle(azw3)を読む hint modeでfcitxのIMEをOFFにする。

comments powered by Disqus