polybar / polybar

A fast and easy-to-use status bar
https://polybar.github.io
MIT License
14.19k stars 710 forks source link

Polybar select the wrong monitor for part of the bar #429

Closed alexanderdavidsen closed 7 years ago

alexanderdavidsen commented 7 years ago

When using two monitors, polybar selects the wrong monitor, except the system tray. The system tray is started on the monitor set as primary with xrandr, but the rest of the bar is started on the secondary monitor.

I'm using i3-gaps.

Available monitors according to polybar

$ polybar -m DP-3: 3840x2160+0+ DP-4.2: 3840x2160+3840+0

Monitor configuration

grep monitor config monitor = DP-4.2 monitor-fallback = DP-3

xrandr -q | grep " connected" | cut -d ' ' -f1 DP-4.2 DP-3

My configuration:

[bar/top] monitor = DP-4.2 monitor-fallback = DP-3

width = 100% height = 35 offset-x = 0 offset-y = -1 ;bottom = true

background = #5a000000 foreground = #eee

underline-size = 2 underline-color = #eee

spacing = 1 padding-left = 0 padding-right = 0 module-margin-left = 0 module-margin-right = 0

font-0 = Noto Sans:pixelsize=13;0 font-1 = FontAwesome:size=10;-2 font-2 = siji:pixelsize=10;0

modules-left = i3 xwindow modules-center = modules-right = backlight ram cpu battery volume date powermenu

;tray-position = right ;tray-padding = 2 ;tray-background = #66333333

wm-restack = i3

scroll-up = i3wm-wsnext scroll-down = i3wm-wsprev tray-position = right tray-padding = 2

; MODULES

[module/i3] type = internal/i3

;ws-icon-default = 

format =

label-focused = %icon% label-focused-background = #88000000 label-focused-underline= #ddd label-focused-padding = 4

label-occupied = %icon% label-occupied-padding = 4

label-urgent = %icon% label-urgent-padding = 4

label-empty = %icon% label-empty-foreground = #44ffffff label-empty-padding = 4

[module/xwindow] type = internal/xwindow label = %title:0:120:...% label-padding = 4

[module/date] type = internal/date

; Seconds to sleep between updates interval = 1.0

; See "man date" for details on how to format the date string ; NOTE: if you want to use syntax tags here you need to use %%{...} date = %a %b %d,

; Optional time format time = %H:%M

; if date-alt or time-alt is defined, clicking ; the module will toggle between formats date-alt = %A, %d %B %Y time-alt = %H:%M:%S

label = %date% %time% format = 

[module/padding] type = custom/text content = content-foreground = #00000000 content-background = #55000000

[module/battery] type = internal/battery

full-at = 99

battery = BAT0 adapter = AC0

poll-interval = 5

format-charging = format-discharging = format-full = label-charging = %percentage% label-discharging = %percentage% label-full = %percentage% format-charging-padding = 3 format-discharging-padding = 3 format-full-padding = 3

ramp-capacity-0 =  ramp-capacity-1 =  ramp-capacity-2 =  ramp-capacity-3 =  ramp-capacity-4 = 

animation-charging-0 =  animation-charging-1 =  animation-charging-2 =  animation-charging-3 =  animation-charging-4 =  animation-charging-framerate = 750

[module/backlight] type = internal/backlight

card = acpi_video0 enable-scroll = true

format =

ramp-0 = 🌕 ramp-1 = 🌔 ramp-2 = 🌓 ramp-3 = 🌒 ramp-4 = 🌑

[module/volume] type = internal/volume

format-volume = format-muted = label-volume = %percentage% label-muted =  muted label-muted-foreground = #aaa format-volume-padding = 3 format-muted-padding = 3

ramp-volume-0 =  ramp-volume-1 =  ramp-volume-2 =  ramp-headphones-0 = 

[module/powermenu] type = custom/menu

label-open =  ;label-open-background = #dd0000 ;label-open-foreground = #fff label-close = cancel ;label-close-background = #dd0000 ;label-close-foreground = #fff label-open-padding = 4 label-close-padding = 3

menu-0-0 = reboot menu-0-0-exec = menu-open-1 menu-0-1 = power off menu-0-1-exec = menu-open-2 menu-0-0-padding = 3 menu-0-1-padding = 3

menu-1-0 = reboot? menu-1-0-exec = sudo reboot menu-1-0-padding = 3

menu-2-0 = power off? menu-2-0-exec = sudo poweroff menu-2-0-padding = 3

[module/cpu] type = internal/cpu label = CPU: %percentage% ;format-background = #c42 ;format-underline = #f75 ;format-overline = #f75 format-padding = 2

[module/ram] type = internal/memory label = RAM: %percentage_used% ;format-background = #42c ;format-underline = #75f ;format-overline = #75f format-padding = 2

[module/mpd] type = internal/mpd

host = 127.0.0.1 port = 6600 password =

; Seconds to sleep between progressbar/song timer sync ; Default: 1 interval = 2

; Available tags: ; (default) ; ; ; - gets replaced with <icon-(pause|play)> ; - gets replaced with <icon-(stop|play)> ; ; ; ; ; ; ; ; ; ; format-online = 

; Available tokens: ; %artist% ; %album% ; %date% ; %title% ; Default: %artist% - %title% label-song = %title% format-online-padding = 3

I'm installing polybar for Aur. I have the same problem with both polybar and polybar-git.

There is a issue from October, where upgrading to the latest version fixed the issue. This does not work for me..

jaagr commented 7 years ago

Hi. Do you want it to be shown on DP-3 or DP-4.2? The geom reported by polybar -m looks malformed. Can you post the output of polybar -vv

alexanderdavidsen commented 7 years ago

Hi!

I want it to start on DP-4.2 when this monitor is connected ( at the office), and on DP-3 when no other monitors are conneccted. Another possible solution would be to start the bar on all connected monitors, if such option exists.

Here is the output from polybar -vv, only DP-3 connected (laptop screen).

polybar 3.0.4-1-g1d06df2

Features: +alsa +curl +i3 +mpd +network

X extensions: +randr (+monitors) -render -damage -sync -composite +xkb +xrm

Build type: RelWithDebInfo
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wall -Wextra -Werror -O2 -pedantic -pedantic-errors
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro
alexanderdavidsen commented 7 years ago

The following commands forces the bar to the correct monitor:

!/bin/sh

xrandr --output DP-4.2 --off xrandr --output DP-4.2 --auto xrandr --output DP-4.2 --primary --mode 3840x2160 --pos 3840x0 --rotate normal --output DP-4 --off --output DP-3 --mode 3840x2160 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --off --output DP-0 --off

polybar -m DP-3: 3840x2160+0+0 DP-4.2: 3840x2160+3840+0

jaagr commented 7 years ago

I think it might be related to the malformed geometry reported (DP-3: 3840x2160+0+) because after you got the monitors setup like that it seems to report it correctly.

alexanderdavidsen commented 7 years ago

I guess you are right! Closing The issue!:-)