Polybar: Separator with a different foreground

Created on 24 Oct 2019  路  3Comments  路  Source: polybar/polybar

I want to configure polybar to use a module separator with a foreground that's different from the regular bar foreground. Example:
image

I tried to use the following in my bar section but that didn't work:

separator = "|"
separator-padding = 1
separator-foreground = ${colors.foreground-alt}

So, as a workaround, I added the following simple text module:

; Workaround for using a module separator with a different foreground color than
; the one defined for the whole bar.
[module/sep]
type = custom/text
content = |
content-foreground = ${colors.foreground-alt}
content-padding = 1

And then I add the sep module between every pair of modules, for example:

modules-right = filesystem sep memory sep cpu sep keyboard-layout sep

This worked fine for some time, but recently after upgrading polybar it started printing this error:

error: The module "module/sep" appears multiple times in your modules list. This is deprecated and should be avoided, as it can lead to inconsistent behavior. Both modules will be displayed for now.

I traced this back to #1534

I don't want my config to break in a future upgrade, hence I opened this issue to ask how to handle this.

Thanks!

CC @patrick96

Most helpful comment

I do this by simply setting separator = %{F#RRGGBB}|%{F-} (see https://github.com/polybar/polybar/wiki/Formatting#foreground-color-f)

All 3 comments

I do this by simply setting separator = %{F#RRGGBB}|%{F-} (see https://github.com/polybar/polybar/wiki/Formatting#foreground-color-f)

Thanks @pcb060 that works well!

That is an interesting usecase that I didn't think about when I wrote #1534. I now made the module separator a label, so that separator-foreground and so on work. I will upload that shortly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amirashabani picture amirashabani  路  3Comments

faminee picture faminee  路  4Comments

matjaz132 picture matjaz132  路  4Comments

edgard picture edgard  路  3Comments

oquinena picture oquinena  路  4Comments