Cinnamon: Universal Support for Emacs Keybindings

Created on 14 Jan 2015  路  12Comments  路  Source: linuxmint/cinnamon

The wiki says filing feature requests as issues is all right, let me know if there's someplace more appropriate.

It'd be nice to have support across the desktop for at least the basic emacs key bindings in text fields:

  • ctrl-a for beginning of line
  • ctrl-e for end of line
  • ctrl-f for forward char
  • ctrl-b for backward char
  • ctrl-d for delete char
  • etc

OS X supports this across all Cocoa apps and it's among my favorite features. What might it take to support this in Cinnamon?

FEATURE REQUEST

Most helpful comment

Linux Mint 17.2 (rafaela). I ran dconf-editor to edit org.cinnamon.desktop.interface gtk-key-theme and set it to Emacs. Then I clicked into the same field again and CTRL-A, CTRL-E, CTRL-K and a few others worked immediately in this field. The same for a the workspace selection text field of eclipse which happened to be open and even this very text field I am typing in right now. (Sigh.)

All 12 comments

I tried to accomplish this with the Gnome3 system-wide emacs keybindings (see http://unix.stackexchange.com/questions/178502/why-dont-emacs-keybindings-work-on-mint-17-1).

Theoretically setting gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs" should work, but it doesn't seem to.

Maybe fixing support for the Emacs key theme would be the easiest route for this?

org.gnome.* sets options for Gnome, not Cinnamon. There might be a corresponding key in org.cinnamon.desktop.interface, though I can't check now. I recommend installing dconf-editor from your repositories and using that to look for things (it provides a GUI to gsettings).

I don't think there's a similar option for Cinnamon. Nothing shows up for this (or similar searches):

gsettings list-keys org.cinnamon.desktop.interface | grep emacs

Supporting emacs bindings universally in Mint would also conflict with application local bindings. I tried Gnome3's emacs key theme and it's an issue there, too. For example, when composing a message in Thunderbird, C-p should go up a line, but it brings up the print menu instead. Thunderbird overrides the Gnome desktop setting.

OS X's advantage here is that the modifier key for application and window bindings is cmd, not ctrl, so applications don't conflict with Cocoa and Cocoa can provide support for emacs bindings in all text fields (so maybe this is more of a GTK feature request?) Perhaps a solution to this problem in Cinnamon is choose an emacs modifier other than ctrl? That'd be odd, but the alternative seems to be changing standard keybindings in all other applications, which is not very reasonable.

It is indeed org.cinnamon.desktop.interface gtk-key-theme

Good catch @mtwebster, thanks. That setting doesn't seem to have any effect, though. I set it to both "emacs" and "Emacs" via:

gsettings set org.cinnamon.desktop.interface gtk-key-theme 'Emacs'

and there was no difference in behavior of text fields (I did log out/in after each change). Specifically, I tested it in a Nemo search, the menu search, and in a system settings text field. None of the keybindings (which seem to be defined at /usr/share/themes/Emacs/gtk-3.0/gtk-keys.css) have the expected effect.

That worked for me:

gsettings set org.cinnamon.desktop.interface gtk-key-theme "Emacs"

Thanks @mtwebster! I've been searching for a way to do this for ages.

I tested it in Chrome and it worked as expected, although the file browser has it's own ideas. Ctrl-D works, but the other shortcuts are overridden.

FWIW - these shortcuts already worked in the terminal without any update of the key theme.

Is there somewhere I could add this to documentation to make it easy for other folks to find?

Like you mention @rathboma, Emacs keybindings in terminal is actually a function of Bash. Many shells also support vi mode.

It's interesting that it worked in Chrome, especially since (I think) Chrome is no longer even based on GTK. Google must have decided to read that setting to blend in with the rest of the desktop environment, but ironically they're the only window that actually _is_ obeying it.

The goal here would be general support across Cinnamon, and that has to include the core Cinnamon apps (file browser, menu, system settings, etc). 3rd party app support--at least when not based on GTK, like Chrome--would be a bonus.

The finding that the gtk-key-theme setting actually exists for Cinnamon and has no effect makes this sound more like a bug report than feature request. But either way, I'd just like to see it work.

Linux Mint 17.2 (rafaela). I ran dconf-editor to edit org.cinnamon.desktop.interface gtk-key-theme and set it to Emacs. Then I clicked into the same field again and CTRL-A, CTRL-E, CTRL-K and a few others worked immediately in this field. The same for a the workspace selection text field of eclipse which happened to be open and even this very text field I am typing in right now. (Sigh.)

gsettings set org.cinnamon.desktop.interface gtk-key-theme "Emacs"
...worked perfect for me, you beautiful human being, thank you!

If anyone wants to create their own gtk-key-theme, they should "fork" one of the existing ones (e.g. Emacs) into their ~/.themes folder, because the directory structure is important. I think the name may also be important, because for me myTheme did not work, but Mytheme works.

Then, you can edit the gtkrc and gtk-keys.css files to your liking. You can find details about various fields from here

Many thanks for contributing to Cinnamon. Your suggestion was reviewed. Your job is done and we'll take it from here :)

For more information on our workflow and feature requests, read https://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/faq.html

gsettings set org.cinnamon.desktop.interface gtk-key-theme "Emacs"

does not work in 19.3 (Cinnamon version: 4.4.8).

Was this page helpful?
0 / 5 - 0 ratings