V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
clockOS
V2EX  ›  macOS

用`Script Editor`隐藏或显示`MenuBar`和`Dock`的快捷方式

  •  
  •   clockOS · 2018-11-19 15:57:20 +08:00 · 1443 次点击
    这是一个创建于 1957 天前的主题,其中的信息可能已经有所发展或是发生改变。

    因为要频繁地 Toggle MenuBar 和 Dock 的隐藏和显示

    在 System preference 手动设置太麻烦还费时间

    所以第一次研究了 Script Editor

    效果:

    alt text

    下载:

    https://img.fuckb.at/files/share/autoHideNShow.zip

    当然应该很少有人有像我这样的场景,可以根据自己的情况编写若干个设置的快捷方式

    打开Script Editor

    创建新文档

    复制以下代码

    tell application "System Preferences"
    	reveal pane id "com.apple.preference.general"
    end tell
    tell application "System Events" to tell process "System Preferences" to tell window "General"
    	click checkbox "Automatically hide and show the menu bar"
    end tell
    delay 1
    tell application "System Preferences"
    	reveal pane id "com.apple.preference.dock"
    end tell
    tell application "System Events" to tell process "System Preferences" to tell window "Dock"
    	click checkbox "Automatically hide and show the Dock"
    end tell
    quit application "System Preferences"
    

    以 Application 的形式保存

    可以将它放到 Dock 里

    第一次点击时允许访问 'Assistive apps to controll...'

    这样就可以点击一下就可以来回切换是否要现实或自动隐藏 Menubar 和 Dock 了

    也许有更好的实现方式,欢迎指点

    4 条回复    2018-11-20 11:53:20 +08:00
    frinstioAKL
        1
    frinstioAKL  
       2018-11-19 17:02:10 +08:00 via Android
    用 alfred 做一个 workflow, 或者用 keyboard maestro 搞个快捷键来开关,我觉得更方便
    CivAx
        2
    CivAx  
       2018-11-19 17:16:42 +08:00
    Opt+CMD+D 可以隐藏 Docker
    隐藏状态栏我倒是觉得比较奇怪,为什么不直接最大化窗口。
    clockOS
        3
    clockOS  
    OP
       2018-11-19 19:33:47 +08:00
    @CivAx 公司里用的都是 chromeOS 为了不被别人看出来
    AlphaRobert
        4
    AlphaRobert  
       2018-11-20 11:53:20 +08:00 via iPhone
    我之前用 Karabiner 寫了一個快捷鍵:
    ⌥ 聚焦於選單列
    ⌥⌥ 聚焦於狀態列
    ⌃ 聚焦於 Dock
    ⌃⌃ 打開 Terminal
    配合你這個可能會很方便了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2793 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:48 · PVG 19:48 · LAX 04:48 · JFK 07:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.