Skip to content

Configuration

DreamMaoMao edited this page Oct 6, 2026 · 5 revisions

Configuration

The configuration is a JSONC file (JSON with // comments and trailing commas allowed). mangobar reads it from $MANGOBAR_CONFIG or ~/.config/mangobar/config.jsonc.

For multi-monitor setups the top level may also be an array of profiles, each bound to one or more outputs by name, so every monitor can have its own modules, height and formats. See Multi-Monitor Configuration for the profile syntax and examples.

Bar Options

Option Type Default Description
height int 30 Bar height in logical pixels
layer string top Layer: top, overlay or bottom
buffer-scale int 1 HiDPI multiplier on top of the output's Wayland scale; leave 1 to follow the display scale automatically
css / style string — Path to the CSS style file (overrides the default location)
scroll-interval int (ms) 0 Debounce window for scroll actions (see below)
smooth-scrolling-threshold float 5.0 Pointer-axis distance that produces one synthetic scroll step
sys-interval int (s) 2 Default refresh interval for polled modules (cpu, memory, network, battery, clock)
modules-left array — Modules anchored to the left edge
modules-center array — Modules forced to the true screen center
modules-right array — Modules anchored to the right edge

Module placement

Any module can be placed in modules-left, modules-center or modules-right. When modules-center is non-empty, those modules are centered and the left/right groups only take the remaining space on their own side. Without center modules the left group expands toward the right group (the window module absorbs the squeeze).

{
    "modules-left": ["workspaces", "layout", "window"],
    "modules-center": [],
    "modules-right": ["memory", "pulseaudio", "battery", "clock#time"]
}

Common Module Options

Every module accepts the following options:

Option Type Default Description
format string module-specific Display format; see each module page for placeholders
format-alt string — Alternate format; a left click toggles between the two
max-length int (px) 0 (unlimited) Maximum rendered text width in pixels; longer text is truncated with ...
scroll-interval int (ms) global value Per-module scroll debounce override
smooth-scrolling-threshold float global value Per-module smooth-scroll threshold override
on-click string — Command run on left click
on-click-middle string — Command run on middle click
on-click-right string — Command run on right click
on-scroll-up string — Command run on scroll up
on-scroll-down string — Command run on scroll down

See Module actions for the command syntax.

max-length

max-length limits the rendered pixel width of the module text (0 = unlimited). Truncated text gets a ... suffix.

"window": {
    "format": "{}",
    "max-length": 300
}

scroll-interval

Debounces repeated scroll events: scrolls inside the interval keep resetting the timer, so a continuous scroll only triggers once. It can be set at the top level or per module:

"workspaces": {
    "scroll-interval": 100,
    "on-scroll-up": "mmsg dispatch viewtoleft_have_client",
    "on-scroll-down": "mmsg dispatch viewtoright_have_client"
}

smooth-scrolling-threshold

Controls how much continuous pointer-axis motion (e.g. a touchpad two-finger gesture) produces one scroll action. Motion is accumulated independently for horizontal and vertical axes; amounts below the threshold are kept for the next frame. Discrete mouse-wheel steps always use their protocol-provided step count.

"backlight": { "smooth-scrolling-threshold": 5.0 }

interval (polled modules)

The cpu, memory and network modules refresh on a fixed interval. Set interval (seconds) on a module to override the global sys-interval for that module only; 0 or an omitted key falls back to the global value.

"sys-interval": 2,      // default for every polled module

"cpu":     { "format": " {load}%", "interval": 1 },
"memory":  { "format": " {}%",     "interval": 5 },
"network": { "format": " {ifname}", "format-alt": "↓{down} ↑{up}", "interval": 1 }

cpu usage is a rate averaged over the interval, and network up/down speeds are averaged over the interval as well, so larger intervals give steadier readings. The network module additionally re-detects its interface immediately on network udev events, so a link change does not have to wait for the next interval. Modules not listed above ignore interval: pulseaudio and backlight update on system events, while battery and clock follow the global sys-interval.

format-alt

Any module with a format can define format-alt; a left click toggles between the two formats (the module's on-click command still runs if configured).

"network": {
    "format": "{icon} {ifname}",
    "format-alt": "↓{down} ↑{up}"
}

Example

See the bundled config.jsonc for a complete example, and Styling for the CSS side.

Module actions

Actions are configured through each module's on-click / on-click-middle / on-click-right / on-scroll-up / on-scroll-down fields.

Command Behavior
@view Switch to a tag over IPC (tags module)
@toggle Toggle a tag over IPC (tags module)
@ipc:xxx Send xxx verbatim over the compositor IPC socket
anything else Run via /bin/sh -c
"layout": {
    "format": "{}"
},
"window": {
    "format": "{}",
    "on-click": "bash ~/.config/mango/scripts/screenshot.sh",
    "on-click-right": "python /home/wrq/tool/ocr.py"
},
"workspaces": {
    "on-click": "activate",
    "on-click-right": "toggle",
    "on-scroll-up": "mmsg dispatch viewtoleft_have_client",
    "on-scroll-down": "mmsg dispatch viewtoright_have_client"
}

@ipc: commands are useful for controlling the compositor directly, e.g.

"tags": {
    "on-click": "activate",
    "on-click-right": "toggle"
}

The special activate / toggle values are translated to the mangowm IPC commands @view and @toggle respectively.

Clone this wiki locally