polybar / polybar

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

Defaults in the polybar config #2527

Open patrick96 opened 2 years ago

patrick96 commented 2 years ago

Note: Any changes described here would constitute a breaking change because we change default config values. As such it would be implemented as part of a major release that breaks backwards compatibility.

Many modules provide less than ideal default values for their formatting configurations. For example the default value for all workspaces labels in the three workspace modules is %icon% %name% and by default not icon matchings are defined. That means for new users that use this default value, the effective value will be " %name%" with an ugly extra space at the beginning which is quite difficult to track down.

Ideally, for formatting, polybar would either provide no defaults at all or sane defaults that provide a straightforward looking module.

If we were to provide no defaults, we would need to provide an extremely simple way of configuring modules. Any module that doesn't have repeating elements (like workspaces) should be formatable just by using

format = %token1% %token2%

If we do want to provide defaults, here is what I think should change from the current defaults:

In addition, the three workspaces modules should have %name% as the default value for their state labels and the state labels should have a padding of 1. We should maybe also think about somehow highlighting the currently active workspace, but that seems difficult.

The goal is that module definitions only need type and any required machine-specific configurations (interface names, etc.) to function properly. Any and all formatting could be omitted.

This only deals with labels that are enabled by default in the different formats. Any tag available in a format but not enabled by default should not have a default value and should be explicitly defined in the config. This is already the case for most modules because most tags that are not enabled by default are ramps and other non-labels. One exception is label-time in the mpd module and I'm sure there are others.


Personally, I am in favor of completely removing all default values relating to formats and drawtypes. I think they make polybar more difficult to work with because modules look a certain way without you knowing why and there could be a default value somewhere you don't know about that is affecting a module's appearance (e.g. another format).

If anyone else has thoughts on this, I'd be happy to hear them :)

parmort commented 1 year ago

If the default values were to be removed (which I agree with), I think more thought would also have to go into the default config file shipped with polybar, to make it running right out of the box with whatever the user has installed on their system—in my opinion, that means no emoji or bitmap fonts, like what is currently shipped. This file should also highlight different ways to configure modules: progress bars, under- and over-lines, clickable areas, text padding, font tags, etc.

In essence, a basic but functional configuration that highlights what polybar can do.