Skip to content

Bar

Default options for reference:

ts
import GLib from "gi://GLib"
import { opt, mkOptions } from "~lib/option"

export type BarWidget =
    | "launcher"
    | "battery"
    | "date"
    | "launcher"
    | "media"
    | "powermenu"
    | "systray"
    | "system"
    | "taskbar" // Hyprland only
    | "workspaces" // Hyprland only
    | "screenrecord"
    | "messages"
    | "spacer"

export default mkOptions("bar", {
    bold: opt(true),
    position: opt<"top" | "bottom">("top"),
    corners: opt<"none" | "sm" | "md" | "lg" | "xl">("md"),
    transparent: opt(false),
    layout: {
        start: opt<Array<BarWidget>>([
            "launcher",
            "workspaces",
            "taskbar",
            "spacer",
            "messages",
        ]),
        center: opt<Array<BarWidget>>([
            "date",
        ]),
        end: opt<Array<BarWidget>>([
            "media",
            "spacer",
            "systray",
            // "colorpicker",
            "screenrecord",
            "system",
            "battery",
            "powermenu",
        ]),
    },
    launcher: {
        suggested: opt(false),
        flat: opt(true),
        icon: opt(GLib.get_os_info("LOGO") || "system-search-symbolic"),
        label: opt("Applications"),
        action: opt("astal -t launcher"),
    },
    date: {
        flat: opt(true),
        format: opt("%H:%M - %A %e."),
        action: opt(`astal eval "launcher('cal')"`),
    },
    battery: {
        suggested: opt(true),
        flat: opt(true),
        bar: opt<"hidden" | "regular">("regular"),
        percentage: opt(true),
        low: opt(30),
        size: opt<"sm" | "md" | "lg">("md"),
    },
    workspaces: {
        flat: opt(true),
        workspaces: opt(7),
        action: opt(`astal eval "launcher('h')"`),
    },
    taskbar: {
        flat: opt(true),
        monochrome: opt(true),
    },
    messages: {
        flat: opt(true),
        action: opt(`astal eval "launcher('n')"`),
    },
    systray: {
        flat: opt(true),
        ignore: opt([
            "KDE Connect Indicator",
            "spotify-client",
        ]),
    },
    media: {
        flat: opt(true),
        monochrome: opt(true),
        preferred: opt("spotify"),
        direction: opt<"left" | "right">("right"),
        format: opt("{artist} - {title}"),
        maxChars: opt(40),
        timeout: opt(5000), // for how long to reveal on new song
    },
    powermenu: {
        suggested: opt(true),
        flat: opt(true),
        action: opt("astal -t powermenu"),
    },
    systemIndicators: {
        flat: opt(true),
        action: opt(`astal eval "launcher('a')"`),
    },
})

Screenrecording

The screenrecording module is integrated with the bundled screenrecord script. It uses wf-record, slurp and libnotify