Services item in editor menu on Mac

Electron apps are not compatible with many OS features without significant effort to set them up, as far as I understand.

I have not used Zotpick, though, so I have no idea how it works. The readme says it should “work with any app.” I imagine that this line…

  • If you use an app-launching utility that lets you assign key combos to apps, use that to launch these scripts.

…means that you should be able to call Zotpick with e.g. Alfred or Keyboard Maestro. Have you tried that?

1 Like

Having not to be able to assess System Services on macOS is really sad to me, because I’ve written quite a lot of services to support writing in Markdown. I would be happy to assess this functionality in Obsidian without having to switch to an external editor.

I understand this, however, many other Electron apps like Typora or Mark Text do support System Services, so I still hope to see it added to Obsidian too.

8 Likes

I think the intention or point is that existing services would be able to be used as is without much if any modification to obsidian.

So, for example, maybe no one has to make or install an Obsidian plugin for formatting markdown tables - but instead we could had a services menu – and could use one of Brett’s existing scripts: https://brettterpstra.com/projects/markdown-service-tools/ .

The services scripts can just take and replace the selected text.

So long story short, it seems like it would require very little work, but would be a way to easily add value to Markdown, especially with the tools linked above.

1 Like

Another vote here to use standard macOS services menu.

There’s a bunch of very very useful functions, like Brett Terpstra’s SearchLink which takes the selected text and returns markdown-formatted links, and it has super powerful customization.

Or also a smart converter for Title Case that respects products capitalization and APA style.

They work with every other markdown editor and even some electron apps—so definitely possible and doable.

2 Likes

MacOS Services Menu … YES.

4 Likes

An observation that adds hope to this being possible is that Typora, which is Electron, has it:

I was excited about this suggestion, so I reached out to the developer of Typora to ask for tips on how they did it. They were kind enough to respond. Sadly, though, Typora on the Mac isn’t actually based on electron, but some native frameworks. So, this won’t directly help us on Obsidian.

I’m thinking a two-stage approach might work: a command for “Run macOS text services on selected text,” that then offers the services menu, perhaps via e.g., an NPM package offering a Javascript-Objective C/Swift bridge.

Edit: it seems it is possible to programmatically call the services menu:

4 Likes

Oh wow: Typora has always been upheld as a champion Electron app but I didn’t realise it was only the non-MacOS versions.

Hmm that would solve a lot of issues but might be going against the grain of how Services work in MacOS. It is usually also present in an app’s title menu option. Only on selected text limits services to not be applicable to higher scopes like the note file itself.

Would love that too! I’m using services to sort paragraphs or add "* " to a paragraph.

I’d love to have a Hotkey for ALL CAPS (e.g Shift Command U) :wink:

Just like to add my vote for access to the ordinary trans-app Mac contextual menu functions, in particular the ability to highlight a word, control-click, and then have the option Look Up “highlighted word”. Particularly useful if working in second language.

You can “easily” (for given values of easy) replace the services you need using Keyboard Maestro.
I have a very simple KM macro

  • it’s in a group that’s only active in Obsidian
  • The action simulates a copy keystroke, sends the variable over to an AppleScript call of SearchLink:
set myVar to do shell script "echo $KMVAR_LinkQuery"

set myString to do shell script "automator -r -i " & quoted form of myVar & " ~/Library/Services/SearchLink.workflow|awk '/http/{gsub(/^[ 	]*\"|\"[	 ]*$/,\"\"); print}'"

return myString

and voilà. I just use the same keyboard shortcut for this macro than for my SearchLink macro and I don’t see the difference.

It’s a hack, you need KM, but it works.

1 Like

Hi Obsidians!

After hours of getting know Obsidian (fantastic!) then customising and adjusting to my needs, I hit that wall too! What a sad disappointment…:crying_cat_face:
It is absolutely a must for serious daily research routines (including of course the celebrated ZotPick)

But, wait a moment :star_struck:, I said to myself, I developed several electron apps, and AFAIR all of them had that menu item! In fact, it is as easy as including this line:

{ role: 'services' },

in the menu template (developers will know).

You can even make it conditional (depending on the OS), like in this example:
https://www.electronjs.org/docs/latest/api/menu#examples

30 seconds of work, plus compilation time, definitely worth of it!
Please, consider this improvement.

I will come back to obsidian when services are back too, have no other choice. See you, hopefully!

2 Likes

@erbarium Interesting!

@ryanjamurphy Might it truly be this simple? If so, could it be tested in the next insider build?

No, not that simple. Obsidian offers its own context menu. This is what allows e.g., plugins to offer custom right-click options depending on the context of the click.

@ryanjamurphy Signal on macOS is also an Electron app, and like Obsidian it has its own context menu, and does support Services:

Count me in as another user dependent on macOS Services for my workflows, making Obsidian far less valuable that it would otherwise be on macOS. :disappointed:

The Services menu is how Automator workflows, Shortcuts, and services provided by third-party apps perform operations in general or on data in a specific context or application.

See Services in Apple’s Human Interface Guidelines.

I’m surprised it would ever not be available in any app, because it’s such an essential, system-wide function. Obsidian is the only app I’ve ever seen that doesn’t have a Services menu.

Sorry, I was specifically commenting on the idea of having a right-click available Services menu, as demonstrated by a screenshot earlier in this thread:

I was under the impression that accessing Services via the menu bar was not the same thing as accessing Services via the context menu. Is that not true?

@ryanjamurphy I haven’t used electron, but the documentation seems to suggest that the MenuItem class is used for both application menus and context menus. However, there are some macOs only roles that limit their implementation to the application menu.

services - The submenu is a “Services” menu. This is only intended for use in the Application Menu and is not the same as the “Services” submenu used in context menus in macOS apps, which is not implemented in Electron.

At the very least, is it possible for the Obsidian team to enable the application menu services option using the provided electron MenuItem class? This should enable hotkeys that use services to perform actions (i.e. I use services with automator scripts to quick-switch to my primary applications) while avoiding the question of services within the context menu for now.

After that quick fix, maybe it would be possible to implement services to the context menu by looking at how the electron-context-menu plugin achieves it (looks like a just adding the aforementioned MenuItem to the custom context options).

This will be worked on in v0.15.x.

3 Likes