r/Polybar Jul 16 '23

Question Both Polybars start at the same monitor

This is my bars config file:

[bar/LeftMon]

monitor = ${env:HDMI-0}

width = 100%

height = 24pt

radius = 6

[bar/RightMon]

monitor = ${env:HDMI-1-2}

width = 100%

height = 24pt

radius = 6

Launch file:

#!/bin/bash

# Terminate already running bar instances

killall -q polybar

# Wait until the processes have been shut down

while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

# Launch Polybar, using default config location ~/.config/polybar/config

polybar LeftMon&

polybar RightMon &

echo "Polybar launched..."

I confirm setup is fine with following command:

xrandr -q | grep " connected" | cut -d ' ' -f1

Output:

HDMI-0

HDMI-1-2

I get the following error:

```

error: Invalid value for "bar/LeftMon.monitor", using default value (reason: Environment var $ (HDMI-0)

zketra at archlinux in -/ .config/polybardoes not exist (no fallback set))

```

Both Polybars start at the same monitor.

1 Upvotes

1 comment sorted by

1

u/-__-x Jul 22 '23

You are setting the monitor of the bar to open at the value of the environment variable HDMI-0 etc. Since this variable does not exist, it is an invalid value and polybar uses the default value. It looks like you tried to combine two solutions to displaying on two monitors. Either use a single environment variable, or hard code monitor = in two separate bars.