diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-29 11:20:41 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-29 11:20:41 +0100 |
| commit | 48ee8d8c2ca31126b9ef1613c570f58f9e84481c (patch) | |
| tree | 94333d334416a6e3d89e7f21afd15f2d538280cf /bin | |
| parent | a2287467b974c13e35016997c9dd84fea0491b5d (diff) | |
| download | rofi-scripts-master.tar.gz rofi-scripts-master.zip | |
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-x | bin/udt-launcher.sh | 15 |
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}' \ |
