rofi: split sane-open-desktop out as a helper

This commit is contained in:
Colin 2024-03-01 03:52:18 +00:00
parent e7430c41f9
commit daab5939e7
6 changed files with 28 additions and 8 deletions

View File

@ -757,6 +757,11 @@ in
rustc = {};
sane-open-desktop.sandbox.enable = false; #< trivial script, and all our deps are sandboxed
sane-open-desktop.suggestedPrograms = [
"gdbus"
];
screen.sandbox.enable = false; #< tty; needs to run anything
sequoia.sandbox.method = "bwrap"; # TODO:sandbox: untested

View File

@ -106,12 +106,12 @@ in
packageUnwrapped = pkgs.static-nix-shell.mkBash {
pname = "rofi-run-command";
srcRoot = ./.;
pkgs = [ "glib" "xdg-utils" ];
pkgs = [ "sane-open-desktop" "xdg-utils" ];
};
sandbox.enable = false; #< trivial script, and all our deps are sandboxed
suggestedPrograms = [
"gdbus"
"sane-open-desktop"
"xdg-utils"
];
};

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p glib -p xdg-utils
#!nix-shell -i bash -p sane-open-desktop -p xdg-utils
# use:
# rofi-run-command <handler>.desktop [cmd [args ...]]
@ -14,11 +14,7 @@ shift
binArgs=("$@")
if [ "$desktop" != .desktop ]; then
exec gdbus call --session --timeout 10 \
--dest org.freedesktop.portal.Desktop \
--object-path /org/freedesktop/portal/desktop \
--method org.freedesktop.portal.DynamicLauncher.Launch \
"$desktop" {}
exec sane-open-desktop "$desktop"
elif [ "$binary" = "xdg-open" ]; then
exec xdg-open "$@"
fi

View File

@ -0,0 +1,6 @@
{ static-nix-shell }:
static-nix-shell.mkBash {
pname = "sane-open-desktop";
srcRoot = ./.;
pkgs = [ "glib" ];
}

View File

@ -0,0 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p glib
# usage: sane-open-desktop org.my.desktop
# given some .desktop file (by name, not by path), ask the xdg-desktop-portal service to open it
exec gdbus call --session --timeout 10 \
--dest org.freedesktop.portal.Desktop \
--object-path /org/freedesktop/portal/desktop \
--method org.freedesktop.portal.DynamicLauncher.Launch \
"$1" {}

View File

@ -56,6 +56,7 @@ let
pipeline = callPackage ./additional/pipeline { };
rtl8723cs-firmware = callPackage ./additional/rtl8723cs-firmware { };
rtl8723cs-wowlan = callPackage ./additional/rtl8723cs-wowlan { };
sane-open-desktop = callPackage ./additional/sane-open-desktop { };
sane-scripts = lib.recurseIntoAttrs (callPackage ./additional/sane-scripts { });
sane-weather = callPackage ./additional/sane-weather { };
signal-desktop-from-src = callPackage ./additional/signal-desktop-from-src { };