From 48ee8d8c2ca31126b9ef1613c570f58f9e84481c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 29 Oct 2026 11:20:41 +0100 Subject: feat(launcher): open an existing path with xdg-open Every launch now goes through a run-command wrapper. When the words rofi hands over join into an existing path (a leading ~ is expanded) that is not an executable file and has a default handler per xdg-mime, it is opened with xdg-open. Anything else is exec'd unchanged, as rofi's default {cmd} would. Co-Authored-By: Claude Opus 5.5 --- bin/udt-launcher.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bin') diff --git a/bin/udt-launcher.sh b/bin/udt-launcher.sh index 34dc556..d0e90a2 100755 --- a/bin/udt-launcher.sh +++ b/bin/udt-launcher.sh @@ -20,7 +20,22 @@ # ("graphics") filters Apps too, since drun matches on categories. # Always on DP-1, the wide monitor the 10x5 grid is sized for, whichever # monitor has focus. +# +# Every launch goes through run-command. If the words rofi hands over join +# into an existing path (~ allowed) that is not an executable file and has +# a registered handler, xdg-open it; anything else is exec'd unchanged, as +# rofi's default {cmd} would. Kept free of single quotes: it is wrapped in +# them below. +read -r -d '' opener <<'EOF' +f="$*"; f="${f/#\~/$HOME}" +if [ -e "$f" ] && ! { [ -f "$f" ] && [ -x "$f" ]; } && + [ -n "$(xdg-mime query default "$(xdg-mime query filetype "$f")")" ]; then + exec xdg-open "$f" +fi +exec "$@" +EOF exec rofi -show drun -m DP-1 \ + -run-command "bash -c '$opener' _ {cmd}" \ -modi "drun,run,󰉋 Folders:udt-folders" \ -display-drun '󰀻 Apps' -display-run '󰆍 Run' \ -show-icons -drun-display-format '{name}' \ -- cgit v1.2.3