見出し画像

MacのChrome69からタブ移動のショートカットキー(command + shift + [ or ])が消えてしまったので元に戻す。

tl;dr


karabiner-elementsが必要
https://github.com/teitei-tk/MyDotfiles/blob/23206e94e7b2108427b148e4ee82587a50e6bad9/.config/karabiner/assets/complex_modifications/chrome.json 



~/.config/karabiner/assets/complex_modifications/chrome.json に登録して、ComplexModificationsのルールを追加から追加すると変更出来ます。

Chrome69から開いている次のタブ・前のタブに移動するショートカットキーが変更された。

JIS配列限定のようですが、Chrome Version 69からタブの移動のショートカットキーが一部削除されたようです。

> 開いている次のタブに移動する ⌘+option+右矢印
> 開いている前のタブに移動する ⌘+option+左矢印

Chrome公式のTwitterアカウントの方からフィードバックとして送ってほしいとのReplyや、Googleグループでも似た報告をされている方がいました。

Chrome Version 71からは元に戻っているようです。

ですが、他のMacのアプリを利用していると(eg. VSCode)、タブ移動のショートカットキーを切り替えるコンテキストスイッチが変わって生産性が下がってしまうので、戻るまでKarabiner-Elementを利用してショートカットキーを復活させました。

Karabiner-Elementを利用してタブ移動のショートカットキーを復活させる。

Karabiner-ElementはMacでのキーバインドを変更できるアプリです。インストール手順は割愛します。

行っていることは公式のヘルプにもあるように

> 開いている次のタブに移動する ⌘+option+右矢印
> 開いている前のタブに移動する ⌘+option+左矢印

に変わったkを

開いている次のタブに移動する場合は ⌘ + shift + ]
開いている前のタブに移動する場合は ⌘ + shift + [

に置き換えます。

設定を変更する

置き換えの設定はjsonファイルで行います。

Karabiner-Elementをインストール後、個人個人の設定はホームディレクトリ配下の.config/karabiner/karabiner.json で設定することができます。

自分の場合は、会社でも自宅でも同じキーバインドを利用したいので、自分のdotfiles repositoryで管理をしました。
https://github.com/teitei-tk/MyDotfiles

具体的にはホームディレクトリ配下の.config/karabiner/assets/complex_modifications/chrome.json に下記のjsonファイルを追加します。


{
 "title": "Modify Chrome App Keybind",
 "rules": [
   {
     "description": "bind 'cmd + opt + <-(left_arrow)' as 'cmd + shift + ['",
     "manipulators": [
       {
         "conditions": [
           {
             "bundle_identifiers": ["^com\\.google\\.Chrome"],
             "type": "frontmost_application_if"
           }
         ],
         "from": {
           "key_code": "backslash",
           "modifiers": {
             "mandatory": ["command", "shift"],
             "optional": ["any"]
           }
         },
         "to": [
           {
             "key_code": "right_arrow",
             "modifiers": ["left_command", "left_option"]
           }
         ],
         "type": "basic"
       }
     ]
   },
   {
     "description": "bind 'cmd + opt + ->(right_arrow)' as 'cmd + shift + ]'",
     "manipulators": [
       {
         "conditions": [
           {
             "bundle_identifiers": ["^com\\.google\\.Chrome"],
             "type": "frontmost_application_if"
           }
         ],
         "from": {
           "key_code": "close_bracket",
           "modifiers": {
             "mandatory": ["command", "shift"],
             "optional": ["any"]
           }
         },
         "to": [
           {
             "key_code": "left_arrow",
             "modifiers": ["left_command", "left_option"]
           }
         ],
         "type": "basic"
       }
     ]
   }
 ]
}

追加をしたあと、Karabiner-Elementを再起動します。その後 Complex Modificationsタブのアイテムを追加を選択すると、上記のjsonファイルの設定が追加されていると思います。

その後、下記のルールを適応(Enable)します。

bind 'cmd + opt + <-(left_arrow)' as 'cmd + shift + ['
bind 'cmd + opt + ->(right_arrow)' as 'cmd + shift + ]'

適応後、Chrome上で⌘ + shift + ]、⌘ + shift + [ でタブの移動ができるかと思います。

よくわからないけど直したい

※自分では試してないです。ご確認の上お願いします。

黒い画面(ターミナル)でなんとかできます。

ターミナルを起動後、下記の呪文を貼り付けて実行したあと、Karabiner-Elementを再起動してください。その後、Complex Modificationsタブのアイテムを追加に項目が追加されていると思います。

mkdir -p $HOME/.config/karabiner/assets/complex_modifications/ &&
cd .config/karabiner/assets/complex_modifications &&
curl -O https://raw.githubusercontent.com/teitei-tk/MyDotfiles/23206e94e7b2108427b148e4ee82587a50e6bad9/.config/karabiner/assets/complex_modifications/chrome.json

行っていることは、設定ファイルを置くフォルダを作成して、設定ファイルをダウンロードをしています。


Software Engineer. https://teitei-tk.com