Closed Mohamed-Fathy-Salah closed 6 months ago
You got the logic correct for the most part. What you missed is to fork the kill command. This is because dwmblocks
waits for the current execution to complete and then reads the output.
Here's how you would do this.
#!/bin/sh
case $BLOCK_BUTTON in
1)
echo "A"
(sleep 3 && pkill -RTMIN+10 dwmblocks) &
;;
*) echo "B" ;;
esac
When it gets pressed, It waits for 3 seconds, then it shows the second text. However it should show the second text for 3 seconds, then the first text again.
It got solved using sesid
#!/bin/sh
case $BLOCK_BUTTON in
1)
setsid -f bash -c 'sleep 3 && kill -35 $(pidof dwmblocks)' >/dev/null 2>&1
date "+%a %d %b " ;;
*) echo '';;
esac
When date block is pressed, it should print the output of
date "+%a %d %b "
on the status bar for 3 seconds then it should print the date sybmol. however it prints the output ofdate "+%a %d %b "
only.