Skip to content

1. Widgets

mocki-toki edited this page Feb 26, 2025 · 1 revision

Widgets are elements that are placed on barik. For example: time, battery indicator. The widgets section in the configuration is responsible for widget settings. You can configure the displayed widgets using displayed property in the desired order. Widgets can be duplicated and customized individually using = {} construction if needed (see the commented-out default.time example).

[widgets]
displayed = [ # widgets on menu bar
    "default.spaces",
    "spacer",
    "default.nowplaying",
    "default.network",
    "default.battery",
    "divider",
    # { "default.time" = { time-zone = "America/Los_Angeles", format = "E d, hh:mm" } },
    "default.time",
]

Default widgets

Spaces (default.spaces)

SCR-20250226-lzdk

A widget that uses yabai or aerospace to display the current spaces, windows within them, as well as the currently active window and space. Clicking on an application icon changes the focus to that window.

Configuration

[widgets.default.spaces]
space.show-key = true        # show space number (or character, if you use AeroSpace)
window.show-title = true
window.title.max-length = 50

# A list of applications that will always be displayed by application name.
# Other applications will show the window title if there is more than one window.
window.title.always-display-app-name-for = ["Mail", "Chrome", "Arc"]

Spacer (spacer)

image

An auxiliary widget that creates empty space between the widgets it is placed between.

Now Playing (default.nowplaying)

SCR-20250226-meih

A widget that displays the currently playing song. Supports the following services:

  1. Spotify (requires the desktop application)
  2. Apple Music (requires the desktop application)

Create an issue so we can add your favorite music service: https://github.com/mocki-toki/barik/issues/new

Wifi/Ethernet indicator (default.network)

SCR-20250226-mepu

A widget that appears when successfully connected to the internet via WiFi or Ethernet.

Battery (default.battery)

SCR-20250226-meud

A widget that displays the current battery charge.

Configuration

[widgets.default.battery]
show-percentage = true
warning-level = 30
critical-level = 10

Divider (divider)

SCR-20250226-meyx

An auxiliary widget that creates a visual separation between widgets.

Time (default.time)

SCR-20250226-mfba

A widget that displays the current time in the specified format. It also displays the nearest event for today if this feature is enabled in the configuration.

Configuration

[widgets.default.time]
format = "E d, J:mm"
calendar.format = "J:mm"

calendar.show-events = true
# calendar.allow-list = ["Home", "Personal"] # show only these calendars
# calendar.deny-list = ["Work", "Boss"] # show all calendars except these

Third-party widgets

The Extension API is in development; you can suggest your ideas to help with the implementation: https://github.com/mocki-toki/barik/issues/44