From be6c50d95f79590ec990fc69dae635c19c96604b Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Tue, 22 Oct 2019 16:16:30 -0400 Subject: Add Terminal property support --- sway-launcher-desktop.sh | 17 +++++++++++++++-- 1 file 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" -- cgit v1.2.3