Toggle Andy mode (with Keyboard Maestro on macOS)

I love the magical Andy Matuschak mode enabled by @death.au’s CSS wizardry, but I don’t want it on all the time.

This macro uses the same trick used in Zen/focus mode with automation to edit obsidian.css to toggle Andy mode.

It requires Keyboard Maestro on macOS. Edit the location of your .css file before using.

Download it here:

6 Likes

This is brilliant! Been using it for a while with my custom CSS theme. I have recently had a problem with it, wondering if you could help.

I prefer a slightly less intense drop shadow for Andy Mode.

The default shadow is

.mod-root.workspace-split.mod-vertical > div { 
  min-width: calc(700px + var(--header-width)); /* <-- 700px is the default theme's "readable" max-width */
  box-shadow: 0px 0px 20px 20px rgba(0,0,0,0.25);
  position:sticky;
  left:0;
}

The shadow I prefer is

.mod-root.workspace-split.mod-vertical > div { 
  min-width: calc(700px + var(--header-width)); /* <-- 700px is the default theme's "readable" max-width */
  box-shadow: -8px 0px 24px -16px rgba(0,0,0,0.33);
  position:sticky;
  left:0;
}

But updating this line in the “Append Text to File” part of the KM script causes it to break.

Once I’ve edited the shadow value, pressing the Hotkey in KM appends the text to the CSS file correctly. However, it will no longer remove it correctly when I press the key again. I’m stuck in Andy mode until I return the shadow value to its default in KM. Once the value is returned to default, everything works as expected.

Know this is super niche and a minor request, but do you have any idea why editing values in “Append Text to File” section is causing this to break?

Hmm. What about it breaks? Like, what are the consequences of the change?

So if I’ve got Obsidian in default Andy-less mode, and I change the value of the shadow in the KM script, and then run the KM script it enables Andy mode as intended with the new shadow (all good so far!).

But if I hit the hotkey again, it won’t disable Andy mode. If I go back to KM and change the shadow values back to default, everything works again (both enabling and disabling).

It’s really a small detail, I’ve just been living with the default shadow. Was more curious as somewhat of a KM noob if there was just something I’m missing about how this action is working when I make a small tweak that causes it to break.

Oh, sure, that’s easy.

The script enables Andy Mode by appending the Andy Mode CSS to your obsidian.css file. It works to disable Andy Mode by finding-and-replacing the exact same CSS code in Obsidian.

So, if you edit the code used for appending, you also need to edit the code used for finding-and-replacing. That’s the first action under the If statement: Search and Replace Variable “Obsidian CSS” Using String (ignoring case).

You probably missed it because the line for the Find query is only one line tall, but it actually scrolls inside there. Just copy your Append text and overwrite what’s currently in the Find string.

1 Like

Ah! That’s exactly it! Totally missed it because of the Find Query being one line tall. It’s working perfectly now. Thank you so much! Really loving this macro, one of my most used for Obsidian.

1 Like