UtkarshVerma / dwmblocks-async

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

can't use BLOCK_BUTTON up to 10 #32

Closed romariorobby closed 2 years ago

romariorobby commented 2 years ago

Hi, I'm not sure if this dwmblocks or statuscmd patch problem. but i can't use BLOCK_BUTTON 10. I used dwmblocks-flexipatch although i tried also this on vanilla dwm but still didn't work either. is there any limit to BLOCK_BUTTON ?

[dmm] config.h

    { ClkStatusText,        0,                   Button1,        sigstatusbar,   {.i = 1 } },
    { ClkStatusText,        0,                   Button2,        sigstatusbar,   {.i = 2 } },
    { ClkStatusText,        0,                   Button3,        sigstatusbar,   {.i = 3 } },
    { ClkStatusText,        0,                   Button4,        sigstatusbar,   {.i = 4 } },
    { ClkStatusText,        0,                   Button5,        sigstatusbar,   {.i = 5 } },
    { ClkStatusText,        ShiftMask,           Button1,        sigstatusbar,   {.i = 6 } }, // Shift + Left
    { ClkStatusText,        ShiftMask,           Button2,        sigstatusbar,   {.i = 7 } }, // Shift + Middle
    { ClkStatusText,        ShiftMask,           Button3,        sigstatusbar,   {.i = 8 } }, // Shift + Right
        { ClkStatusText,        ShiftMask,           Button4,        sigstatusbar,   {.i = 9 } }, // Shift + Scrollup
    { ClkStatusText,        ShiftMask,           Button5,        sigstatusbar,   {.i = 10 } }, // Shift + Scrolldown

blocktest.sh

case $BLOCK_BUTTON in
    1) notify-send "$BLOCK_BUTTON" ;;
    2) notify-send "$BLOCK_BUTTON" ;;
    3) notify-send "$BLOCK_BUTTON" ;;
    4) notify-send "$BLOCK_BUTTON" ;;
    5) notify-send "$BLOCK_BUTTON" ;;
    6) notify-send "$BLOCK_BUTTON" ;;
    7) notify-send "$BLOCK_BUTTON" ;;
    8) notify-send "$BLOCK_BUTTON" ;;
    9) notify-send "$BLOCK_BUTTON" ;; 
    10) notify-send "$BLOCK_BUTTON" ;;
esac

echo "Click me"
explosion-mental commented 2 years ago

I am a bit unfamiliar ever since I had a last look at the code itself. But I'm gonna make a wild guess and say that this is expected.

iirc the buttons are handled by sending signals in between dwm and dwmblocks. There are so many signals that these two could use so maybe that's the reason.

Maybe checkout my patch0 that makes dwm handle this internally so these signals in between are avoided and the buttons are directly handled.

UtkarshVerma commented 2 years ago

Hi there, sorry for taking so long. This is definitely a dwmblocks-async bug. dwm actually allows you to have up to 256 click actions for a block.

@explosion-mental As I think you might be interested, here are how clicks are handled in dwm and dwmblocks:

This issue arose because I'm simply adding the value received from the signal and adding it to ASCII of '0'. This works fine for characters 0-9, but we get other ASCII characters up ahead instead of numbers.

I will be pushing changes to fix this behaviour.

UtkarshVerma commented 2 years ago

This should be fixed now, but feel free to reopen in case there are any issues.