0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

T2linuxにおけるgui,cui(ターミナル)の操作感をmacに近づけてみた

0
Posted at

T2チップ搭載のMacBookにFedoraをインストールした際、cuiやguiでショートカットキーが違うことから、操作ミスをすることがあったのでmacに近づけることにしました。
コピペなどはctrlを割り振った物理cmdキーで、ターミナルの実行中断やnanoの操作はsuperキー(windowsキー)を割り振った物理ctrlキーで行います。
上記の割り振りはkeydの設定で行ってください。

また、Mac特有の操作感を再現するには、ターミナルエミュレータ Kitty 側での設定と、OS(GNOME)側の競合回避が必要です。


1. Kittyの設定 (kitty.conf)

~/.config/kitty/kitty.conf に以下の設定を記述します。
kitty_modという独特な変数にctrl(デフォルトではctrl+shift)を与えることで、コピーなどをctrl+shift+cからctrl+cで行えるようになります。
Superキーの組み合わせをエスケープシーケンス(16進数)として送信するようにすることで、ctrlで行っていたショートカットをsuperで行えるようになります。例えば中断であればsuper+cで行なえます。

~/.config/kitty/kitty.conf
# kitty独自の操作(タブ・窓操作など)のベースを Ctrl に設定
kitty_mod ctrl

# Super + 各キー で Ctrl + キーの信号(エスケープシーケンス)を送信
map super+a send_text all \x01
map super+b send_text all \x02
map super+c send_text all \x03
map super+d send_text all \x04
map super+e send_text all \x05
map super+f send_text all \x06
map super+g send_text all \x07
map super+h send_text all \x08
map super+i send_text all \x09
map super+j send_text all \x0a
map super+k send_text all \x0b
map super+l send_text all \x0c
map super+m send_text all \x0d
map super+n send_text all \x0e
map super+o send_text all \x0f
map super+p send_text all \x10
map super+q send_text all \x11
map super+r send_text all \x12
map super+s send_text all \x13
map super+t send_text all \x14
map super+u send_text all \x15
map super+v send_text all \x16
map super+w send_text all \x17
map super+x send_text all \x18
map super+y send_text all \x19
map super+z send_text all \x1a

2. GNOME(OS側)のショートカット競合を解除する

Fedora(GNOME)では、一部の Super キーがシステム機能に予約されており、Kittyに信号が届く前にOSがインターセプトしてしまいます。これらを別のキー(Super + Shift)に逃がすことで、Kittyへの道を開通させます。
また、システム設定画面(gui)のからsuper+<英語>のものを削除するか他のものに割り当てる必要があります。

.zsh
# Super + O (画面回転ロック) を Super + Shift + O に変更
gsettings set org.gnome.settings-daemon.plugins.media-keys rotate-video-lock-static "['<Super><Shift>o', 'XF86RotationLockToggle']"

# Super + P (ディスプレイ切替) を Super + Shift + P に変更
gsettings set org.gnome.mutter.keybindings switch-monitor "['<Super><Shift>p', 'XF86Display']"

参考

3.kittyに信号が届いているか確認

かならず再起動してください

kitty.zsh
showkey -a

実行後、各キーを叩いて以下のエスケープシーケンス(またはASCIIコード)が表示されれば成功です。
また表示上ではsuper+aを押したとき、^aとなります。

  • Super + I: 0x09 (Tabと共通)
  • Super + P: ^P 16 0020 0x10
  • Super + O: ^O 15 001f 0x0f

また、うまく行っていない場合、ibusの設定と競合していることも考えれますのでその際はコマンド実行後、適宜修正してください。再起動もお忘れなく。

.zsh
ibus-setup

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?