You are not logged in.

#1 2017-09-14 19:40:16

l3nn4rt
Member
From: Pizzaland
Registered: 2017-05-23
Posts: 6

[SOLVED] Default app keyboard shortcuts

I'm setting up some keyboard shortcuts in MATE.
I'd like a certain combination to launch text editor, but it's not among the default ones.
I want it to be dependent on default application preferences, and not just a pluma command.
So I tought to set the command to something like xdg-mime query default text/plain | sed 's/.desktop//'.
I'm pretty sure there's a simpler way, but didn't figure out.

However this is just echo-ing the current default app, and does nothing if used where intended.:

lennart@xps-15-arch:~$ xdg-mime query default text/plain | sed 's/.desktop//'
pluma

While

lennart@xps-15-arch:~$ $(xdg-mime query default text/plain | sed 's/.desktop//')
### pluma starts and gives some output... ^C

and

lennart@xps-15-arch:~$ exec $(xdg-mime query default text/plain | sed 's/.desktop//') &
### pluma starts and gives some output... ^C

actually launch the editor correctly in a terminal, but give a popup window error if used for the keyboard shortcuts:

Error while trying the action
  ...
associated to <Bla><Bla><Bla>
[Close]

My i18n is Italian so this is not exactly what it reports, but that's the meaning.

Q: how can I set a keyboard shortcut to launch a default mime-type app and not a specified fixed one?

Last edited by l3nn4rt (2017-09-15 14:35:33)

Offline

#2 2017-09-14 19:48:25

adesh
Member
Registered: 2016-10-05
Posts: 167

Re: [SOLVED] Default app keyboard shortcuts

This is happening because of how MATE is trying to parse the command string.
Easy way out: put it in an executable sh file and set the shortcut to invoke that file

Offline

#3 2017-09-14 20:10:13

l3nn4rt
Member
From: Pizzaland
Registered: 2017-05-23
Posts: 6

Re: [SOLVED] Default app keyboard shortcuts

I hoped there's a way to avoid a script for just one line.
That's the actual workaround, but I created a directory just for these micro scripts and I find it a bit ridiculous.
However thank you smile

Offline

#4 2017-09-14 22:44:07

escondida
Package Maintainer (PM)
Registered: 2008-04-03
Posts: 157

Re: [SOLVED] Default app keyboard shortcuts

If you're ever embarrassed about making a one-line script, think of it this way: files are very, very cheap.

Offline

Board footer

Powered by FluxBB