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

Rectangular symbol between first two blocks #57

Closed IamGianluca closed 8 months ago

IamGianluca commented 8 months ago

Hi,

I have a strange rectangular symbol between the first two blocks. The symbol is not part of the output generated by the scripts that are run to populate the blocks.

It is always between the first two blocks, irrespectively from the script used to populate them.

image

#ifndef CONFIG_H
#define CONFIG_H

// String used to delimit block outputs in the status.
#define DELIMITER "  "

// Maximum number of Unicode characters that a block can output.
#define MAX_BLOCK_OUTPUT_LENGTH 45

// Control whether blocks are clickable.
#define CLICKABLE_BLOCKS 1

// Control whether a leading delimiter should be prepended to the status.
#define LEADING_DELIMITER 0

// Control whether a trailing delimiter should be appended to the status.
#define TRAILING_DELIMITER 0

// Define blocks for the status feed as X(cmd, interval, signal).
#define BLOCKS(X)          \
    X("dwm_kernel", 0, 0)  \
    X("dwm_volume", 0, 10) \
    X("dwm_battery", 3, 0) \
    X("dwm_date", 3, 0)    \
    X("dwm_clock", 3, 0)
#endif  // CONFIG_H
#!/bin/bash

icon=""
kernel_version="$(uname -r)"
kernel_cleaned="${kernel_version%-*}"

printf "$icon $kernel_cleaned"
#!/bin/bash

vol=$(pactl list sinks | perl -000ne 'if(/#1/){/(Volume:.*)/; print "$1\n"}' | tr ' ' '\n' | grep -m1 '%' | tr -d '%')
if [ -z "$vol" ]; then
    vol=$(pactl list sinks | tr ' ' '\n' | grep -m1 '%' | tr -d '%')
fi

vol_status=$(pactl list sinks | grep 'Mute: yes')

if [ -n "$vol_status" ]
then
        vol_icon=" "
elif [ ${vol} -eq 0 ]
then
        vol_icon=" "
elif [ ${vol} -lt 50 ]
then
    vol_icon=" "
        # vol_icon=" "
else
        vol_icon=" "
        # vol_icon=" "
fi

printf "$vol_icon $vol"

What could we causing it?

IamGianluca commented 8 months ago

I've tried to add a symbol separating each block, and it seems that the strange rectangle is right before the second block.

image

UtkarshVerma commented 8 months ago

This is probably because you made the volume block clickable by defining a signal for it. The symbol is appearing because you haven't patched dwm with the statuscmd patch.

Read this repo's docs on how to use the clickability.

IamGianluca commented 8 months ago

You're right! That was the issue. I disabled the clickable blocks (since I don't need that), and the rectangular symbol went away. Thank you!