Implement configurable component locations in bar

This allows the user to configure which component (title, wm_info, clock)
is rendered to which part of the bar (left, right, center).

You can also use `none` to hide the location.
This commit is contained in:
Ben Buhse 2026-02-27 11:33:50 -06:00
commit 040ccc14f3
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
5 changed files with 104 additions and 68 deletions

View file

@ -126,9 +126,8 @@ do not re-trigger rules.
## Bar
The bar is an optional widget that shows the focused window title on the left,
the date/time in the center, and layout info (primary count/ratio and visible
window count) on the right. It is only created when a `bar` block is present in
The bar is an optional widget that displays configurable components in three
slots: left, center, and right. It is only created when a `bar` block is present in
the config. All settings have defaults, with the color based on the Catppuccin
Mocha theme. An empty block can be used to enable the widget with all defaults:
@ -145,9 +144,12 @@ bar {
| `text_color` | color | `0xcdd6f4` | Text color |
| `background_color` | color | `0x1e1e2e` | Background color |
| `position` | enum | `top` | Bar position (`top` or `bottom`) |
| `left` | enum | `title` | Component in the left slot (`title`, `clock`, `wm_info`, `none`) |
| `center` | enum | `clock` | Component in the center slot (`title`, `clock`, `wm_info`, `none`) |
| `right` | enum | `wm_info` | Component in the right slot (`title`, `clock`, `wm_info`, `none`) |
| `vertical_padding` | u8 | `5` | Vertical padding above and below text |
| `horizontal_padding` | u8 | `5` | Horizontal padding between bar edges and text |
| `time_format` | string | `%Y-%m-%d %H:%M, %A` | strftime format string for the clock display (an empty string hides the clock) |
| `time_format` | string | `%Y-%m-%d %H:%M, %A` | strftime format string for the clock display |
### Margins

View file

@ -2,12 +2,12 @@
These are in rough order of my priority, though no promises I do them in this order.
- [ ] Support window tag/order caching between WM restarts (within a river session)
- [ ] Add gap support
- [ ] Add build-time options for including the wallpaper (and maybe bar)
- [ ] Check pointer position and only warp if not on focused window already
- [ ] Change focus direction when closing window
- [ ] Use set_xcursor_theme request
- [ ] Support configuring bar item positions (left/center/right)
- [ ] Support overriding config location
- [ ] Add support for center-primary layout
- [ ] Support per-output bar visibility
@ -50,3 +50,4 @@ These are in rough order of my priority, though no promises I do them in this or
- [x] Add focused window title to bar
- [x] Add bar padding to config
- [x] Support 12-hour clock format (maybe take any time format string?)
- [x] Support configuring bar item positions (left/center/right)