Skip to content

spaces – Displaying file name of desktop wallpaper on desktop

  • by

I have managed to find an answer. It utilizes a combination of tools, but it works. Since I don’t like answered questions to remain unanswered, here’s my solution. May it help others.

Here’s what I used:

  • Shell script
  • Shortcuts (included with macOS)
  • Plash (freeware, available on the App Store)
  • launchd (via launchctl)

Using the Shortcuts program, I started with a “run shell script” action that did a sqlite3 lookup into Apple’s database holding the file names of wallpaper images. I then captured the result into a variable. Next, I added a text field that contained web directives as specified by Plash*. Then I replaced a placeholder text with the contents of the variable. Finally, I wrote out the contents to a local file called “index.html.” This is the file Plash looks for when one specifies a “local website.”

Then, I needed a way to update the overlay as images are changed. I wrote a two-line shell script to both run the Shortcut and then reload the Plash image.

Finally, I created a plist in my $HOME/Library/LaunchAgents folder to call the two-line script every ten minutes and loaded it via launchctl.

I may tweak the output display a bit, but the core operation is now established!

One thing just occurred to me that might make it even easier: Create a Shortcut that can live in my menu bar that replaces the plist/launchd automation, allowing me to update my overlay when I wish.

*Plash is a nifty piece of freeware created by Sindre Sorhus {}. It’s feature-filled and the author is very responsive! There is a wealth of information about Plash on GitHub {}

Leave a Reply

Your email address will not be published. Required fields are marked *