Skip to Content
mangobar

Configuration

Configure the bar and its modules using JSONC.

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

OptionTypeDefaultDescription
heightint30Bar height in logical pixels
layerstringtopLayer: top, overlay or bottom
buffer-scaleint1HiDPI multiplier on top of the output's Wayland scale; leave 1 to follow the display scale automatically
css / stylestring—Path to the CSS style file (overrides the default location)
scroll-intervalint (ms)0Debounce window for scroll actions (see below)
smooth-scrolling-thresholdfloat5.0Pointer-axis distance that produces one synthetic scroll step
sys-intervalint (s)2Default refresh interval for polled modules (cpu, memory, network, battery, clock)
modules-leftarray—Modules anchored to the left edge
modules-centerarray—Modules forced to the true screen center
modules-rightarray—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:

OptionTypeDefaultDescription
formatstringmodule-specificDisplay format; see each module page for placeholders
format-altstring—Alternate format; a left click toggles between the two
max-lengthint (px)0 (unlimited)Maximum rendered text width in pixels; longer text is truncated with ...
scroll-intervalint (ms)global valuePer-module scroll debounce override
smooth-scrolling-thresholdfloatglobal valuePer-module smooth-scroll threshold override
on-clickstring—Command run on left click
on-click-middlestring—Command run on middle click
on-click-rightstring—Command run on right click
on-scroll-upstring—Command run on scroll up
on-scroll-downstring—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.

CommandBehavior
@viewSwitch to a tag over IPC (tags module)
@toggleToggle a tag over IPC (tags module)
@ipc:xxxSend xxx verbatim over the compositor IPC socket
anything elseRun 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.

Last updated on

On this page