Skip to content

centring/aligning text within notification boxes? #4021

@mxmilkiib

Description

@mxmilkiib

heyas. had a few searches n scans of related terms but couldn't see an existing issue

I asked Claude the best way to phrase this request, please excuse if it's saying something that doesn't entirely mesh with the proposal or reality

it would be cool to be able to further style notifications in such a way if possible without having to monkey patch with extra code in config

possibly there is a one-liner that could add this feature, but my motivation in this FR is toward making it easy to achieve by default for all

thanks for your time :)

Current Behaviour

Notification text content (title and message) appears to be left-aligned by default with no built-in mechanism to control horizontal alignment.

Proposed Enhancement

Add support for horizontal text alignment in notifications, similar to how wibox.widget.textbox supports the align property.

Suggested Implementation

Add new properties to naughty.notification:

  • text_align or message_align (string): "left", "center", "right"
  • title_align (string): "left", "center", "right"

And corresponding theme variables:

  • beautiful.notification_text_align
  • beautiful.notification_title_align

Use Cases

  • Center-aligned notifications for announcements/alerts
  • Right-aligned text for RTL languages or design preferences
  • Consistent alignment with custom notification themes

Example Usage

added: no idea how legit the form of this example is!

the quotation marks weirdly render (for me) as a character like maybe that archaic form of f/s, but its not, and shows as a quote when editing, but that's beside the point

naughty.notification {
    title = "Centered Title",
    message = "This message should be center-aligned",
    title_align = "center",
    text_align = "center"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions