Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: toggle Jiggler with a shortcut #8

Open
mmiller42 opened this issue Mar 30, 2019 · 2 comments
Open

New feature: toggle Jiggler with a shortcut #8

mmiller42 opened this issue Mar 30, 2019 · 2 comments

Comments

@mmiller42
Copy link

I toggle Jiggler on and off somewhat frequently. It would be really nice if you could configure a shortcut in preferences for it.

@bhaller
Copy link
Owner

bhaller commented Mar 30, 2019

It's not under active development, but maybe it'll happen some day – especially if somebody submits a pull request for it. :->

@chrisafraser
Copy link

chrisafraser commented Jun 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants