From 4d10b717e454498d2c6196905c34a1153ff34b75 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 12 Jan 2025 17:15:02 +0900 Subject: [PATCH] Open images with Loupe by default --- home-manager/desktop.nix | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/home-manager/desktop.nix b/home-manager/desktop.nix index ff09e10b..fdd7a833 100644 --- a/home-manager/desktop.nix +++ b/home-manager/desktop.nix @@ -5,6 +5,12 @@ let "google-chrome.desktop" "firefox.desktop" ]; + + # Loupe is faster than browsers to open images + imageViewer = [ + # https://gitlab.gnome.org/GNOME/loupe/-/blob/47.2/data/meson.build#L54 + "org.gnome.Loupe.desktop" + ]; in { imports = [ ./gnome.nix ]; @@ -16,14 +22,26 @@ in # Don't use `xdg-settings set default-web-browser`. # https://github.com/nix-community/home-manager/issues/96#issuecomment-343650659 is old. Using both made errors such as https://github.com/kachick/dotfiles/pull/1038#discussion_r1910360832 # So use only xdg.mimeApps - defaultApplications = lib.genAttrs [ + defaultApplications = (lib.genAttrs [ "text/html" "x-scheme-handler/http" "x-scheme-handler/https" "x-scheme-handler/about" "x-scheme-handler/unknown" - "application/pdf" # I prefer to open PDF with reader, editor is not frequently used. - ] (_: defaultBrowser); + "application/pdf" # I prefer to open PDF with reader, editor is not frequently used. And native readers Papers is much heavy than browsers + ] (_: defaultBrowser)) // (lib.genAttrs [ + # Supported mime-types: https://gitlab.gnome.org/GNOME/loupe/-/blob/47.2/data/meson.build + + "image/jpeg" + "image/png" + "image/gif" + "image/webp" + "image/tiff" + "image/bmp" + "image/vnd.microsoft.icon" + "image/svg+xml" + "image/svg+xml-compressed" + ] (_: imageViewer) ); }; }; }