You are not logged in.
Pages: 1
I want to the battery module shows this: "BAT 50%" for example, only the percentage, not "charging" or "full" icons.
[module/battery]
type = internal/battery
battery = BAT1
format-prefix = "BAT "
format-prefix-foreground = ${colors.primary}
label = %percentage%%
This configuration only shows the percentage and not the "BAT" prefix.
Offline
Can you post your full config?
Offline
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[colors]
background = #000000
background-alt = #D30000
foreground = #C5C8C6
primary = #FF0000
secondary = #8ABEB7;
alert = #A54242
disabled = #707880
line = #780000
[bar/example]
width = 99.2673%
height = 20pt
radius = 0
offset-x = 0.4%
offset-y = 0.7%
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 0pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = TickingTimebombBB:size=17;4
modules-left = xworkspaces
modules-right = battery pulseaudio memory cpu date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3
; override-redirect = true
; This module is not active by default (to enable it, add it to one of the
; modules-* list above).
; Please note that only a single tray can exist at any time. If you launch
; multiple bars with this module, only a single one will show it, the others
; will produce a warning. Which bar gets the module is timing dependent and can
; be quite random.
; For more information, see the documentation page for this module:
; https://polybar.readthedocs.io/en/stable/user/modules/tray.html
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.line}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/battery]
type = internal/battery
battery = BAT1
format-prefix = "BAT "
format-prefix-foreground = ${colors.primary}
label = %percentage%%
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
[module/memory]
type = internal/memory
interval = 0.5
format-prefix = "RAM "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 0.5
format-prefix = "CPU "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[module/date]
type = internal/date
interval = 1
date = %H:%M
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
label-foreground = ${colors.primary}
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini
Offline
The problem is that the label key is overriding the entire text output of the battery module. I think you just need to amend it as follows:
[module/battery]
type = internal/battery
battery = BAT1
format = <label>
format-prefix = "BAT "
format-prefix-foreground = ${colors.primary}
label = %percentage%%
Basically you are specifying formatting but then telling it to just output the percentage, which overrides everything else. This should integrate the prefix into the label. not a polybar user myself though, which is why I wanted to see your full config to see if there were any syntax inconsistencies.
Offline
I added this line but don't wokrs, keeps showing only the percentage.
Offline
Did you restart polybar after updating the config?
Offline
Yes, I restarted it. I commented all except the prefix but neither shows nothing
[module/battery]
type = internal/battery
;battery = BAT1
;format = <label>
format-prefix = "BAT "
format-prefix-foreground = ${colors.primary}
;label = %percentage%%
Offline
Why did you add those comments? They are not correct.
Offline
I thought try to set only the prefix, are temporally comments to not erase those lines.
Offline
It's not clear - did you try to modify the battery module the way I recommended above, and then restart Polybar? Or have you only tried it with the comments?
Offline
Yes, I tried it with comments, doesn't show nothing
Offline
Try it without comments.
Offline
Is the same what I tried previously. Without comments are the same code what I tried yet.
Offline
Having another look through your config and it seems like other modules share almost identical syntax to the battery module. Are those prefixes displaying correctly? Is it only the battery prefix that isn't?
Does the battery display as "50%" for example? Or does it only show the number without the percentage sign?
Offline
In fact, I based to others modules to write the battery, they works, example "RAM 36%", I want the same for battery. And yes shows the number and the percentage sing "77 %"
Offline
I just came across this issue because I was setting my polybar up as well. You are sort of correct in your implementation- but not quite there. Firstly, I recommend checking out the wiki entry on the battery module. Secondly, you need to specify charging/discharging/full for your format prefixes. It should look something like this:
[module/battery]
type = internal/battery
full-at = 99
low-at = 5
battery = BAT0
adapter = AC
poll-interval = 5
format-charging-prefix = "BAT "
format-charging-prefix-foreground = ${colors.primary}
format-discharging-prefix = "BAT "
format-discharging-prefix-foreground = ${colors.primary}
format-full-prefix = "BAT "
format-full-prefix-foreground = ${colors.primary}
label-charging = %percentage%%
label-discharging = %percentage%%
label-full = FULL
Offline
Pages: 1