UtkarshVerma / dwmblocks-async

An efficient, lean, and asynchronous status feed generator for dwm.
GNU General Public License v2.0
224 stars 87 forks source link

Limit clickability to blocks #26

Closed riciwom381 closed 2 years ago

riciwom381 commented 2 years ago

Hello, I've notice when you make a block 'A' clickable the following blocks will trigger the functions of block 'A', unless they have their own functions. Well I would like those following blocks not to trigger functions of block 'A', only trigger them if I click on block 'A'.

I'm using vanilla dwm 6.3 with statuscmd and I've test with the following: config.h

#define CMDLENGTH 45
#define DELIMITER " | "
#define CLICKABLE_BLOCKS

const Block blocks[] = {
    BLOCK( "echo foobar",              0,    0 ),

    BLOCK( "$HOME/foo.sh",             0,    1 ),
    BLOCK( "echo foobar",              0,    0 ),

    BLOCK( "$HOME/bar.sh",             0,    2 ),
    BLOCK( "echo foobar",              0,    0 ),

    BLOCK( "date '+%H:%M'",            60,   0 )
};

foo.sh

#!/bin/sh

case $BLOCK_BUTTON in
    1) notify-send foo ;;
esac

echo foo

bar.sh

#!/bin/sh

case $BLOCK_BUTTON in
    1) notify-send bar ;;
esac

echo bar

I don't want the date or 'foobar' to trigger anything if I click them, Could you help me, please?

UtkarshVerma commented 2 years ago

Unfortunately, there's nothing I can do on my end to approach this. It is a limitation in the statuscmd patch. However, you can work around this by exiting your block script prematurely on mouse events.

case $BLOCK_BUTTON in
    1|2|3|4|5) exit ;;
esac
echo foobar
UtkarshVerma commented 2 years ago

Closing this due to inactivity.