diff options
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}' \ |
