【问题标题】:Dismiss MacOS Big Sur notifications with keyboard使用键盘关闭 MacOS Big Sur 通知
【发布时间】:2021-03-16 12:06:00
【问题描述】:

长期以来,我一直使用从键盘快捷键触发的 Applescript 来消除 MacOS 上的通知。它通过模拟点击每个打开的通知中心窗口的“关闭”按钮来工作。

自从升级到 Big Sur(当前为 11.0.1)后,通知不再有关闭按钮。相反,当您将鼠标悬停在它们上方时,会出现一个“X”按钮。对于难以精确点击的人(我手有轻微颤抖),使用鼠标/触控板很困难。

谁有关于如何恢复该功能的建议,以便我可以把手放在键盘上?

【问题讨论】:

标签: macos keyboard macos-big-sur


【解决方案1】:

找到这个https://itectec.com/askdifferent/macos-dismiss-macos-big-sur-notifications-with-keyboard/。 我测试它有效。小错误是进程名称是“NotificationCenter”,没有空格。原始代码可能会导致找不到进程错误。 来自链接的版权归原作者所有。

activate application "NotificationCenter"
tell application "System Events"
    tell process "NotificationCenter"
        set theWindow to group 1 of UI element 1 of scroll area 1 of window "Notification Center"
        # click theWindow
        set theActions to actions of theWindow
        repeat with theAction in theActions
            if description of theAction is "Close" then
                tell theWindow
                    perform theAction
                end tell
                exit repeat
            end if
        end repeat
    end tell
end tell

【讨论】:

    猜你喜欢
    • 2021-09-21
    • 2021-12-08
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 2022-01-09
    • 2021-11-26
    • 2021-02-27
    相关资源
    最近更新 更多