how to create a keyboard shortcut for a snap application?

I'm trying to launch a snap application but apparently the keyboard shortcuts are being ran with root privileges and not a user privileges which made it impossible to work.

I've tried creating keyboard shortcuts for other non snap apps and it worked fine since it's user privileges.

I tried to add "su user && " but it would ask for my password and I don't know how to make it echo my password in the same command.

I've tested my command in terminal and it worked fine but the error I get when tested in a root terminal is "mkdir: cannot create directory '/run/user/0': Permission denied"

any help is highly appreciated!


Your assumptions with respect to keyboard shortcuts being run with root priviledges is quite wrong.

What matters, for any application, be it a snap or be it a regular APT install, is to provide the correct command line for the executable. For executables that are in the search PATH, it is sufficient to provide the name of the executable as the command to run. For other executables, you need to supply the full file path.

Snap installed applications expose an executable in /snap/bin. Thus, you can see commands for all your installed snaps with

ls /snap/bin

On Ubuntu,that directory is automatically included in the $PATH. So you can run the snap by just typing the name of the executable.

In that list, find the name of the executable of the snap you want to launch with a shortcut key, and fill that name as the command associated with your shortcut key.