Polybar disappeared when a monitor is disconnected and connected again

Just installed Archlabs in my new desktop. I’m using the same monitor for two different machines at the same time. When I switch from my archlabs desktop to my office machine and come back to archlabs using the monitors input signal switching, my polybar closes itself.
Thanks in advance. :slight_smile:

I assume if you run polybar through a terminal it will give some reason for closing, could we see that output?

1 Like

What OS is the office machine running?

Polybar has monitor settings:

; Use either of the following command to list available outputs:
; If unspecified, the application will pick the first one it finds.
; $ polybar -m | cut -d ':' -f 1
; $ xrandr -q | grep " connected" | cut -d ' ' -f1
; If no monitor is given, the primary monitor is used if it exists
monitor =

; Use the specified monitor as a fallback if the main one is not found.
monitor-fallback =

; Require the monitor to be in connected state
; XRandR sometimes reports my monitor as being disconnected (when in use)
monitor-strict = false

; Use fuzzy matching for monitors (only ignores dashes -)
; Useful when monitors are named differently with different drivers.
monitor-exact = true

What do you have for those configuration options? I think polybar will crash if the monitor is disconnected.

Thanks for replying :slight_smile:
These are the output before the bars shut down themselves.

polybar|notice:  Loaded font "Noto Color Emoji:pixelsize=16:style=Regular:scale=10" (name=DejaVu Sans, offset=2, file=/usr/share/fonts/TTF/DejaVuSans.ttf)
polybar|notice:  randr_screen_change_notify (1920x1080)... reloading
polybar|notice:  Termination signal received, shutting down...
polybar|notice:  randr_screen_change_notify (1920x1080)... reloading
polybar|notice:  Termination signal received, shutting down...
polybar|notice:  Parsing config file: /home/arafat/.config/polybar/config
polybar|notice:  Parsing config file: /home/arafat/.config/polybar/config
polybar|error: No monitors found
polybar|error: No monitors found

So, when the monitor switch from archlabs hdmi to vga, polybar sees it as if the monitor itself has disappeared. Is there a way to prevent it from happening?

Thanks for replying :slight_smile:
That is running windows.
No fallback monitor is specified, no other monitor is connected.
monitor-strict is not specified.
Is there a way to keep polybar running even if the monitor disconnects?

I don’t think so. You can have a look at the polybar git page and linked wiki; there may be a work around for this kind of setup.

Maybe this thread can get you on the right track??

Found a working solution to this issue.
using AUR (en) - srandrd to launch the bars when monitor gets connected.
Though it would’ve been better if the disappearance could be avoided in the first place :smiley:
Thanks everyone for your reply :smiley:

1 Like

Do you have the monitor specified in the config for polybar?

Do you still get this issue when leaving the monitor blank?

Seems like a good case to open an issue for polybar but they may think it’s more of a user issue and direct you to something like you’ve already done (external program or script).

1 Like

Yes the monitor is specified in the config.
Yes the bars still closes themselves saying no monitor found
Opening an issue in polybar github, let’s see what they say :smiley: