Skip to content

Commit

Permalink
Open images with Loupe by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jan 12, 2025
1 parent 3e50a2c commit 4d10b71
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions home-manager/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand All @@ -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) );
};
};
}

0 comments on commit 4d10b71

Please sign in to comment.