Brainstorming cool ways to use CurrentKey via its AppleScript support

My hope is that CurrentKey helps you use your Mac more productively and that you can have some fun along the way. Because I have added extensive AppleScript support, there are endless possibilities to spice up your Mac experience.

A simple AppleScript that will do something custom upon entering a specific Room (Space) or activating an app.

What could I do with this power?

Just brainstorming off the top of my head, here are some ideas for theme-based Room customization, as well as scripts or individual actions that could make sense to trigger (upon entering/leaving Rooms).

On alerts when you enter a Room: automatically bring a specific app to the front? ✅ take a screenshot? ✅ mute the volume? ✅ toggle macOS dark mode? ✅ activate LED desk lights? ✅ trigger and IFTTT routine? ✅ selectively start/stop a timer based on what Room you are in or App is active? ✅ You can even pass parameters along to a Python script. Here’s a tutorial.

You can also pair Room alerts with CurrentKey’s support for 14 AppleScript commands for even more nuanced outcomes.

Ideas for unique Room themes:
  • Have a “language learning” Room, and assign custom internet radio stations for them with Broadcasts, so it would start playing a Spanish station when you go into your Spanish Room! 🗣️ (click the tutorial ^ 😁)
  • Show a banner notification with the name of each Space/Room you move into. (Here’s the tutorial)
  • Have a “Weather” Space and refresh several weather radar maps in Safari, Chrome, or Brave, immediately upon entering. ☀️
  • Give each of your Spaces a picture-in-picture video intro with Helium 3. 🎬 ➡️ 🎥
  • Have a “distraction free” space that mutes volume, activates dark mode, hides dock, and turns off WiFi. 🤫 It could return settings to normal when leaving.
  • Have a “Communication HQ” Room that will automatically sync your Mail app to check for latest email upon entering… and sync your Evernote notebooks too. 📬 🔄
  • Assign each room in your house to a different Room in CurrentKey, so that when you walk into your kitchen, you’re taken to the Space with your recipes, kitchen timers, and more! This is possible with EventScripts and iBeacons. 🏠

A list of specific actions you could selectively combine to create really cool scripts:

  • Create a smart Pomodoro timer that stops and starts when you’re in specific apps (or Spaces). This one already has AppleScript support 🍅 ⏱
  • Refresh a specific webpage in Chrome, Safari, etc (they all support automation), either when that browser becomes active (with App change notifications), or when you enter a room.
  • Pause/resume a screen sharing application
  • Bring a specific app to the front
  • Activate smart home things, like LED lights, sound systems, etc
  • Hook it up to IFTTT to run a Room-specific workflow
  • Refresh Mail’s Inbox for new messages with its “check for new mail” command
  • Have the name of the current Room (Space) be read aloud
  • Take a screenshot
  • Run a local Python script
  • Start/pause an Amphetamine session, which actually has terrific AppleScript support.
  • Start a presentation
  • Play a specific set of Spotify tracks
  • Crank up or mute your Mac’s volume
  • Pause/unpause your media player
  • Automatically tell a Slack channel you’ve left or entered a Room.
  • Add a note, maybe with additional context via CurrentKey’s stat-fetching commands, in a powerful program like Agenda, which puts such notes on a timeline.
  • Start a Photos slideshow.
  • You can use CurrentKey’s stats-fetching commands, to add more nuance, like only activating certain scripts if certain time-spent threshold had/hadn’t been met. You can even tell a CurrentKey to go to a certain Room programmatically. So you could move between your Spaces with a remote control (or a phone) 🕹️!
  • Have an app you’d like me to build into a Rooms workflow? Let me know on Twitter!

How is this enabled and set up?

First, head to the new Background Services panel, found via Preferences. Next, click the Open button that is next to the “It will look for a user-provided “ck.scpt” in this folder:” label. This will open your Finder to the directory that you will place your custom AppleScript.

In the example above, the AppleScript will get called with a “roomName” parameter. It checks to see if the Room’s name is “coding”, and if it is, it brings Xcode to the front through AppleScript’s “activate” command. If you move into a fullscreen app, the parameter will read “_fullscreen_”.

This concept is simple and powerful, enabling you to trigger Room-specific functionality outside of the app. Let your imagination run wild with all the possibilities: turn on cool LED lights when you enter your gaming Room? You can write a script for that! Bring your favorite programming app to the foreground when you enter your coding Room? Write a script for that! Pause a timer when you leave a specific Room? It can be done! The possibilities are infinite! There’s a tutorial that includes a video here.

How to give each of your Mac’s Spaces a custom sound 👂🏻

We all know about the MacOS feature called Spaces, and many of us love splitting our projects, work, and hobbies across our virtual desktops.

What if you could not just assign a name to each Space but also assign a custom Internet radio station to each one too? As you move between them, immersive sound would automatically start playing. Thanks to AppleScript support in Broadcasts (by Steve Troughton-Smith), this is possible! (Skip ahead to the video below to see it in action.) Here’s a common use case:

Say you’re studying a second language and arrange your learning materials in a Space you call “Spanish”. I’ll share a script below that…. When you move into your “Spanish” Space, will tell Broadcasts to play a radio station by its name, in this case “Cadena SER España“. Let’s say you want another Space for all things related to your hometown sports team. In my case, this would be the Texas Longhorns. So when I move into “Sports”, we’ll play from the “104.9 The Horn Austin Sports Talk” station. Great! I love programming to electronica, so I’ve set my “coding” Room to play the excellent station “Monstercat“, and – just for kicks – set the OS to Dark Mode.

A quick demo of the apps and script in action.

But there’s just one thing though… What about our other Spaces? In this demo, the script has been written to tell Broadcasts to automatically pause its playback when it goes to any other Room (and turn off Dark Mode).

For more ideas on what could be automatically triggered upon entering/leaving Spaces, check out this blog post! 💡

How it’s done

First, you’re going to need to have Broadcasts. Check it out, and if you like it, grab the full version (it’s currently a $5 in-app purchase).

Next, you’re going to need CurrentKey Stats (App Store link), which is free.

The tutorial video below will show you how to do everything from scratch in under five four minutes!

The steps in the video involve:

  1. Opening CurrentKey and Broadcasts.
  2. Adding the Stations you want in Broadcasts.
  3. Naming the Spaces you want in CurrentKey.
  4. Enabling AppleScript support in CurrentKey.
  5. Moving this script (modified for the Stations/Spaces you want), to CurrentKey’s Scripts folder.
  6. Clicking OK on the Mac’s permissions dialog so CurrentKey can talk to Broadcasts (and if you want the Dark Mode functionality, the System Preferences).

That’s it!

For more about the other new features in CurrentKey Stats 3.0, check out the latest blog posts.

The idea had a minor splash on Twitter, and that was fun to see.

That advertisement on the Sports channel 😂

Power-user tutorial: Set up banner notifications that will tell you the name of the Space you just moved into!

Since CurrentKey Stats’ launch, users have often asked for a way to see their Spaces'(Rooms’) names without clicking the menubar icon. The most recent request was just yesterday. The commenter said: “Hi just tried ur app. Its a nice start but if you dont show the name somewhere i won’t be bothered to click on the icon to see in which room i am”.

Fortunately, there’s an easy way to accomplish this! We will use CurrentKey’s Room Change Alerts to issue push notifications! Here’s what it will look like:

How to set it up:

  1. Open CurrentKey and give each Space a name.
  2. Enable AppleScript support in CurrentKey. (see below screenshot)
  3. Move this script to CurrentKey’s Scripts folder (There’s a button to open this folder in the Background Services window). (See screenshot of file)
  4. Clicking OK on the Mac’s permissions dialog if prompted

Here is what the script looks like:

It’s just that easy! You can do so many things with this powerful functionality, even give each of your Spaces a custom sound. More brainstorming fuel is available here.

CurrentKey Stats counts the number of minutes an app is in the foreground (😄), unlike Mac’s Screen Time, which counts the total time an app is running

As this popular reddit post aptly points out: “Screen time for macOS should only count the minutes when the app is open in the foreground” , there’s a basic problem with Screen Time for Mac. Unlike with its iOS counterpart, the stats that it relays to the user are largely useless, because they don’t represent active usage. An even more popular post asserts the same thing.

Reviews of macOS caught on to this fact too, like in Mac Stories, which said: “In Screen Time, every minute Music is open is recorded even if I don’t switch to the app again until the playlist is finished. Screen Time even tracks the Finder, which you can’t quit. That’s accurate if what you’re tracking is your open apps, but it’s not the same thing as how much you’re using each app. … I’d prefer if Screen Time on the Mac recorded only the time spent in the app that has the focus.”

Fortunately, you can address this issue with a free and privacy-respecting app from Apple’s App Store called CurrentKey Stats. It breaks down the time you’ve spent in active apps into a bunch of pretty graphs that include day-by-day and hour-by-hour breakdowns. It also lets you download reports and has other workflow management features too. Enjoy!

The EU’s DSA would force Apple to publish my mailing address in the App Store

For now, CurrentKey Stats will not be offered in the EU due to the DSA. I’ve received messages and emails from users in the EU asking about why it’s unavailable, and all I can say is: hopefully its a temporary outcome.

Like all indie developers on the App Store (and I guess Play Store), I am faced with a crazy situation. If I want to offer my app in the EU, I must let the store owner (in this case, Apple) post my phone number, email address, and physical address publicly on the App Store listing. Small indie dev shops like mine often don’t have P.O. boxes, so my business address is… personal. All of that contact info will, I assume, be available for bots to scrape. No thanks.

The dilemma is brought to us by a government that ostensibly cares a great deal about privacy – and in many cases, more so than its peers. But not so in this case.

The DSA requires developers who qualify as “Traders” (basically anyone trying to make money, as far as I can tell) to make a declaration as shown below:

Many developers have complained and/or are willfully refusing to comply (by telling Apple they are not a “trader” under DSA).

Many have noted in these forum posts that you can get a PO box, create a new “clean” email address, and get a prepaid phone number to preserve your privacy. Ok? All of that sounds expensive and also like a major hassle. I just want to focus on writing software.

Apple makes it easy to pull your app from stores in EU countries.

But this is tricky if you have a paying customer base in the EU. Fortunately, CurrentKey Stats does not (because its transition to a paid model happened after this DSA requirement was known).

I can imagine ways Apple could follow the spirit of the law, while also protecting and/or assuaging the privacy concerns of developers. Perhaps by simply putting this information behind a button on each App Store listing, which would send a request to Apple for the company to respond to. This simple additional step could help prevent a single user or bot from grabbing thousands of developers’ addresses. Maybe they already plan to implement the listing in this way, who knows? Without clear communication from Apple on this, I have to assume that they will do what they say: post my personal information for all to see.

Assign specific scripts to run when you visit certain Mac Spaces and more 🖥 🎯

Most of us know about the MacOS feature called Spaces, and many of us love splitting our projects, work, and hobbies across our virtual desktops. Some find it unweildy because each Space is generic out of the box. Spaces don’t come with the ability to be named or personalized other than setting a desktop background image.

CurrentKey Stats gives you a way to assign names, custom icons, and even custom auto-run scripts to each MacOS Space (the app calls Spaces “Rooms”).

Now CurrentKey Stats recently gained the ability to trigger specific events upon entering/leaving specific Rooms, via the Background Services panel accessed in settings, as well as the ability to respond to AppleScript queries.

Between those two new features, the potential to personalize and automate workflows in Spaces skyrocketed. Want to set a custom internet radio station to each Space? You can do that!

Would you like to hook up your own scripts to CurrentKey’s powerful app stats dataset? You can do that.

Check out the extensive list of brainstormed ideas as to what you could trigger with Room Change alerts – workflows that: automatically bring a specific app to the front? ✅ take a screenshot? ✅ mute the volume? ✅ toggle macOS dark mode? ✅ activate LED desk lights? ✅ trigger and IFTTT routine? ✅ selectively start/stop a timer based on what Room you are in or App is active? ✅ You can even pass parameters along to a Python script. Here’s a tutorial.

Scripts can be aware of when you leave a Room, and can query what the list of active Rooms are. They can also ask a bunch of other questions about stats (like what is your most-used app today, or in a specific Room). Scripts can even request CurrentKey go to a specific Room.

Anyhoo, most people don’t know that it’s possible to create Space-specific automated workflows, and now you do! 😎

For a broader overview of CKStats, check out its homepage, App Store listing, or browse the demo below. Thanks!

PSA: you can rearrange your Mac’s menubar icons by pressing Command (⌘) and then clicking and dragging them

CurrentKey Stats has an icon that lives in the menubar, and a little-known trick can help you further customize where it exists.

To move your menubar icons around, press the “command ⌘” key and then simply click and drag them around, to reposition them wherever you want.

I learned this trick a few months into CurrentKey’s development, and thought I’d pass it along after chatting with a user who wished there was a way…

Introducing CurrentKey Stats 3.5, graph color palette switcher, more powerful alerts, and more! 🌈📊

Version 3.5:

  • Adds the ability to switch the color palette of all graphs and charts within the app to one of six choices. Find the button on the left side of the toolbar in the large stats view.
  • Debuts an option to auto-show the Room-selection dropdown when popover opens, for faster access to common actions.
  • Adds ability to run an AppleScript each time you change apps. This follows 3.0‘s new Room change alert feature, and enables fun ideas like making a “smart” productivity timer that will start/stop when you switch to certain apps/Rooms. It’s off by default and can be toggled on/off in the new Background Services panel.
  • Brings many other improvements, like adding a new modifier key option (Shift) to Hotkeys. Speaking of which, did you know you can assign Hotkeys to specific Rooms? This makes switching between your workspaces super-speedy. Find this in the Rooms Manager (via the popover’s Room-selection dropdown)

Overview of AppleScript and Room event triggering support

CurrentKey Stats 3.0 brought AppleScript support, which means CurrentKey now responds to 14 commands, like going to a specific Room, getting total time spent across all apps (today or yesterday), and many more!

It also added Room change alerts, which offer AppleScript support in the opposite direction (your script will get called with the new Room name).

Here’s the resource on Room change alerts and a bunch of brainstorming on how to extend functionality. 💡

Here’s the page about general AppleScript support.