Toggle Night shift and update button

Hey,

I have added a new widget in my btt with a script to activate dark mode and update the widgets appearance.

tell application "System Events"
	tell appearance preferences
		get properties
		if dark mode is false then
			return "OFF"
		else
			return "ON"
		end if
	end tell
end tell

I want to do the same with nightshift. The toggle button works fine but I cannot update the button because I have not found how to get the "nightshift-state"

unfortunately the nightshift switch in the macOS sidebar is not updated by the toggle-button of btt (the dnd switch is directly updated with this:

tell application "BetterTouchTool"
return get_number_variable "SystemDoNotDisturbState"
end tell

Any ideas?

Would be very happy if you could help
thanks and br
Paolo

1 Like

I forget if there was a reason this couldn't be done @Andreas_Hegenberg? I've been asking for this one for a while :stuck_out_tongue:

@yuuiko recently pointed out that I forgot to document this variable: BTTInternalNightShiftState (should already work since quite a while). However it does only reflect the BTT internal night shift state, which is not necessarily in sync with the system Night Shift. So it only works if you use the BTT night shift actions.

thanks - that worked out. Great!

as you have stated, it is not in sync with OS X - but that's cosmetic :wink:

@Andreas_Hegenberg recently my users have been having issues with it and I didn't realise it was BTT internal only...

Do you think there's a way to detect system nightshift and true tone?

1 Like

Is there a way macOS can notify BTT of changes? A subscribe mechanism?

Issue I run into is the following:
When macOS triggers Night Shift due to the set schedule, and when I want to manually disable it (want to present in a Webex meeting, and don't like yellow colored desktop for all my participants), I have to use the shortcut twice. The first one will fail.

Found something with defaults read!!! @GoldenChaos

Imprint | Privacy Policy