aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-29 11:20:41 +0100
committerDanilo M. <danix@danix.xyz>2026-10-29 11:20:41 +0100
commit48ee8d8c2ca31126b9ef1613c570f58f9e84481c (patch)
tree94333d334416a6e3d89e7f21afd15f2d538280cf /bin
parenta2287467b974c13e35016997c9dd84fea0491b5d (diff)
downloadrofi-scripts-48ee8d8c2ca31126b9ef1613c570f58f9e84481c.tar.gz
rofi-scripts-48ee8d8c2ca31126b9ef1613c570f58f9e84481c.zip
feat(launcher): open an existing path with xdg-openHEADmaster
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 <noreply@anthropic.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/udt-launcher.sh15
1 files changed, 15 insertions, 0 deletions
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}' \