Extend the pow_format spec parser beyond alignment so configs can shape the
rendered number, not just pad it. A forced scale (#, k, M, G, T, P) pins the SI
prefix instead of auto-selecting it and, since the author then knows both scale
and unit, hides the prefix and unit by default; U brings the unit back, u hides
it in auto mode, and i forces integer display. b and B override the decimal or
binary base independently of the call site, and a trailing width now fixes the
coefficient field when a scale is forced, overflowing to '#' when it does not
fit.
The old '>' and '<' branches rendered via fmt::format("{}", s), which discarded
every new field on the recursive call; they now build from a single render path
that reads the current formatter, so modifiers survive alignment. The auto path
is byte-identical to before, verified against the previous implementation.
Adds a Catch2 suite covering each modifier alone and combined, plus the
backward-compatible alignment cases, and documents the modifiers in the network
and disk man pages.
271 lines
7.8 KiB
Scdoc
271 lines
7.8 KiB
Scdoc
waybar-network(5)
|
|
|
|
# NAME
|
|
|
|
waybar - network module
|
|
|
|
# DESCRIPTION
|
|
|
|
The *network* module displays information about the current network connections.
|
|
|
|
# CONFIGURATION
|
|
|
|
Addressed by *network*
|
|
|
|
*interface*: ++
|
|
typeof: string ++
|
|
Use the defined interface instead of auto-detection. Accepts wildcard.
|
|
|
|
*rfkill*: ++
|
|
typeof: bool ++
|
|
default: true ++
|
|
If enabled, the *disabled* format will be used when rfkill is blocking wlan interfaces.
|
|
|
|
*interval*: ++
|
|
typeof: integer ++
|
|
default: 60 ++
|
|
The interval in which the network information gets polled (e.g. signal strength).
|
|
|
|
*family*: ++
|
|
typeof: string ++
|
|
default: *ipv4* ++
|
|
The address family that is used for the format replacement {ipaddr} and to determine if a network connection is present. Set it to ipv4_6 to display both.
|
|
|
|
*format*: ++
|
|
typeof: string ++
|
|
default: *{ifname}* ++
|
|
The format, how information should be displayed. This format is used when other formats aren't specified.
|
|
|
|
*format-ethernet*: ++
|
|
typeof: string ++
|
|
This format is used when an ethernet interface is displayed.
|
|
|
|
*format-wifi*: ++
|
|
typeof: string ++
|
|
This format is used when a wireless interface is displayed.
|
|
|
|
*format-linked*: ++
|
|
typeof: string ++
|
|
This format is used when a linked interface with no IP address is displayed.
|
|
|
|
*format-disconnected*: ++
|
|
typeof: string ++
|
|
This format is used when the displayed interface is disconnected.
|
|
|
|
*format-disabled*: ++
|
|
typeof: string ++
|
|
This format is used when rfkill is blocking wlan interfaces.
|
|
|
|
*format-alt*: ++
|
|
typeof: string ++
|
|
On click, toggle between this format and the regular format. The click button is set with *format-alt-click* (defaults to the left button).
|
|
|
|
*format-icons*: ++
|
|
typeof: array/object ++
|
|
Based on the current signal strength, the corresponding icon gets selected. ++
|
|
The order is *low* to *high*. Or by the state if it is an object.
|
|
|
|
*rotate*: ++
|
|
typeof: integer ++
|
|
Positive value to rotate the text label (in 90 degree increments).
|
|
|
|
*max-length*: ++
|
|
typeof: integer ++
|
|
The maximum length in character the module should display.
|
|
|
|
*min-length*: ++
|
|
typeof: integer ++
|
|
The minimum length in characters the module should accept.
|
|
|
|
*align*: ++
|
|
typeof: float ++
|
|
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
|
|
|
|
*justify*: ++
|
|
typeof: string ++
|
|
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
|
|
|
|
*on-click*: ++
|
|
typeof: string ++
|
|
Command to execute when clicked on the module.
|
|
|
|
*on-click-middle*: ++
|
|
typeof: string ++
|
|
Command to execute when middle-clicked on the module using mousewheel.
|
|
|
|
*on-click-right*: ++
|
|
typeof: string ++
|
|
Command to execute when you right-click on the module.
|
|
|
|
*on-update*: ++
|
|
typeof: string ++
|
|
Command to execute when the module is updated.
|
|
|
|
*on-scroll-up*: ++
|
|
typeof: string ++
|
|
Command to execute when scrolling up on the module.
|
|
|
|
*on-scroll-down*: ++
|
|
typeof: string ++
|
|
Command to execute when scrolling down on the module.
|
|
|
|
*smooth-scrolling-threshold*: ++
|
|
typeof: double ++
|
|
Threshold to be used when scrolling.
|
|
|
|
*tooltip*: ++
|
|
typeof: bool ++
|
|
default: *true* ++
|
|
Option to disable tooltip on hover.
|
|
|
|
*tooltip-format*: ++
|
|
typeof: string ++
|
|
The format, how information should be displayed in the tooltip. This format is used when other formats aren't specified.
|
|
|
|
*tooltip-format-ethernet*: ++
|
|
typeof: string ++
|
|
This format is used when an ethernet interface is displayed.
|
|
|
|
*tooltip-format-wifi*: ++
|
|
typeof: string ++
|
|
This format is used when a wireless interface is displayed.
|
|
|
|
*tooltip-format-disconnected*: ++
|
|
typeof: string ++
|
|
This format is used when the displayed interface is disconnected.
|
|
|
|
*tooltip-format-disabled*: ++
|
|
typeof: string ++
|
|
This format is used when rfkill is blocking wlan interfaces.
|
|
|
|
*menu*: ++
|
|
typeof: string ++
|
|
Action that popups the menu.
|
|
|
|
*menu-file*: ++
|
|
typeof: string ++
|
|
Location of the menu descriptor file. There need to be an element of type
|
|
GtkMenu with id *menu*
|
|
|
|
*menu-actions*: ++
|
|
typeof: array ++
|
|
The actions corresponding to the buttons of the menu.
|
|
|
|
*expand*: ++
|
|
typeof: bool ++
|
|
default: false ++
|
|
Enables this module to consume all left over space dynamically.
|
|
|
|
# FORMAT REPLACEMENTS
|
|
|
|
*{ifname}*: Name of the network interface.
|
|
|
|
*{ipaddr}*: The first IP of the interface.
|
|
|
|
*{gwaddr}*: The default gateway for the interface
|
|
|
|
*{netmask}*: The subnetmask corresponding to the IP(V4).
|
|
|
|
*{netmask6}*: The subnetmask corresponding to the IP(V6).
|
|
|
|
*{cidr}*: The subnetmask corresponding to the IP(V4) in CIDR notation.
|
|
|
|
*{cidr6}*: The subnetmask corresponding to the IP(V6) in CIDR notation.
|
|
|
|
*{essid}*: Name (SSID) of the wireless network.
|
|
|
|
*{bssid}*: MAC address (BSSID) of the wireless access point.
|
|
|
|
*{signalStrength}*: Signal strength of the wireless network.
|
|
|
|
*{signaldBm}*: Signal strength of the wireless network in dBm.
|
|
|
|
*{signalStrengthApp}*: Human-readable descriptor of the wireless connectivity derived from the signal strength (e.g. "Great Connectivity", "Streaming", "Poor Connectivity").
|
|
|
|
*{frequency}*: Frequency of the wireless network in GHz.
|
|
|
|
*{bandwidthUpBits}*: Instant up speed in bits/seconds.
|
|
|
|
*{bandwidthDownBits}*: Instant down speed in bits/seconds.
|
|
|
|
*{bandwidthTotalBits}*: Instant total speed in bits/seconds.
|
|
|
|
*{bandwidthUpOctets}*: Instant up speed in octets/seconds.
|
|
|
|
*{bandwidthDownOctets}*: Instant down speed in octets/seconds.
|
|
|
|
*{bandwidthTotalOctets}*: Instant total speed in octets/seconds.
|
|
|
|
*{bandwidthUpBytes}*: Instant up speed in bytes/seconds.
|
|
|
|
*{bandwidthDownBytes}*: Instant down speed in bytes/seconds.
|
|
|
|
*{bandwidthUpBytesCompact}*: Instant up speed in bytes/seconds, formatted compactly (e.g. 1.2K).
|
|
|
|
*{bandwidthDownBytesCompact}*: Instant down speed in bytes/seconds, formatted compactly (e.g. 1.2K).
|
|
|
|
*{bandwidthTotalBytes}*: Instant total speed in bytes/seconds.
|
|
|
|
*{txBitrate}*: Link transmit bitrate (e.g., 866.7 Mb/s).
|
|
|
|
*{rxBitrate}*: Link receive bitrate (e.g., 866.7 Mb/s).
|
|
|
|
*{linkSpeed}*: Ethernet link speed.
|
|
|
|
*{icon}*: Icon, as defined in *format-icons*.
|
|
|
|
# NUMBER FORMAT MODIFIERS
|
|
|
|
The bandwidth/bitrate replacements above (*{bandwidth\*}*, *{txBitrate}*,
|
|
*{rxBitrate}*, *{linkSpeed}*) auto-scale the number with an SI prefix (k, M, G,
|
|
…). Their rendering can be tuned with fmt-style modifiers, e.g.
|
|
*"{bandwidthDownBits:>}"* or *"{bandwidthDownBits:M}"*. Modifiers may be combined
|
|
in any order:
|
|
|
|
*<*, *=*, *>*: Alignment/padding (left, column-align, right) — as before.
|
|
|
|
*u* / *U*: Hide (*u*) or show (*U*) the unit suffix. The unit is shown by default
|
|
with an auto scale and hidden by default when a scale is forced (see below).
|
|
|
|
*#*, *k*, *M*, *G*, *T*, *P*: Force a fixed scale instead of auto-selecting one
|
|
(*#* = base scale, no prefix). Forcing a scale hides the scale prefix and, by
|
|
default, the unit (re-enable it with *U*). E.g. *"{bandwidthDownBits:M}"* always
|
|
shows the value in megabits.
|
|
|
|
*i*: Force integer display (no decimals).
|
|
|
|
*b* / *B*: Force decimal base 1000 (*b*) or binary base 1024 with an *i* marker
|
|
(*B*), overriding the module default.
|
|
|
|
A trailing number is a fixed width for the coefficient when a scale is forced; if
|
|
the value does not fit, it is shown as *#* characters (e.g. *"{bandwidthDownBits:=3#}"*
|
|
→ *###*). Without a forced scale the number is ignored (kept for config
|
|
compatibility).
|
|
|
|
# EXAMPLES
|
|
|
|
```
|
|
"network": {
|
|
"interface": "wlp2s0",
|
|
"format": "{ifname}",
|
|
"format-wifi": "{essid} ({signalStrength}%) ",
|
|
"format-ethernet": "{ifname} ",
|
|
"format-disconnected": "", //An empty format will hide the module.
|
|
"format-disconnected": "",
|
|
"tooltip-format": "{ifname}",
|
|
"tooltip-format-wifi": "{essid} ({signalStrength}%) ",
|
|
"tooltip-format-ethernet": "{ifname} ",
|
|
"tooltip-format-disconnected": "Disconnected",
|
|
"max-length": 50
|
|
}
|
|
```
|
|
|
|
# STYLE
|
|
|
|
- *#network*
|
|
- *#network.disconnected*
|
|
- *#network.disabled*
|
|
- *#network.linked*
|
|
- *#network.ethernet*
|
|
- *#network.wifi*
|