polybar / polybar

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

Problems in Fedora 25 -> 26 upgrade (monitor not found, xbacklight). #712

Closed u30af closed 4 years ago

u30af commented 7 years ago

I recently upgraded my system from Fedora 25 -> 26, and had a few issues with polybar when I logged in after the installation process completed.

At first, polybar wouldn't display at all; launching it from a terminal produced error: Monitor "LVDS1" not found or disconnected. After checking the monitor designation with ARandR, it seems that "LVDS1" had changed to "LVDS-1" in Fedora 26. After changing that value in my config, polybar came back up. Obviously, this is a Fedora issue rather than polybar, but I just thought I'd mention it.

The larger issue that I'm having now is that the xbacklight module no longer works following the upgrade. The module doesn't appear at all on the bar, and launching from the terminal produces

error: module/xbacklight: Could not get data (err: XCB_NAME (15))
error: Disabling module "xbacklight" (reason: Not supported for "LVDS-1")

Now, this module worked fine under Fedora 25, so I don't think that it's that the display is actually unsupported. I've changed the xbacklight module to the legacy backlight module, and have two options for available cards to check, acpi_video0 and intel_backlight. Both cards no longer produce errors when launching polybar from the terminal, but there's no backlight info displayed in the bar, either.

I'm not sure that this is entirely a polybar issue, but I'm posting the issue in case there's any behind-the-scenes info that might help be troubleshoot. Apologies if this report is missing vital information; I'm pretty new at this.

patrick96 commented 7 years ago

Hi

You're fine, this contains enough information for us to start troubelshooting. I suspect that the upgrade broke some driver that was handling the brightness. Are you still able to change the brightness? If so, how? If you can still change the brightness, please post the output of the following command before and after the brightness change.

find -L /sys/class/backlight -maxdepth 2 -type f -print0 2>/dev/null | xargs -0 -I '{}' sh -c 'echo "{}:"; cat {}; echo'

And just for good measure, please also post your entire polybar config.

u30af commented 6 years ago

Ugh, I am so sorry to have missed your reply--my inbox has been getting spammed by Fedora mailing lists and I sort of temporarily gave up on trying to tame it.

If this is still something you're interested in tracking down:

I can still change the brightness just fine. I'm on a Thinkpad X301, so it's using the system hotkeys to do the adjustment: Fn + Home to increase, Fn + End to decrease.

Output of the command before changing brightness:

/sys/class/backlight/intel_backlight/max_brightness:
2414340

/sys/class/backlight/intel_backlight/type:
raw

/sys/class/backlight/intel_backlight/brightness:
1032012

/sys/class/backlight/intel_backlight/bl_power:
0

/sys/class/backlight/intel_backlight/uevent:

/sys/class/backlight/intel_backlight/actual_brightness:
1032012

/sys/class/backlight/acpi_video0/max_brightness:
15

/sys/class/backlight/acpi_video0/type:
firmware

/sys/class/backlight/acpi_video0/brightness:
13

/sys/class/backlight/acpi_video0/bl_power:
0

/sys/class/backlight/acpi_video0/uevent:

/sys/class/backlight/acpi_video0/actual_brightness:
13

and after:

/sys/class/backlight/intel_backlight/max_brightness:
2414340

/sys/class/backlight/intel_backlight/type:
raw

/sys/class/backlight/intel_backlight/brightness:
1600092

/sys/class/backlight/intel_backlight/bl_power:
0

/sys/class/backlight/intel_backlight/uevent:

/sys/class/backlight/intel_backlight/actual_brightness:
1600092

/sys/class/backlight/acpi_video0/max_brightness:
15

/sys/class/backlight/acpi_video0/type:
firmware

/sys/class/backlight/acpi_video0/brightness:
14

/sys/class/backlight/acpi_video0/bl_power:
0

/sys/class/backlight/acpi_video0/uevent:

/sys/class/backlight/acpi_video0/actual_brightness:
14
u30af commented 6 years ago

Polybar config (pardon the mess/hacky nature):

;=====================================================
;
;   To learn more about how to configure Polybar
;   go to https://github.com/jaagr/polybar
;
;   The README contains alot of information
;
;=====================================================

[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over

[global/wm]
margin-top = 5
margin-bottom = 5

[colors]
; colors for wal
foreground = ${xrdb:color6}
foreground-alt = ${xrdb:color7}
;background = ${xrdb:color2}
background-alt = ${xrdb:color0}
alert = ${xrdb:color2}
selected = ${xrdb:color2}

; Old Colors for non-wal
; Note that hard-coding the background produces a predictable, readable background effect no matter the wal color scheme.
;background = #99000000
background = #77000000
;background-alt = #333
;foreground = #dfdfdf
;foreground-alt = #555
;foreground-alt = #ffffff

primary = #ffb52a
secondary = #e60053
;alert = #bd2c40
;Colors for good/moderate/bad status items
neutral = #429bf4
good = #18ff20
warn = #ffb52a
;bad = #ff2318
bad = #e00000

[bar/cstl]
monitor = LVDS-1
monitor-strict = false
width = 100%
height = 20
radius = 0.0
fixed-center = false
override-redirect = false
;wm-restack = i3
bottom = false

background = ${colors.background}
foreground = ${colors.foreground}

line-size = 2
line-color = #f00

separator =

; Uncomment these lines for floating bar
;border-size = 10
;border-bottom-size = 0

border-size = 0
border-color = #00000000

padding-left = 0
padding-right = 0

module-margin-left = 1
module-margin-right = 1

font-0 = "M+ 2c:style=bold:pixelsize=10;1"
font-1 = "FontAwesome:pixelsize=10;2"
font-2 = "Academicons:pixelsize=10;2"

modules-left = i3 xwindow
modules-center =
modules-right = filesystem xbacklight memory cpu temperature fanspeed wlan eth volume battery date

tray-position = right
tray-padding = 0
tray-detached = false
tray-transparent = false
tray-background = ${xrdb:color6}

; ==== Modules ====

[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false

; Only show workspaces on the same output as the bar
;pin-workspaces = true

;ws-icon-0 = "1 ; "
ws-icon-0 = "1 ; "
ws-icon-1 = "2 ; "
ws-icon-2 = "3 ; "
ws-icon-3 = "4 ; "
ws-icon-4 = "5 ; "
ws-icon-5 = "6 ; "
ws-icon-6 = "7 ; "
ws-icon-7 = "8 ; "
ws-icon-8 = "9 ; "
;ws-icon-9 = "10 ; "
ws-icon-9 = "10 ; "

label-mode-padding = 1
label-mode-foreground = #000
label-mode-background = ${colors.background-alt}

; focused = Active workspace on focused monitor
; Available tokens:
;   %name%
;   %icon%
;   %index%
;   %output%
; Default: %icon%  %name%
label-focused = %index%%icon%
label-focused-foreground = ${colors.background-alt}
label-focused-background = ${colors.foreground}
;label-focused-underline = ${xrdb:color7}
label-focused-underline = ${colors.selected}
label-focused-padding = ${self.label-mode-padding}

; unfocused = Inactive workspace on any monitor
; Available tokens:
;   %name%
;   %icon%
;   %index%
; Default: %icon%  %name%
label-unfocused = %index%%icon%
label-unfocused-padding = ${self.label-mode-padding}

; visible = Active workspace on unfocused monitor
; Available tokens:
;   %name%
;   %icon%
;   %index%
; Default: %icon%  %name%
label-visible = %index%%icon%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-mode-padding}

; urgent = Workspace with urgency hint set
; Available tokens:
;   %name%
;   %icon%
;   %index%
; Default: %icon%  %name%
label-urgent = %index%%icon%
label-urgent-background = ${colors.alert}
label-urgent-foreground = ${colors.background}
label-urgent-padding = ${self.label-mode-padding}

[module/xwindow]
type = internal/xwindow
label = %title:0:45:...%
label-padding = 2
#format-background = #aa444444
format-background = ${colors.background-alt}

[module/filesystem]
type = internal/fs
interval = 20

mount-0 = /

format-mounted-prefix = " "
format-mounted-prefix-foreground = ${colors.foreground-alt}
format-mounted = <label-mounted>
label-mounted = %free%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
;format-mounted-underline = ${colors.selected}
;format-unmounted-underline = ${colors.selected}

[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
;format-underline = ${colors.neutral}
;format-underline = ${colors.selected}
label = "%percentage_used%%"

[module/cpu]
type = internal/cpu
interval = 2
format = <ramp-load> <label>
;format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
;format-underline = ${colors.neutral}
;format-underline = ${colors.selected}
;label = %percentage-cores%
label = %percentage%%

ramp-load-0-foreground = ${colors.good}
ramp-load-0 = 
ramp-load-1-foreground = ${colors.good}
ramp-load-1 = 
ramp-load-2-foreground = ${colors.warn}
ramp-load-2 = 
ramp-load-3-foreground = ${colors.bad}
ramp-load-3 = 

[module/temperature]
type = internal/temperature
; Thermal zone to use
; To list all the zone types, run
; $ for i in /sys/class/thermal/thermal_zone*; do echo "$i: $(<$i/type)"; done
; Default: 0
thermal-zone = 0
; Threshold temperature to display warning label
; Default: 80
warn-temperature = 57

format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-warn-prefix = " "
format-warn-prefix-foreground = ${colors.warn}
;format-underline = ${colors.selected}
format-warn-underline = ${colors.bad}
label-warn-foreground = ${colors.bad}

format = <label>
format-warn = <label-warn>

label = %temperature%
label-warn = %temperature%

[module/fanspeed]
type = custom/script
;format-underline = ${colors.neutral}
;format-underline = ${colors.selected}
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
; Available tokens:M+ 2c heavy
;   %counter%
; Command to be executed (using "/usr/bin/env sh -c [command]")
exec = $HOME/fanspeed.sh

; Seconds to sleep between updates
; Default: 2 (0 if `tail = true`)
interval = 5

[module/wlan]
type = internal/network
interface = wls1
interval = 3.0

;format-connected-prefix = " "
format-connected = <ramp-signal> <label-connected>
format-disconnected = <label-disconnected>
format-connected-underline = ${colors.good}
format-disconnected-underline = ${colors.bad}
label-disconnected-foreground = ${colors.foreground-alt}
label-connected = "%essid% (%signal%%)"
label-connected-alt = %local_ip%
label-disconnected = "DOWN"

ramp-signal-0 = 
ramp-signal-0-foreground = ${colors.bad}
ramp-signal-1 = 
ramp-signal-1-foreground = ${colors.warn}
ramp-signal-2 = 
ramp-signal-2-foreground = ${colors.good}
; ramp-signal-foreground = ${colors.foreground-alt}

[module/eth]
type = internal/network
interface = enp0s25
interval = 3.0

format-connected-underline = ${colors.good}
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%

format-disconnected =
;format-disconnected = <label-disconnected>
format-disconnected-underline = ${colors.bad}
label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}

[module/volume]
type = internal/volume

format-volume = <label-volume>
format-volume-prefix = " "
label-volume = %percentage%%
label-volume-foreground = ${root.foreground}
format-volume-underline = ${colors.good}
label-padding = 1
format-muted-prefix = " "
format-muted-prefix-foreground = ${colors.warn}
format-muted-underline = ${colors.warn}
label-muted = "MUTE"

[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 98
time-format = %H:%M

format-charging-prefix = " "
format-charging-prefix-foreground = ${colors.warn}
format-charging-underline = ${colors.warn}
label-charging = "%percentage%%"
format-charging = <animation-charging> <label-charging>

label-discharging = "%percentage%% (%time%)"
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${colors.warn}

format-full-prefix = " "
label-full = "FULL"
format-full-prefix-foreground = ${colors.good}
format-full-underline = ${colors.good}

ramp-capacity-0-foreground = ${colors.bad}
ramp-capacity-0 = 
ramp-capacity-1-foreground = ${colors.warn}
ramp-capacity-1 = 
ramp-capacity-2-foreground = ${colors.warn}
ramp-capacity-2 = 
ramp-capacity-3-foreground = ${colors.good}
ramp-capacity-3 = 
ramp-capacity-4-foreground = ${colors.good}
ramp-capacity-4 = 

animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750

[module/date]
type = internal/date
interval = 5

date = " %H:%M "
date-alt = " %Y-%m-%d "

;format-background = #333333
;format-underline = ${colors.selected}
label = %date%

; ==== Currently unused modules ====
; ==== Some may not function as configured ====

[module/mpd]
type = internal/mpd
format-online = <label-song>  <icon-prev> <icon-stop> <toggle> <icon-next>

icon-prev = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 

label-song-maxlen = 25
label-song-ellipsis = true

[module/xbacklight]
type = internal/xbacklight
;label-padding = 2
format-prefix = " "
format = <label>
label = %percentage%%

[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight

[module/backlight]
type = internal/backlight
; Use the following command to list available cards:
; $ ls -1 /sys/class/backlight/
card = intel_backlight

[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock

;format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.neutral}

; label-padding = 2
label-layout = " %layout%"
label-layout-underline = ${colors.neutral}

label-indicator-padding = 2
; label-indicator-margin = 1
label-indicator-background = ${colors.warn}
label-indicator-underline = ${colors.neutral}
patrick96 commented 6 years ago

It seems both backlight cards are working fine. The reason the internal/backlight modules are not shown, is because they are not in any of the modules-* list

u30af commented 6 years ago

Yeah, sorry--that config represents the most recent settings I played with before I threw up my hands and stopped messing with it.

I had played around with the deprecated internal/backlight module using both the intel-backlight and the acpi_video0 cards, and didn't have much success there either. The module code at the time DID have a little block to display a FontAwesome lightbulb icon and a backlight percentage (copied from the xbacklight module; I don't know why I had deleted it from backlight):

format-prefix = " "
format = <label>
label = %percentage%%

I don't know why I deleted it.

I've gone back through and rotated internal/backlight into the active modules list, and have tried both backlight card options. For both cards under that module, there is an icon and value that gets displayed on the bar, but the value seems to be entirely arbitrary--43% for intel-backlight, 87% for acpi_video0--and does not change with any adjustment to the backlight.

patrick96 commented 6 years ago

I don't see why polybar won't update the backlight values. The "arbitrary" ones you get, actually match up with the values in the /sys/class/backlight/* folders and the values in those folders DO change when you change the brightness.

Can you try to use the following minimal config to reproduce this and also run polybar with -l trace (you may have to recompile polybar again with cmake -DCMAKE_BUILD_TYPE=Debug ..) and post the whole output here:

[bar/example]
width = 100%
height = 27
radius = 6.0
fixed-center = false

background = #222
foreground = #dfdfdf

line-size = 3
line-color = #f00

border-size = 4
border-color = #00000000

padding-left = 0
padding-right = 2

module-margin-left = 1
module-margin-right = 2

font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1

modules-left = intel acpi

[module/intel]
type = internal/backlight

card = intel_backlight
format = <label>
label = INTEL: %percentage%%

[module/acpi]
type = internal/backlight

card = acpi_video0
format = <label>
label = ACPI: %percentage%%

; vim:ft=dosini
u30af commented 6 years ago

Output: $ polybar -l trace example

* Loaded /home/username/.config/polybar/config
- config: Current bar section: [bar/example]
warn: No monitor specified, using "LVDS-1"
* Loaded monitor LVDS-1 (1440x900+0+0)
* Bar geometry: 1440x35+0+0
- bar: Attach X event sink
- bar: Attach signal receiver
- controller: Install signal handler
- controller: Setup user-defined modules
- module/intel: Attach inotify at /sys/class/backlight/intel_backlight/brightness
- module/acpi: Attach inotify at /sys/class/backlight/acpi_video0/brightness
* Starting application
- controller: Main thread id = 1
* Starting module/intel
* Starting module/acpi
- module/intel: Thread id = 2
* Entering event loop (thread-id=1)
- module/acpi: Thread id = 3
* Eventqueue worker (thread-id=4)
- bar: Create renderer
- renderer: Get TrueColor visual
- renderer: Allocate colormap
- renderer: Allocate output window
- renderer: Allocate window pixmaps
- renderer: Allocate graphic contexts
- renderer: Allocate alignment blocks
- renderer: Allocate cairo components
- renderer: Load fonts
* Configured DPI = 96x96
- module/acpi: /sys/class/backlight/acpi_video0/brightness
- module/intel: /sys/class/backlight/intel_backlight/brightness
* Loaded font "fixed:pixelsize=10" (name=Fixed, offset=1, file=/usr/share/fonts/ucs-miscfixed/6x10.bdf)
* Loaded font "unifont:fontformat=truetype:size=8:antialias=false" (name=DejaVu Sans, offset=0, file=/usr/share/fonts/dejavu/DejaVuSans.ttf)
* Loaded font "siji:pixelsize=10" (name=Siji, offset=1, file=/home/username/.fonts/siji.pcf)
* Bar window: 0x3a00001
- bar: Reconfigure window
- bar: Set window WM_NAME
- bar: Set window _NET_WM_WINDOW_TYPE
- bar: Set window _NET_WM_STATE
- bar: Set window _NET_WM_DESKTOP
- bar: Set window _NET_WM_PID
- bar: Map window
- bar: Draw empty bar
- bar: Setup tray manager
* Disabling tray manager (reason: missing `tray-position`)
* module/intel: Rebuilding cache
* module/acpi: Rebuilding cache
- bar: Force update
* Redrawing bar window
- renderer: flush(1 geom=132x27+0+0, falloff=0)

Restarting i3 (and thus reloading polybar) after raising or lowering the backlight does produce a change in both the Intel and ACPI values displayed on this bar, but the displayed values just don't refresh in real time.

patrick96 commented 6 years ago

Did you change the brightness as you ran polybar with -l trace?

u30af commented 6 years ago

Sorry, that's what I meant: I changed the brightness while polybar was running with -l trace. The screen brightness would change normally, but the values displayed on the bar would not.

However, if I restarted/reloaded polybar in any way (restarting i3, terminating & reloading it manually in the terminal), the values on the bar would then display the new, changed brightness setting (which both cards seemed to measure in entirely different ways).

So in short, changing brightness works, the proper values seem to get passed to the polybar modules, but the output does not change in real time (when I adjust the brightness), only when polybar is reloaded.

diwww commented 6 years ago

Same issue, only restarting polybar updates the brightness value. I've also noticed that cat /sys/class/backlight/intel_backlight/brightness causes an update too.

My solution is

[module/backlight-helper]
type = custom/script
exec = cat /sys/class/backlight/acpi_video0/brightness > /dev/null
interval = 1

[module/backlight-acpi]
type = internal/backlight
card = acpi_video0
format = <label>
format-underline = ${colors.primary}
label = BL %percentage%%
patrick96 commented 6 years ago

Sorry for the wait, I'm trying to catch up with the other open issues.

@u30af Can you confirm that running cat /sys/class/backlight/intel_backlight/brightness and/or cat /sys/class/backlight/acpi_video0/brightness causes a brightness update in polybar too? If that is the case, then there is a problem with the inotify watches on your system, which probably doesn't have anything to do with polybar.

ecesar88 commented 5 years ago

Hello! I am having almost the same issue with the backlight module, the value displayed in cat /sys/class/backlight/acpi_video0/brightness does change when i change the backlight with the keyboard shorcuts, however, the value do not change in the polybar brightness indicator.

diwww commented 5 years ago

By the way, the problem was solved by installing intel video driver on my thinkpad x220. Now there is no need in cat /sys/class/backlight/intel_backlight/brightness

patrick96 commented 4 years ago

This should have been fixed in the meantime, in #1689, we changed which file is read for the brightness value, because reading brightness gave us lots of problems.