Score:1

Add "My App" to Context Menu in Ubuntu

cn flag

I have developed an app "MonitorMe" for Ubuntu.

In ubuntu I have seen now Microsoft has added Open With VS Code in Context menu without using Nautilus Action.

I want to add an option in context menu of Ubuntu like "Open with monitorme". How do do it?

Thanks.

Score:0
cn flag

In Ubuntu 20.04, you could still use nautilus actions, but in 21.04, this does not work anymore.

What still always worked are Nautilus scripts. You put your script (with the executable bit set) in ~/.local/share/nautilus/scripts. They will then appear as a submenu of a "Scripts" right-click menu item. The Ubuntu Community help page contains more information on how it works.

Score:0
es flag

If your application works on a certain type of file (a MIME type), you can write a .desktop file and associate your application with that MIME type; then it will be available in all file managers.

If you don't have any specific MIME type, you can cheat and use MIME type inode/directory, then you can open it from the context menu of directories.

Examples:

Minimalistic .desktop file

[Desktop Entry]
Type=Application
Name=MyApplication
Exec=myapp %f
Icon=myapp
GenericName=MyApplication that does cool things
Terminal=false
MimeType=inode/directory;

Move that file to /usr/share/applications to make it available for all users on your machine. If you create a .deb package from your application to distribute it, install the .desktop file to /usr/share/applications in your make install step and package it with your application.

Further Reading

Dhruv Viresh Gandhi avatar
cn flag
Thanks it helped a lot
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.