LemonBoy / bar

A featherweight, lemon-scented, bar based on xcb
MIT License
1.61k stars 194 forks source link

%{SnName} not working as expected #245

Closed ColeBardin closed 11 months ago

ColeBardin commented 11 months ago

I am trying to dynamically write to the monitors that are connected and parse workspace information. My script works perfectly fine if I just fine if I write to S0 and S1. However using the SnName syntax, it only write to my primary monitor.

Here is my script:

while true; do
    bar="%{c} $(Clock) %{r} $(CPU)    $(RAM)    $(GPU)    $(Volume) %{F-}%{B-}"
    out=""
    monitors=$(xrandr | grep -oE "^(DP|HDMI).* connected" | sed "s/ connected//")
    for m in $(echo "$monitors") ; do
    out="$out%{Sn$m}%{l}%{F#FFFF00}%{B#0000FF} $m $bar"
    done
    echo "$out"
    sleep 0.2
done | lemonbar -p

For each monitor, I want the bar to display the port it is connected to, then followed by the workspace info for that specific monitor. I have two monitors, DP-4 (primary) and DP-2. According to what I read from the docs, this should work, but I am only getting output on DP-4. The is one copy of the bar on my monitor which leads me to believe that it is not ignoring the syntax all together or else I would 2 of the same bar on one monitor. But it seems that the SnName format is not working for DP-2.

My script outputs a string that looks correct: (I replaced my bar variable with 'BARSTR' for readability) %{SnDP-2}%{l}%{F#FFFF00}%{B#0000FF} DP-2 BARSTR%{SnDP-4}%{l}%{F#FFFF00}%{B#0000FF} DP-4 BARSTR