Sample Header Ad - 728x90

why my shell script generates zombies and sometimes works weird

1 vote
3 answers
133 views
I have a simple script for the i3 window manager that shows an i3bar at the bottom of the screen when you touch its edge with the mouse. It **almost** always works fine. However, after it quits, there is **always** a zombie process. And the more this script is called, the more zombies there are. Also, for some unknown reason, the script sometimes either does not work at all, or works with a long delay.
#!/bin/sh
# i3 config:
# exec --no-startup-id xdotool behave_screen_edge --quiesce 300 bottom exec ~/.config/i3blocks/bar-toggle.sh

# shows bar
i3-msg bar hidden_state show

CURSOR_STILL_NEAR_BOTTOM=1

# We want bar to stay open until cursor moves away from its top edge
TOP_OF_BOTTOM_EDGE=735

while [ "$CURSOR_STILL_NEAR_BOTTOM" -eq 1 ];
do
    eval $(xdotool getmouselocation --shell)
    if [ "$Y" -lt "$TOP_OF_BOTTOM_EDGE" ]; then
        CURSOR_STILL_NEAR_BOTTOM=0
    else
		# time before panel hides
        sleep 0.5
    fi
done

# hides bar
i3-msg bar hidden_state hide
I can't understand what I'm doing wrong. Everything is running in Virtualbox 7.0 (Debian 12 testing installed)
Asked by Anton Vakulenko (23 rep)
Aug 5, 2024, 04:19 PM
Last activity: Aug 7, 2024, 08:07 PM