Macã®ä»»æã®ã¢ããªã®è¡¨ç¤ºãã·ã§ã¼ãã«ãããã¼ï¼ã¤ã§ãã°ã«åãæ¿ãã§ããããã«ãã
Macæ¨æºã¿ã¼ããã«ããã¤ã§ãã©ãã§ãå¼ã³åºãããï¼è¡¨ç¤ºã»é表示ãåãæ¿ãã¦ããã«ã¿ã¼ããã«ã使ãããï¼ã¨æãæ¹æ³ãè²ã æ¢ã£ã¦ã¿ãã®ã§ããããªããªãããæ¹æ³ãè¦ã¤ãããªãã£ãã®ã§AppleScriptã§ã¹ã¯ãªãããæ¸ãKarabiner Elementsã«è¨å®ãããã¨ã§å®ç¾ããã®ã§ã¡ã¢ã
Macã®æ¨æºæ©è½ã§ã¯Cmd+Hã§ã¦ã¤ã³ãã¦ãé ãåä½ãå¯è½ã§ãããé ãããã¨ã¦ã¤ã³ãã¦ãå¼ã³æ»ãã®ã¯å°ãå°é£ã§ããã¾ããé ããã¦ã¤ã³ãã¦ãå表示ãããã¨ãé£ããã®ã§ãããã¾ã§ã¯iTerm2ã®ãããªå¥ã¿ã¼ããã«ã®æ©è½ã§å®ç¾ãã¦ãã¾ããã
ä»åã¯ãTerminalãæåé¢ã«ããã¨ãã«ãCmd+`
ãæ¼ãã¨é表示ã«ãªããããä¸åº¦æ¼ãã¨æåé¢ã«æ»ã£ã¦ãããããªåä½ã«ãã¦ãã¾ãã
ãããå¿ç¨ãã¦Terminal以å¤ã«ãä»»æã®ã¢ããªã±ã¼ã·ã§ã³ã«é©ç¨ãããã¨ãã§ãã¾ãã
åæ
- macOS
- ä»å㯠Mojave 10.14.6
- Karabiner-Elements(Karabiner)
- ä»åã¯12.7.0
ã使ãããã¨
æ¹æ³
Scriptã®ä½æ
以ä¸ã®Apple ScriptãKarabinerã®.configé ä¸ã«ä¿åãã¾ãã
$ mkdir -p ~/.config/karabiner/scripts $ vim toggle_terminal.script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ set name_of_app to "Terminal" tell application "System Events" get name of application processes whose frontmost is true and visible is true end tell if Result contains name_of_app then tell application "System Events" set visible of process name_of_app to false end tell else tell application "System Events" set frontmost of process name_of_app to true set visible of process name_of_app to true end tell end if ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ãããã«å®è¡ãã¦ã¿ã
$ osascript ~/.config/karabiner/scripts/toggle_terminal.script # Terminalãæ¶ãã #
set name_of_app to "Terminal"
ã®Terminalã®ã¨ãããå¥ã®ååã«ãã¦ãOK
ãããä»»æã®ã·ã§ã¼ãã«ãããã¼ã«ç´ä»ããã ãã§ãã
Karabinerã«ç»é²
以ä¸ã®ãã¡ã¤ã«ãä½æãã¾ã
$ vim ~/.config/karabiner/assets/complex_modifications/terminal.json ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { "title": "ã¹ã¼ãã¼ãããã·ã§ã¼ãã«ãã", "rules": [ { "description": "Terminalã®Show/Hide", "manipulators": [ { "from": { "key_code": "grave_accent_and_tilde", "modifiers": { "mandatory": [ "left_command" ] } }, "to": [ { "shell_command": "osascript ~/.config/karabiner/scripts/toggle_terminal.script" } ], "type": "basic" } ] } ] } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karabinerã®JSONè¨è¿°æ¹æ³ã¯ãã°ã°ããð
ãã¨ã¯Karabinerã®Preference>Complex Modifications>Add Rule>ã«ã¿ã¼ããã«ã®ããããã®ã§Enableã«ããã ã
è£è¶³
Apple Scriptããã