amiantos / pibar

PiBar for Pi-hole - Manage your Pi-hole(s) from your macOS menu bar!
Mozilla Public License 2.0
293 stars 6 forks source link

Add AppleScript Support #5

Open amiantos opened 4 years ago

amiantos commented 4 years ago
BrianAMartin221 commented 4 years ago

Hey I know some of you may be like me and use your own global keyboard shortcuts. (In my case PiBars uses one I had open. But I figured I'd throw together an AppleScript for disabling by AppleScript. I have a slight delay in mine so someone smarter than me might be able to fix that but I figured I would include.

This script just Ques up the Disable Time options instead of disabling all together.

tell application "System Events" to quit
tell application "System Events" to tell process "PiBar"
    click menu bar item 1 of menu bar 2
end tell
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "PiBar"
    tell menu bar item 1 of menu bar 2
        key code 125
        key code 76
    end tell
end tell