From 2bd16797c1f6f492794d881ef526c2b4dbabecf8 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 28 Apr 2023 11:23:13 -0400 Subject: [PATCH] Faster, more consistent, background forking in sofi. --- fake_home/.rofi-tabs.sh | 2 ++ fake_home/.sofi.sh | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fake_home/.rofi-tabs.sh b/fake_home/.rofi-tabs.sh index fbcfc58..4b8229b 100755 --- a/fake_home/.rofi-tabs.sh +++ b/fake_home/.rofi-tabs.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [[ "$1" == "" ]]; then bt list exit 0 diff --git a/fake_home/.sofi.sh b/fake_home/.sofi.sh index 045fabe..254c74b 100755 --- a/fake_home/.sofi.sh +++ b/fake_home/.sofi.sh @@ -1,12 +1,14 @@ #!/bin/bash +WINDOW_NAME="active-sofi-window" + # Open search window or raise existing one if [[ "$1" == "--launch" ]]; then - if existing="$(xdotool search active-sofi-window)"; then + if existing="$(xdotool search $WINDOW_NAME)"; then xdotool windowraise "$existing" else - xfce4-terminal --role='active-sofi-window' --hide-borders -e 'bash -c "/home/sage/.sofi.sh"' - # xterm -e 'bash -c "/home/sage/.sofi.sh"' + xfce4-terminal --role="$WINDOW_NAME" --title="$WINDOW_NAME" --startup-id="$WINDOW_NAME" -e "bash -c '$HOME/.sofi.sh'" + # xterm -e "bash -c '$HOME/.sofi.sh'" fi exit $? fi @@ -35,8 +37,7 @@ open_app() { # shellcheck disable=SC2086 find $app_locations -name '*.desktop' | while read -r f; do if grep "Name=$app" "$f" &> /dev/null; then - nohup xdg-open "$f" &> /dev/null & - sleep 1 + setsid exo-open "$f" >/dev/null 2>&1