Mauricio Posted February 2, 2015 Share Posted February 2, 2015 Hi there, I'm Mauricio and new to this forum I like to program in my spare time and have just reviewed the change log of v2.6 which includes Ability to set theme UID externally via AppleScriptAnd I want to know how to do this exactly, where can I find more information about this? My goal is to switch themes when f.lux enables the Dark Theme of OS X at sunset (or in reverse of course). Would love to hear any ideas on this. Cheers! Link to comment
Andrew Posted February 2, 2015 Share Posted February 2, 2015 Hi there, I'm Mauricio and new to this forum I like to program in my spare time and have just reviewed the change log of v2.6 which includes Ability to set theme UID externally via AppleScriptAnd I want to know how to do this exactly, where can I find more information about this? My goal is to switch themes when f.lux enables the Dark Theme of OS X at sunset (or in reverse of course). Would love to hear any ideas on this. Cheers! Here you go... http://www.alfredforum.com/topic/5138-change-the-alfred-theme-within-a-workflow/#entry31375 In OS X's Script Editor, you can open Alfred's AppleScript dictionary which tells you Alfred's AppleScript methods Cheers, Andrew Link to comment
Mauricio Posted February 3, 2015 Author Share Posted February 3, 2015 Thank you that is great! I now only need to find a way how to trigger this script when my theme changes. Any thoughts on that maybe? Link to comment
deanishe Posted February 3, 2015 Share Posted February 3, 2015 This AppleScript will change Alfred's theme based on whether dark mode is on or off, but I haven't figured out a way to trigger it automatically when dark mode is toggled. You might have to use a Launch Agent to run it every 5 minutes or so (or grab a list of sunset times for your location from somewhere). tell application "System Events" tell appearance preferences to set dark mode to false if (dark mode of appearance preferences) then tell application "Alfred 2" to set theme "Dark" else tell application "Alfred 2" to set theme "Light" end if end tell Link to comment
deanishe Posted February 3, 2015 Share Posted February 3, 2015 (edited) I really like the idea of toggling Alfred's theme, so I've written a Python script that will change your theme to/from dark at sunset/sunrise. It isn't possible to hook into f.lux directly (or OS X's dark mode), but I think this is a reasonable solution. It creates a Launch Agent that will call the script at sunrise and sunset every day to change the theme to/from dark/light. I'm looking into turning it into a workflow, but that will probably depend on being able to find an API that will let me look up latitude, longitude, elevation and timezone for a given location. Note: Seeing as I just wrote the script, it obviously hasn't been tested across several sunrise/sunset cycles. It also requires the astral and pytz libraries. Get the script here. Edited February 3, 2015 by deanishe Link to comment
Mauricio Posted February 11, 2015 Author Share Posted February 11, 2015 That looks great I'm going to try it out thanks Link to comment
deanishe Posted February 19, 2015 Share Posted February 19, 2015 I've been tinkering with and running the script for a week or two now, and it's working very well. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now