rofi: fix files to be opened with xdg-open
This commit is contained in:
parent
c8035abddf
commit
715de37954
|
@ -16,6 +16,7 @@ configuration {
|
|||
directory: "/home";
|
||||
/* display-name: text to prepend in combi mode */
|
||||
display-name: "/";
|
||||
/* `command` is the prefix to prepend (along with a space) *before* passing it off to `run-command` */
|
||||
command: "xdg-open";
|
||||
}
|
||||
drun {
|
||||
|
@ -28,8 +29,8 @@ configuration {
|
|||
/* combi-display-format: "{text}"; */
|
||||
combi-display-format: "{mode}{text}";
|
||||
|
||||
/* launch applications via xdg-desktop-portal */
|
||||
run-command: "gdbus call --session --timeout 10 --dest org.freedesktop.portal.Desktop --object-path /org/freedesktop/portal/desktop --method org.freedesktop.portal.DynamicLauncher.Launch {app_id}.desktop {}";
|
||||
/* launch applications via my own launcher, which directs them through to xdg-desktop-portal */
|
||||
run-command: "rofi-run-command '{app_id}.desktop' {cmd}";
|
||||
|
||||
drun-use-desktop-cache: true;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
};
|
||||
|
||||
suggestedPrograms = [
|
||||
"xdg-utils"
|
||||
"gdbus"
|
||||
"rofi-run-command"
|
||||
];
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
|
@ -78,4 +77,18 @@
|
|||
".cache/rofi"
|
||||
];
|
||||
};
|
||||
|
||||
sane.programs.rofi-run-command = {
|
||||
packageUnwrapped = pkgs.static-nix-shell.mkBash {
|
||||
pname = "rofi-run-command";
|
||||
srcRoot = ./.;
|
||||
pkgs = [ "glib" "xdg-utils" ];
|
||||
};
|
||||
sandbox.enable = false; #< trivial script, and all our deps are sandboxed
|
||||
|
||||
suggestedPrograms = [
|
||||
"gdbus"
|
||||
"xdg-utils"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
27
hosts/common/programs/rofi/rofi-run-command
Executable file
27
hosts/common/programs/rofi/rofi-run-command
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p glib -p xdg-utils
|
||||
|
||||
# use:
|
||||
# rofi-run-command <handler>.desktop [cmd [args ...]]
|
||||
# if a non-empty desktop file is provided, we'll just launch that.
|
||||
# else, if the cmd is `xdg-open`, then we'll treat `args` as a URI and forward that to xdg-open.
|
||||
# nothing else is as-yet supported.
|
||||
|
||||
desktop="$1"
|
||||
shift
|
||||
binary="$1"
|
||||
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" {}
|
||||
elif [ "$binary" = "xdg-open" ]; then
|
||||
exec xdg-open "$@"
|
||||
fi
|
||||
|
||||
printf "no .desktop file, and unexpected binary; not invoking: %s %s" "$binary" "${binArgs[*]}" > /dev/null
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user