My old office was tiny (a 10×10 room shared with a deep freeze & storage) so I built a custom desk for it that was long and shallow about 8’ x 20”, and put that on a sit-to-stand frame. Worked for 5 years, but now that I’ve got a bigger space, it’s time to upgrade the desktop.

I’ve got some spare plywood, sandpaper, and white paint – lets see what I can do. 🪚

Just spent the last three hours removing a 4 person hot tub by myself, using a lot’a 2×4’s as levers, furniture dollies, ramps, and makeshift plywood roads over the grass. Freed up a whole bunch of space on our porch.

Really curious what the experience of building a WordPress site would be like now with full site editing. I’ve coded dozens and dozens of big and small PHP WordPress themes.. really thinking about redoing this site with blocks just to get a hands on idea of what’s involved building one out. 🤔

Trigger Alfred Workflow with Cron

Besides keywords or hotkeys triggering Alfred workflows, there’s External input triggers:

These input will trigger when the corresponding Apple Script code snippet is executed, the input node provides the snippet “Sample Code”:

I’ve used this many times to have one workflow trigger something in another workflow, however this week I had a need to cron trigger a workflow every minute, and run a workflow for me if a condition was met – and it turns out it was simple to throw this external trigger in cron.

To set this up in cron, I did:

$ crontab -e

I added the above Apple Script external trigger, like so:

* * * * * /usr/bin/osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "com.davidsword.tools.triggername" in workflow "com.davidsword.tools" with argument "hello world"'

Note the argument was changed to hello world in the above. Saving this, then tying a notification to the external event, every minute my Alfred Workflow will run and say hello:

Pretty simple demo above, but it unlocks a lot of possibility. My use case for needing cron was intricate:

I have a busy light outside my office door (an LED on a ESP8266 board that’s either red for in a meeting, green for working, or off when afk). I change this light with Alfred as part of a change “Slack Status” command (ss meeting|active|offline ) which changes my Slack Status/Presence and this LED light (via HomeAssistant & ESPHome). I needed a script that ran every minute, detected if I’m in a Zoom meeting or not, checked what the current light status is, then ran the appropriate “Slack Status” command for me if I was in a call (turning my LED red and changing my Slack Status to “in a meeting”), or prompted me with a notification to change my busy light to active it was detected I was no longer in a call but the light was still (incorrectly) red.

Here’s the thing, I could have wrote this script outside of Alfred and just ended the script with an Apple Script call to an Alfred External trigger for the Slack Status command to change the status itself, however I did not want to maintain this script outside of Alfred as it is only for this workflow, its just a helper script. I really appreciate that it’s possible to do this with external triggers and I can keep the script as close to home as possible. Plus its fun coding things with the workflow UI view.

The Case of the Missing L Hanger

About 6 years ago, I bought a curtain rod, it cost a couple bucks. It came with bracket/hook/hanger things to attach it to the wall. We used this rod for about a year, and then we moved and took it down with us. I never had a need for it, but I held onto it. I didn’t take the time to put the hangers in a baggy and tape it to the rod like I do with most loose parts of things – instead I just carefully kept them in my organizing tray of little parts. For years I kept careful track and inventory of these little hooks. Years.

I had a need for the curtain this week. Guess what I couldn’t find? The fucking left curtain rod hanger.

It’s okay though. This is what I trained for. I have the technology. No way was I going out to spend a couple bucks again. I made my own:

& they fit like a glove! To my surprise they even made a satisfying click sound going in, the perfect friction fit (which never happens, usually I need to prototype like twice).

Having all the hardware, material, and software to do this cost me about $2,000. This is like my tenth useful fix from this stack, so if you think about, these stupid little hangers cost me about $200, plus my time. But I saved a few bucks. 🙃

I uploaded design for hooks on Thingiverse.

Using Alfred && Apple Shortcuts to do Really Cool Things

Alfred is absolutely amazing at doing high level stuff, but actually doing application level tasks is sort of limited to AppleScript, external APIs, and other sort of work arounds. Shortcuts on the other hand, is kind of clunky to do high level stuff, but any respectable third party app will have a ton of hooks and actions for Shortcuts to interact and do things within apps.

Using both these apps together, we’d get the best of both worlds. & after reading this post and Workflow by the Alfred team, it seems there’s actually a super easy way to trigger and interact with Shortcuts from terminal, and thus Alfred:

$ /usr/bin/shortcuts --help

This is a game changer. Here’s a Alfred workflow + Shortcut mash up I did to solve a real problem I was having:

My biggest improvement working day to day was when on Zoom calls I’d sometimes forget an action item I need to follow up on. One could argue I just needed to ensure I have my note taking window open, but that doesn’t work for me as I often am deep in many windows during a call and focused on the call. What I needed and wanted was to smash a global hotkey and be presented with a text prompt, type my string, hit enter, and it’d be stashed somewhere safe (much like Things quick entry, but I don’t use Things.app for work, I keep my Todos in my Note app).

To build this, I created a “@daily quick note” Apple Shortcut which prepends a string of text to add to a note in my note taking app (currently Bear.app) in a note I use everyday.

I tried using Apple Shortcut’s text input prompt, and using their keyboard shortcut listener but:

  1. When hitting return in the Shortcut text prompt, the dialog box doesn’t close, it creates a new line 🤦‍♂️. Tab and other tricks to escape don’t work either, so a mouse move is apparently required. & That’s not gonna fly.
  2. I got inconsistent results from the global keyboard shortcut from Apple Shortcuts, it worked sometimes but not every time – it must be more reliable.

So instead I the Apple Shortcut to accept an incoming argument:

With this Shortcut setup to accept input, I then created an Alfred workflow with a keyword “+” input, where I can add my action item.

This allows me to capture a thought pretty quickly (as I’m always using and very fluent in Alfred), & globally no matter where my note apps window currently is:

After the Alfred “+” keyword input, I’ve got a simple action run script in bash that takes advance of how Apple setup shortcuts:

query=$1

/usr/bin/shortcuts run "@daily quick note" -i <<< "${query}"

So typing + email that person about that thing and hitting enter will run my “@daily quick note” Shortcut, and pass in my string from Alfred, which interacts with my note taking app, and prepends the string to my daily note, capturing my action item that I don’t want to forget for parsing later.

For bonus points, in Alfred I also setup the keyboard shortcut hotkey (which works very reliably compared to Apple Shortcuts) to run “Utilities > Show Alfred” and auto populated the “+” keyword, so I can quickly pop open Alfred with the + keyword there, and enter my string right away. A second saver to help me retire early.

This example is pretty rudimentary, I’m simply changing the user input from the unreliable Shortcuts app to the easier and more familiar Alfred app, which is great, but the bigger take away here is there’s much more potential to do more interesting things with these two apps being able to work together.