New feature: toggle Jiggler with a shortcut
mmiller42 opened this issue · 2 comments
mmiller42 commented
I toggle Jiggler on and off somewhat frequently. It would be really nice if you could configure a shortcut in preferences for it.
bhaller commented
It's not under active development, but maybe it'll happen some day – especially if somebody submits a pull request for it. :->
chrisafraser commented
Until that day comes, here is a script I have created for control via other automation tooling(cron, launchd, hotkeys etc):
#!/bin/bash
JIGGLER_PID=$(pgrep Jiggler)
if [ -z $JIGGLER_PID ]; then
echo starting jiggler
/Applications/Jiggler.app/Contents/MacOS/Jiggler &
sleep 1
fi
TOGGLE="true"
JIGGLE="true"
if [[ $* == *-e* ]]
then
TOGGLE="false"
JIGGLE="true"
elif [[ $* == *-d* ]]
then
TOGGLE="false"
JIGGLE="false"
fi
osascript <<EOF
set jiggle to $JIGGLE
set toggle to $TOGGLE
tell application "System Events" to tell process "Jiggler" to ¬
tell menu bar item 1 of menu bar 1
click
set jigglingActive to (value of attribute "AXMenuItemMarkChar" of menu item "Jiggler Enabled" of menu 1 of menu bar item 1 of menu bar 1 of application process "Jiggler" of application "System Events") is "✓"
if jiggle is not jigglingActive or toggle is true then
click menu item "Jiggler Enabled" of menu 1 of menu bar item 1 of menu bar 1 of application process "Jiggler" of application "System Events"
else
key code 53 -- close menu bar
end if
end tell
ensure its executable (chmod +x jigglectl
) then run via jigglectl --enable
and jigglectl --disable
, if no flags given it just toggles the state on/off.