Monospaced Font in the Text Fields and Text Areas of Actions?

When writing scripts and such, it would be nice to write in a text field that uses a mono spaced font. Is this possible?

1 Like

Hey @fnurl,

Note the preformatted-text (or code) button in the forum editor.

Backticks can be used for inline monospaced font items.

This line is backticked

Triple-backticks may also be used for code-blocks.

set x to "One"
set y to "Two"
set z to "Three"

-Chris

Monospaced would be nice for script actions, too:

printf "Proportional fonts are hard to read: these are 3 different characters: I|l"
3 Likes

There is no current way to do that. Added to the very long todo list.

3 Likes

Hey Tom,

The best way to handle that at present is to use TextEdit as the display mechanism.

printf "Proportional fonts are hard to read: these are 3 different characters: I|l" | open -f

AppleScript will give more options still.

-Chris

Chris, I think you misread that. I meant the input field (edit field) of a script action, as shown in the screenshot above.

In KM’s output window the font already is monospaced:

Hey Tom,

Sure enough.

I hadn't noticed that the Execute a Shell Script action's output was monospaced now either which is good to know.

-Chris

1 Like

Arrived here from Google and the monospace formatting would be amazing indeed :pray:

This can be done with the font specifications described in the Preferences.

defaults write com.stairways.keyboardmaestro.editor Font-Normal -string "Monaco"
defaults write com.stairways.keyboardmaestro.editor Font-Shell -string "USER"
defaults write com.stairways.keyboardmaestro.editor Font-AppleScript -string "FIXED"
defaults write com.stairways.keyboardmaestro.editor Font-JavaScript -string "SYSTEM"
defaults write com.stairways.keyboardmaestro.editor Font-Swift -string "Times"
defaults write com.stairways.keyboardmaestro.editor Font-HTML -string "Courier:25"
defaults write com.stairways.keyboardmaestro.editor Font-JSON -string "Marker Felt:10"
defaults write com.stairways.keyboardmaestro.editor Font-Comment -string "Palatino:20"
defaults write com.stairways.keyboardmaestro.editor Font-Shell -string "FIXED"

will use a fixed width font in the Execute a Shell Script action.

2 Likes

Which of these sets the font in the Display Text action?

None, it is always the system user fixed pitch font.

Which Display Text action?

Display Text in a Window takes on the styles the user has emplaced in the action.

It would be nice to be able to set a default for that, but I've just created some favorite actions with a few preferred font styles.

1 Like

In my case I would like the output from a shell script to be displayed with at fixed font:

1 Like

See:

You can configure the fonts used for the various action text views with:

Here's how I have mine set:

defaults write com.stairways.keyboardmaestro.editor Font-Shell -string "Menlo:14"
2 Likes

Thanks. Exactly what I needed.

1 Like