From 798a18973f8d1370baa11a3c4d0535349537b544 Mon Sep 17 00:00:00 2001
From: Boris Yumankulov <boria138@altlinux.org>
Date: Sun, 6 Apr 2025 12:02:59 +0600
Subject: [PATCH] Use yad tray if using dash shell

---
 data_from_portwine/scripts/functions_helper | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index 2839f590..06d22cc5 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -1941,7 +1941,7 @@ pw_kill_autostart () {
 export -f pw_kill_autostart
 
 pw_exit_tray () {
-    if [[ "$XDG_SESSION_TYPE" == "tty" ]] ; then
+    if [[ "$XDG_SESSION_TYPE" == "tty" || "$(readlink -f /bin/sh)" == *"/dash" ]] ; then
         if [[ -n "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')" ]] ; then
             kill -s SIGUSR1 "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')"
         fi
@@ -1950,9 +1950,6 @@ pw_exit_tray () {
             kill -s SIGUSR1 $(pgrep -a tray_gui_pp) 2>/dev/null
         fi
     fi
-    if [[ -n "$(pgrep -a yad_gui_pp)" ]] ; then
-        kill -s SIGUSR1 $(pgrep -a yad_gui_pp) 2>/dev/null
-    fi
 }
 export -f pw_exit_tray
 
@@ -4793,7 +4790,7 @@ open_changelog () {
 export -f open_changelog
 
 pw_tray_icon () {
-    if [[ "$XDG_SESSION_TYPE" == "tty" ]] ; then
+    if [[ "$XDG_SESSION_TYPE" == "tty" || "$(readlink -f /bin/sh)" == *"/dash" ]] ; then
         if [[ -n "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')" ]] ; then
             kill -s SIGUSR1 "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')"
         fi
@@ -4819,7 +4816,7 @@ pw_tray_icon () {
     }
     export -f tray_icon_click_exit
 
-    if [[ "$XDG_SESSION_TYPE" == "tty" ]] ; then
+    if [[ "$XDG_SESSION_TYPE" == "tty" || "$(readlink -f /bin/sh)" == *"/dash" ]] ; then
         tray_icon_click () {
             echo ""
         }