Keyboard shortcuts

Is there a way to modify the keyboard shortcuts in Geary? I see a file called ui/single-key-shortcuts.css in the source code, with the actual shortcuts. I tried editing that file and putting it in ~/.themes, but it didn’t change the shortcuts in Geary. How to do this without re-building Geary?

thanks

ui/single-key-shortcuts.css is packed as a GResource, as part of some geary shared lib / executable.

Not sure about ~/.themes.

But, you can do a couple of things:

  1. Run the following command in terminal:

$ GTK_DEBUG=interactive geary

Go to CSS tab, paste the edited single-key-shortcuts.css in the text area. The new shortcuts should work.

  1. Open a bug in geary to provide options to customize shortcut.

Thanks

You should be able to do that using ~/.config/gtk-3/gtk.css, I believe GTK reads that on app startup. The places GTK reads to load CSS at application startup are noted in the docs for GtkCssProvider.

Thanks for the reply. I never knew about debug-interactive. :grin:

After trying that I went back and looked at .themes again and found a way to change some bindings and make Geary go to the next message (newer) after Archive and Delete. Here is how I did it. First:

mkdir -p ~/.themes/Geary/gtk-3.20

In that dir, create the gtk.css file and paste in your edited css. You can change the theme with the import line. I guessed and added trash-conversations, which works. You can’t override existing bindings (apparently), but you can add new ones. May also work by putting the file in~/.config/gtk-3/,as mjog said above, but I haven’t tried that. To run Geary with the gtk.css, use this command:

GTK_THEME=Geary geary

Here is a Desktop file for it, put in ~/Desktop as ~/Desktop/Geary.desktop :

[Desktop Entry]
Version=1.0
Type=Application
Name=Geary
Icon=org.gnome.Geary
Terminal=false
StartupNotify=true
Exec=env GTK_THEME=Geary geary

gtk.css file

@import url("/usr/share/themes/TraditionalGreen/gtk-3.0/gtk.css");

@binding-set SingleKeyShortcuts {
  bind "c" { 
    "archive-conversations" () 
    "navigate" (step-up)
  };
  bind "d" { 
    "trash-conversations" () 
    "navigate" (step-up)
  };
  bind "r" { "reply-conversation-sender" () };
  bind "R" { "reply-conversation-all" () };
  bind "f" { "forward-conversation" () };
  bind "slash" { "find" () };
  bind "k" { "navigate" (step-up) };
  bind "j" { "navigate" (step-down) };
}

window.geary-main-window {
  -gtk-key-bindings: SingleKeyShortcuts;
}
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.