Skip to content

Conversation

@mbroemme
Copy link

@mbroemme mbroemme commented Oct 8, 2025

Problem Description

It is impossible to specify horizontal alignment in the wlr/taskbar module if using min-width: CSS property in #taskbar button.

Solution

While Waybar already has a justify option for Gtk::Label (introduced in #2887), there is no such option for the Gtk::Box used by the wlr/taskbar module. This PR adds support for justify in wlr/taskbar.

To keep configuration syntax consistent with other modules, the new option is named justify and accepts one of: "left", "center", or "right". It controls the horizontal alignment of the module’s Gtk::Box within its parent.

  • Default behavior remains unchanged (equivalent to "left").
  • No breaking changes.

Configuration

// waybar config example
"wlr/taskbar": {
  //
  "justify": "center"   // one of: "left" | "center" | "right"
}

Implementation Notes

  • Parse justify from the module config.
  • Map it to Gtk::Align::START, Gtk::Align::CENTER, or Gtk::Align::END.
  • Apply via box->set_halign(...) (the Gtk::Box that wraps the taskbar content).

Screenshots

Before: left-aligned by default.
image

After: with "justify": "center" or "justify": "right" (visuals depend on theme and spacing).
image
image
image

Docs

  • Add the new justify key to the wlr/taskbar module documentation with accepted values and defaults.

Testing

  • Verified the module renders identically with no justify key present.
  • Manually checked that "left", "center", and "right" produce the expected horizontal alignment.

Motivation and Context

This brings the taskbar’s layout controls in line with other modules, reducing the need for CSS workarounds when users want simple left/center/right alignment of the entire taskbar box.

The `wlr/taskbar` module had no way to control its container's horizontal
alignment. This change adds a `justify` config key (left|center|right) that
maps to Gtk::Align::START/CENTER/END and is applied via set_halign() on the
module's Gtk::Box. Default behavior remains unchanged (left).
@mbroemme mbroemme changed the title wlr/taskbar: add justify option to control horizontal alignment of the module box feat(wlr/taskbar): add justify option to control horizontal alignment of the module box Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant