sane-open: associate as the default launcher for .desktop files

This commit is contained in:
Colin 2024-05-12 17:41:00 +00:00
parent 536eb2154a
commit eadf85f66d
4 changed files with 37 additions and 16 deletions

View File

@ -770,21 +770,6 @@ in
sane-die-with-parent.sandbox.enable = false; #< it's a launcher; can't sandbox
sane-open.sandbox.method = "bwrap";
sane-open.sandbox.autodetectCliPaths = "existing"; # for when opening a file
sane-open.sandbox.whitelistDbus = [ "user" ];
sane-open.sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid" # to toggle keyboard
];
sane-open.sandbox.extraHomePaths = [
".local/share/applications"
];
sane-open.sandbox.extraRuntimePaths = [ "sway" ];
sane-open.suggestedPrograms = [
"gdbus"
"xdg-utils"
];
screen.sandbox.enable = false; #< tty; needs to run anything
sequoia.sandbox.method = "bwrap"; # TODO:sandbox: untested

View File

@ -101,6 +101,7 @@
./rtkit.nix
./s6-rc.nix
./sane-input-handler
./sane-open.nix
./sane-sandboxed.nix
./sane-screenshot.nix
./sane-scripts.nix

View File

@ -0,0 +1,21 @@
{ ... }:
{
sane.programs.sane-open = {
sandbox.method = "bwrap";
sandbox.autodetectCliPaths = "existing"; # for when opening a file
sandbox.whitelistDbus = [ "user" ];
sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid" # to toggle keyboard
];
sandbox.extraHomePaths = [
".local/share/applications"
];
sandbox.extraRuntimePaths = [ "sway" ];
suggestedPrograms = [
"gdbus"
"xdg-utils"
];
mime.associations."application/x-desktop" = "sane-open-application.desktop";
};
}

View File

@ -1,6 +1,20 @@
{ static-nix-shell }:
{ static-nix-shell
, copyDesktopItems
, makeDesktopItem
}:
static-nix-shell.mkBash {
pname = "sane-open";
srcRoot = ./.;
pkgs = [ "glib" "jq" "procps" "sway" "util-linux" "xdg-utils" ];
nativeBuildInputs = [
copyDesktopItems
];
desktopItems = [
(makeDesktopItem {
name = "sane-open-application";
exec = "sane-open --application %f";
desktopName = ".desktop launcher";
noDisplay = true;
})
];
}