Flatpak themes and keyboard shortcuts

I posted last September about using a theme’s gtk.css file in ~/.themes to modify some keyboard shortcuts in Geary. This was for Geary installed from apt-type repos. Now that I have Geary v40 via Flatpak I find that it doesn’t use the same theme directory. Here is a way to specify a theme and keyboard shortcuts for Geary installed via Flatpak. I changed one or two of the shortcut command letters and also added the “step-up” feature, so after delete or archive, the next (newer) message is selected.

First run:
flatpak info org.gnome.Geary | grep Runtime

Suppose the output is:
Runtime: org.gnome.Platform/x86_64/40

Then the Flatpak theme dir is:


Let’s call this $theme-dir. And let’s say your preferred theme is Blue-Submarine. Your preferred theme must have a gtk3.0 subdir.

Create a Geary-Blue-Submarine dir in $theme-dir:

mkdir $theme-dir/Geary-Blue-Submarine

Copy some of the files from /usr/share/themes/Blue-Submarine (as root):

# cd /usr/share/themes/Blue-Submarine
# cp -r gtk-3.0 index.theme $theme-dir/Geary-Blue-Submarine

Now go into the $theme-dir/Geary-Blue-Submarine directory.

Add these lines to gtk.css (I put them at the top). Adjust bindings as you wish.

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

Then to test, run

GTK_THEME=Geary-Blue-Submarine flatpak run org.gnome.Geary

If you use a .desktop file in ~/Desktop, use this for the Exec line:

env GTK_THEME=Geary-Blue-Submarine flatpak run org.gnome.Geary

I got a lot of the above info from here:

I am not a theme expert or a Flatpak expert, so there may be other/better ways to do this :slight_smile:.

Also note that the theme directory location for Geary may change after a Geary update. So you would need to do this (as root):

mv gtk-3.0/ index.theme $newdir
cp -r gtk-3.0/ index.theme $newdir

Also, since the above changes are in /var, you should back up any added files in case some system update/re-install wipes them out.

Hi Doug, this isn’t a Geary-specific issue, but per the Flatpak section in the FAQ for themes to work in Flatpak, they need to be installed via Flatpak. So you’d need to create a Flatpak package for your custom theme, or use a workaround as described in the FAQ.

Right, not a Geary issue. But the above approach does work to theme Geary (and provide the modified shortcuts).

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