Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add keyboard shortcut for custom nemo action?

Tags:

cinnamon

I have an custom nemo action as explained here: https://wiki.archlinux.org/index.php/Nemo#Nemo_Actions

How can I add an shortcut for this action?

(If it can be done adding a line in ~/.gnome2/accels/nemo, then I have the additional problem that on my system this file is auto generated on every reboot, so editing something here will not help. I have Cinnamon 3.2.7 and nemo 3.2.2.)

Any suggestions? Thanks in advance! :)

like image 704
flix Avatar asked Oct 17 '22 19:10

flix


1 Answers

Nemo Action

First, you should place the myaction.nemo_action under ~/.local/share/nemo/actions/.

Then, to make a keystroke put an underscore _ in front of the letter you want. For example in the Hello _Shortcut the s is the key. So you press the right-click and then s.

Bellow is an example of my action to open files and directories with Atom:

# Custom action for Nemo File Manager for Cinnamon.
# Adds right-click open file/files or directory with Atom.
# Place it under: ~/.local/share/nemo/actions/atom.nemo_action
# For more info: https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action

[Nemo Action]
Active=true
Name=Open in _Atom
Comment=Open %F in Atom
Exec=atom %F
Icon-Name=atom
Selection=any
Extensions=any;
Dependencies=atom;
Quote=double

Global Shortcut

If you want a global shortcut, you should use the Cinnamon Keyboard setting under the System settings, go to the second tab and add your custom shortcut.
Or, if you prefer more control over CLI you can use the dconf. For example, the bellow configuration will add the shortcut Shift><Alt>a

/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/name
  'Open Atom'
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/command
  'atom'
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/binding
  ['<Shift><Alt>a']
/org/cinnamon/desktop/keybindings/custom-list
  ['custom0']
like image 112
tvl Avatar answered Oct 21 '22 04:10

tvl