「特別なキーボードキー」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(カテゴリの修正)
(同期)
1行目: 1行目:
 
[[Category:キーボード設定]]
 
[[Category:キーボード設定]]
  +
[[de:Hotkeys]]
 
[[en:Extra keyboard keys]]
 
[[en:Extra keyboard keys]]
 
[[ru:Extra keyboard keys]]
 
[[ru:Extra keyboard keys]]
  +
この記事では、あなたが [[キーボード入力]] の記事を読んだことを想定しています。
[[zh-hans:Extra keyboard keys]]
 
{{Related articles start}}
 
{{Related|Xorg での特別なキーボードキー}}
 
{{Related|コンソールでの特別なキーボードキー}}
 
{{Related|Xorg でのキーボード設定}}
 
{{Related|コンソールでのキーボード設定}}
 
{{Related|スキャンコードをキーコードにマップ}}
 
{{Related|Xmodmap}}
 
{{Related articles end}}
 
多くのキーボードには何らかの''特別なキー''が付いており (''ホットキー''や''マルチメディアキー''とも呼ばれる)、アプリケーションを起動したり特殊な文字を打ち込むのに使われます (標準的なキーマップには含まれていない機能)。[[udev]] は様々なキーボードに関する巨大なデータベースを持っているため、基本的なキーボードは何も設定せずとも問題なく動作します。最近発売されたばかり、または非常にレアなハードウェアを使っている場合に、マッピングを手動で調整する必要がでてきます。
 
   
  +
多くのキーボードにはいくつかの ''特殊キー'' (''ホットキー'' とも ''マルチメディアキー'' とも呼ばれます) が存在します。それらは、アプリケーションの実行や (標準的な国際キーマップには含まれていない) 特殊文字の入力を行うことを想定しています。[[udev]] は様々なキーボードに関する巨大なデータベースを持っているため、基本的なキーボードは何も設定せずとも問題なく動作します。最近発売されたばかり、または非常にレアなハードウェアを使っている場合に、マッピングを手動で調整する必要がでてきます。
キーマッピングを変更する前に、そのキーがシステムでどう認識されているのか知らなくてはなりません。いくつかの段階に分かれています:
 
 
* [[Wikipedia:ja:スキャンコード|スキャンコード]]は最下層のキー識別番号で、キーボードがコンピュータに送信する値になります。
 
* '''キーコード'''は2番目のキー識別子で、''キーコード''は機能に対応しています。
 
* '''キーシム'''は3番目のキー識別子で、''シンボル''に対応しています。キーシムは Shift キーなどの[[Wikipedia:ja:修飾キー|修飾キー]]が押されているかどうかによって変わります。
 
 
''スキャンコード''は''キーコード''にマップされており、''キーコード''は使用しているキーボードレイアウトにあわせて''キーシム''にマップされています。ほとんどのキーには''キーコード''が割り当てられているはずです。そして、''キーコード''がなくとも''スキャンコード''は存在するでしょう。''スキャンコード''が存在しないキーはカーネルによって認識されていません。ゲーミングキーボードに追加されているキーなどで''スキャンコード''がないことがあります。
 
 
Xorg では、特定の''キーシム'' (例: {{ic|XF86AudioPlay}}, {{ic|XF86AudioRaiseVolume}} など) をアクションにマップすることができます (例: アプリケーションの起動)。詳しくは [[Xorg での特別なキーボードキー#キーシムをアクションにマップ]] を見て下さい。
 
 
Linux コンソールでは、特定の''キーシム'' (例: {{ic|F1}} から {{ic|F246}}) を特定のアクションにマップすることができます (例: 他のコンソールへの切り替えや特定の文字列の打ち込みなど)。詳しくは[[コンソールでの特別なキーボードキー]]を見て下さい。
 
 
== キーコードの確認 ==
 
 
=== スキャンコード ===
 
 
==== showkey を使う ====
 
 
''スキャンコード''を取得するときは ''showkey'' ユーティリティを使うのが一般的です。''showkey'' はキーが押されるまで待機し、10秒たってもキーが押されなかった場合、終了します。''showkey'' を使用するには[[Wikipedia:ja:仮想コンソール|仮想端末]]上で実行させる必要があり、グラフィカル環境やネットワーク接続を介してログインした場合は使用できません。次のコマンドを実行してください:
 
 
# showkey --scancodes
 
 
コマンドを実行した後にキーボードのキーを押してみて下さい。''スキャンコード''が出力されます。
 
 
==== evtest を使う ====
 
 
USB キーボードの場合、''showkey'' ではなく {{Pkg|evtest}} パッケージに入っている ''evtest'' を使う必要があります [https://ask.fedoraproject.org/en/question/46201/how-to-map-scancodes-to-keycodes/]:
 
 
# evtest /dev/input/event12
 
...
 
Event: time 1434666536.001123, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70053
 
Event: time 1434666536.001123, type 1 (EV_KEY), code 69 (KEY_NUMLOCK), value 0
 
Event: time 1434666536.001123, -------------- EV_SYN ------------
 
 
{{ic|MSC_SCAN}} の "value" フィールドを使って下さい。上記の例の場合、NumLock のスキャンコードは 70053 でキーコードは 69 です。
 
 
==== dmesg を使う ====
 
 
{{Note|この方法では全てのキーの''スキャンコード''を確認することはできません。未知のキーだけを確認できます。}}
 
 
調べたいキーを押して {{ic|dmesg}} コマンドの出力を確認することでキーの''スキャンコード''を取得できます。例えば、以下のように表示された場合:
 
 
Unknown key pressed (translated set 2, code 0xa0 on isa0060/serio0
 
 
必要な''スキャンコード''は {{ic|0xa0}} です。
 
 
=== キーコード ===
 
 
{{Warning|Linux コンソールと Xorg で''キーコード''は異なっています。適切なツールを使って確認するようにしてください。}}
 
 
==== コンソール ====
 
 
[[Wikipedia:ja:仮想コンソール|仮想端末]]の''キーコード''は ''showkey'' ユーティリティを使って確認できます。''showkey'' はキーが押されるのを待機して、10秒間何もないと終了します。10秒間放置する以外に終了する方法はありません。''showkey'' は仮想端末から実行する必要があります。グラフィカル環境から実行してはいけません。次のコマンドを実行して何かキーボードのキーを押して見て下さい:
 
 
# showkey --keycodes
 
 
''キーコード''が画面に出力されるはずです。
 
 
==== Xorg ====
 
 
[[Xorg]] によって使用される''キーコード''は ''xev'' という名前のユーティリティで判別できます ({{Pkg|xorg-xev}} パッケージに入っています)。もちろん ''xev'' を使用するには、コンソールではなくグラフィカル環境から実行する必要があります。
 
 
次のコマンドで ''xev'' を起動して肝心の部分だけを表示できます:
 
 
$ xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
 
 
出力例:
 
 
38 a
 
55 v
 
54 c
 
50 Shift_L
 
133 Super_L
 
135 Menu
 
 
キーを押してもターミナルに何も表示されない場合、キーに''スキャンコード''が設定されていないか''スキャンコード''が''キーコード''にマッピングされていない、あるいは他のプロセスがキーの押下をキャプチャしています。X サーバーを使用しているプロセスがキーの押下を取得してしまっているようなときは、新しい X セッションから ''xev'' を実行してみてください:
 
 
$ xinit /usr/bin/xterm -- :1
 
 
== スキャンコードをキーコードにマッピング ==
 
 
次の記事を参照してください: [[スキャンコードをキーコードにマップ]]。
 
 
== キーコードをキーシムにマッピング ==
 
 
=== コンソール ===
 
 
次の記事を参照してください: [[コンソールでの特別なキーボードキー]]。
 
 
=== Xorg ===
 
 
次の記事を参照してください: [[xmodmap]]。
 
   
 
== ノートパソコン ==
 
== ノートパソコン ==
   
=== Apple MacBook ===
+
=== Apple MacBooks ===
   
  +
All the required information is available on the [[Apple Keyboard]] dedicated article.
MacBook に関する情報は [[Apple Keyboard]] の記事を読んでください。
 
   
 
=== Asus M シリーズ ===
 
=== Asus M シリーズ ===
   
  +
In order to have control over the light sensor and the multimedia keys on your Asus machine, you should use the following command:
Asus マシンの光学センサーやマルチメディアキーを制御するには、次のコマンドを実行してください:
 
   
 
# echo 1 > /sys/devices/platform/asus_laptop/ls_switch
 
# echo 1 > /sys/devices/platform/asus_laptop/ls_switch
   
  +
To have it run on boot create a [[Systemd tmpfile]]:
起動時に上記コマンドを実行させるには [[Systemd#一時ファイル|Systemd tmpfile]] を作成:
 
 
{{hc|/etc/tmpfiles.d/local.conf|
 
{{hc|/etc/tmpfiles.d/local.conf|
 
w /sys/devices/platform/asus_laptop/ls_switch - - - - 1
 
w /sys/devices/platform/asus_laptop/ls_switch - - - - 1
 
}}
 
}}
   
  +
{{Note|This may work also for other Asus notebook models.}}
{{Note|他の機種の Asus ノートパソコンでも使えることがあります。}}
 
   
=== Asus N56VJ ===
+
=== Asus N56VJ (おそらく他のものも) ===
   
  +
If most of your special keys do not work, try loading the asus-nb-wmi kernel module with
特殊キーが動作しない場合、次のコマンドで {{ic|asus-nb-wmi}} カーネルモジュールをロードしてみてください:
 
 
# modprobe asus-nb-wmi
 
# modprobe asus-nb-wmi
   
  +
then check xev again. If you combine this with the acpi_osi="!Windows 2012" boot option, you may get weird results in xev, so try not using it. If this did fix things, make sure to make the module load at boot with methods described in [[Kernel modules#Automatic module loading with systemd]].
それから xev をもう一度確認してください。{{ic|1=acpi_osi="!Windows 2012"}} ブートオプションを使っている場合、xev で変な結果が表示されることがあるので、使わないようにしてください。モジュールをロードすることで問題が解決する場合、[[カーネルモジュール]]の記事に書かれているようにして、起動時にモジュールをロードするようにしてください。
 
   
=== Lenovo T460p ===
+
=== Lenovo T460p (おそらく他のものも) ===
始めの状態では {{ic|/dev/input}} インターフェイスからでもバックライトキー (F5, F6) が使えません。解決するには、ブートパラメータに以下のオプションを追加してみてください:
 
   
  +
Out of the box, the backlight keys (on F5, F6) might not be available, even via the {{ic|/dev/input}} interface. To fix this, follow [[Backlight#Kernel command-line options]].
{{hc|/etc/default/grub|
 
2=GRUB_CMDLINE_LINUX_DEFAULT="... video.use_native_backlight=1 ..."
 
}}
 
   
 
== ゲーミングキーボード ==
 
== ゲーミングキーボード ==
   
  +
Gaming keyboards have some special features which may cause them to "misbehave" in Linux.
ゲーミングキーボードに搭載されている特殊な機能が Linux でおかしな挙動を引き起こすことがあります。
 
   
===Cooler Master CM Storm QuickFire TK===
+
=== Cooler Master CM Storm QuickFire TK ===
   
  +
This keyboard has two features that could cause confusion in Linux: N-Key Rollover and the Win-Lock Key.
N キーロールオーバーと Win-Lock キーが Linux で問題を起こします。
 
   
  +
N-Key Rollover can [https://bbs.archlinux.org/viewtopic.php?id=170877 cause problems with the Function keys]. To disable N-key rollover, hold down the FN lock key (next to right-ctrl) until it lights up, then hold Escape and press 6 to switch to 6-key rollover. Hold down the FN lock key to disable the Fn lock.
N キーロールオーバーはファンクションキーに干渉することがあります [https://bbs.archlinux.org/viewtopic.php?id=170877]。N キーロールオーバーを無効化するには、FN ロックキー (右 Ctrl の横にあるキー) を押し続けてライトが点いたら、Escape を押しながら 6 を押すことで 6 キーロールオーバーに切り替わります。FN ロックキーを押すと Fn ロックが無効になります。
 
   
Win-Lock キーは Super (Windows) キーを完全に無効化します。FN ロックキーと F12 を同時に押すことで Win-Lock のオンオフを切り替えられます。
+
The Win-Lock Key completely disables the Super (Windows) keys. Simply press the FN lock key and F12 together to toggle Win-Lock on and off.
   
===Corsair K シリーズ ===
+
=== Corsair K シリーズキーボード ===
  +
このキーボードにはキーボードの右上 NumLock と CapsLock の間に、Super (Windows) キーを無効化する winlock ボタンがあります。 [https://github.com/ckb-next/ckb-next CKB] ドライバーを利用すると、winlock 機構を完全に無効化できます。しかし既定では、winlock ボタンをもう一度押すと Super (Windows) キーが有効になります。
 
  +
There is a winlock button on these keyboards that can disable the use of the Super (Windows) keys. This button is located at the top right of the keyboard next to the num and capslock buttons. CKB can be used to disable this functionality entirely preventing further locking. However, in a default state, simply pressing the button would enable the Super (Windows) keys again.
   
 
=== Logitech G シリーズ G710 と 710+ ===
 
=== Logitech G シリーズ G710 と 710+ ===
   
  +
This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install {{aur|sidewinderd}} and [[start]] {{ic|sidewinderd.service}}.
6個のプログラマブル G キーが搭載されたキーボードです。正しく使用するには {{aur|sidewinderd}} をインストールして {{ic|sidewinderd.service}} を[[起動]]する必要があります。[[Logitech ゲーミングキーボード]]も参照。
 
  +
  +
=== Logitech G613 ===
  +
  +
This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install {{Pkg|solaar}}. Within ''solaar'', you will be able to divert the G-Key functions and remap them.
  +
  +
== 非標準的なキーボード ==
  +
  +
=== Royal Kludge RK61 とおそらく他の Apple キーボード ===
  +
  +
Some Apple keyboards (including the Royal Kludge RK61) have the function {{ic|F1}}–{{ic|F12}} keys defaulted to mac media keys. If no {{ic|Fn Lock}} is available, this is the the only available behavior unless the default Apple Keyboard behavior is changed. In order to remedy this, make sure the keyboard is being identified as an Apple keyboard using the following command:
  +
  +
# lsusb | grep "Apple.*Keyboard"
  +
  +
Proceed to [[Apple Keyboard#Function keys do not work]] if an Apple Keyboard is found.
   
 
== 参照 ==
 
== 参照 ==
   
* [http://wiki.linuxquestions.org/wiki/Configuring_keyboards#Enabling_Keyboard_Multimedia_Keys Enabling Keyboard Multimedia Keys] - LinuxQuestions wiki のガイド
+
* [[LQWiki:Configuring keyboards#Enabling Keyboard Multimedia Keys]]

2022年9月20日 (火) 16:25時点における版

この記事では、あなたが キーボード入力 の記事を読んだことを想定しています。

多くのキーボードにはいくつかの 特殊キー (ホットキー とも マルチメディアキー とも呼ばれます) が存在します。それらは、アプリケーションの実行や (標準的な国際キーマップには含まれていない) 特殊文字の入力を行うことを想定しています。udev は様々なキーボードに関する巨大なデータベースを持っているため、基本的なキーボードは何も設定せずとも問題なく動作します。最近発売されたばかり、または非常にレアなハードウェアを使っている場合に、マッピングを手動で調整する必要がでてきます。

ノートパソコン

Apple MacBooks

All the required information is available on the Apple Keyboard dedicated article.

Asus M シリーズ

In order to have control over the light sensor and the multimedia keys on your Asus machine, you should use the following command:

# echo 1 > /sys/devices/platform/asus_laptop/ls_switch

To have it run on boot create a Systemd tmpfile:

/etc/tmpfiles.d/local.conf
w /sys/devices/platform/asus_laptop/ls_switch - - - - 1
ノート: This may work also for other Asus notebook models.

Asus N56VJ (おそらく他のものも)

If most of your special keys do not work, try loading the asus-nb-wmi kernel module with

# modprobe asus-nb-wmi

then check xev again. If you combine this with the acpi_osi="!Windows 2012" boot option, you may get weird results in xev, so try not using it. If this did fix things, make sure to make the module load at boot with methods described in Kernel modules#Automatic module loading with systemd.

Lenovo T460p (おそらく他のものも)

Out of the box, the backlight keys (on F5, F6) might not be available, even via the /dev/input interface. To fix this, follow Backlight#Kernel command-line options.

ゲーミングキーボード

Gaming keyboards have some special features which may cause them to "misbehave" in Linux.

Cooler Master CM Storm QuickFire TK

This keyboard has two features that could cause confusion in Linux: N-Key Rollover and the Win-Lock Key.

N-Key Rollover can cause problems with the Function keys. To disable N-key rollover, hold down the FN lock key (next to right-ctrl) until it lights up, then hold Escape and press 6 to switch to 6-key rollover. Hold down the FN lock key to disable the Fn lock.

The Win-Lock Key completely disables the Super (Windows) keys. Simply press the FN lock key and F12 together to toggle Win-Lock on and off.

Corsair K シリーズキーボード

There is a winlock button on these keyboards that can disable the use of the Super (Windows) keys. This button is located at the top right of the keyboard next to the num and capslock buttons. CKB can be used to disable this functionality entirely preventing further locking. However, in a default state, simply pressing the button would enable the Super (Windows) keys again.

Logitech G シリーズ G710 と 710+

This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install sidewinderdAUR and start sidewinderd.service.

Logitech G613

This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install solaar. Within solaar, you will be able to divert the G-Key functions and remap them.

非標準的なキーボード

Royal Kludge RK61 とおそらく他の Apple キーボード

Some Apple keyboards (including the Royal Kludge RK61) have the function F1F12 keys defaulted to mac media keys. If no Fn Lock is available, this is the the only available behavior unless the default Apple Keyboard behavior is changed. In order to remedy this, make sure the keyboard is being identified as an Apple keyboard using the following command:

# lsusb | grep "Apple.*Keyboard"  

Proceed to Apple Keyboard#Function keys do not work if an Apple Keyboard is found.

参照