diff options
| author | Joe Fiorini <joe@joefiorini.com> | 2019-10-22 16:16:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-22 16:16:30 -0400 |
| commit | be6c50d95f79590ec990fc69dae635c19c96604b (patch) | |
| tree | f0394a53b450334cc79b1959a0721f49180cd55b | |
| parent | 7fb4939bf1dcae6274aa1a75ac485bbf556da4e7 (diff) | |
| download | sway-launcher-desktop-be6c50d95f79590ec990fc69dae635c19c96604b.tar.gz sway-launcher-desktop-be6c50d95f79590ec990fc69dae635c19c96604b.zip | |
Add Terminal property support
| -rwxr-xr-x | sway-launcher-desktop.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sway-launcher-desktop.sh b/sway-launcher-desktop.sh index efcb8e2..52fdf7a 100755 --- a/sway-launcher-desktop.sh +++ b/sway-launcher-desktop.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash # terminal application launcher for sway, using fzf # Based on: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher +# https://gist.github.com/Biont/40ef59652acf3673520c7a03c9f22d2a shopt -s nullglob if [[ "$1" == 'describe' ]]; then @@ -19,6 +20,8 @@ if [[ "$1" == 'describe' ]]; then exit fi +TERMINAL_COMMAND="termite -e" + HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-history.txt" DIRS=( @@ -129,7 +132,7 @@ desktop) # 3. We see a Path= line during search: set variable # 4. Finally, build command line command=$(awk -v pattern="${PATTERN}" -F= ' - BEGIN{a=0;exec=0; path=0} + BEGIN{a=0;exec=0;path=0} /^\[Desktop/{ if(a){ a=0 @@ -138,6 +141,12 @@ desktop) $0 ~ pattern{ a=1 } + /^Terminal=/{ + sub("^Terminal=", ""); + if ($0 == "true") { + terminal=1 + } + } /^Exec=/{ if(a && !exec){ sub("^Exec=", ""); @@ -153,7 +162,10 @@ desktop) END{ if(path){ - print "cd " path " &&" + printf "cd " path " &&" + } + if (terminal){ + printf "$TERMINAL_COMMAND " } print exec }' "${PARAMS[0]}") @@ -162,4 +174,5 @@ command) command="${PARAMS[0]}" ;; esac +echo "Executing command: \"$command\"" >> ~/.local/var/log/sway-launcher.log swaymsg -t command exec "$command" |
