let {
    $workspaces = {
        type = "workspaces"
        all_monitors = false
    //     name_map = {
    //         1 = "󰙯"
    //         2 = "icon:firefox"
    //         3 = ""
    //         Games = "icon:steam"
    //         Code = ""
    //     }
    }

    $focused = { type = "focused" }

    $launcher = {
        type = "launcher"
        favorites = ["firefox" "discord" "steam"]
        show_names = false
        show_icons = true
    }

    $mpris = {
        type = "music"
        player_type = "mpris"

        on_click_middle = "playerctl play-pause"
        on_scroll_up = "playerctl volume +5"
        on_scroll_down = "playerctl volume -5"

    }

    $notifications = {
        type = "notifications"
        show_count = true

        icons.closed_none = "󰍥"
        icons.closed_some = "󱥂"
        icons.closed_dnd = "󱅯"
        icons.open_none = "󰍡"
        icons.open_some = "󱥁"
        icons.open_dnd = "󱅮"
    }

    $sys_info = {
        type = "sys_info"

        interval.memory = 30
        interval.cpu = 1
        interval.temps = 5
        interval.disks = 300
        interval.networks = 3

        format = [
        " {cpu_percent}% | {cpu_frequency} GHz | {temp_c@CPUTIN}°C"
        " {memory_used} / {memory_total} GB ({memory_available} {swap_used} / {swap_total} GB ({swap_free} | {swap_percent}%)"
        "󰋊 {disk_used#T@/:.1} / {disk_total#T@/:.1} TB ({disk_percent@/}%) | {disk_read} / {disk_write} MB/s"
        "󰓢 {net_down@enp39s0} / {net_up@enp39s0} Mbps"
        // "󰖡 {load_average1} | {load_average5} | {load_average15}"
        "󰥔 {uptime}"
        ]
    }

    $tray = { type = "tray" }

    $clock = { type = "clock" }

    $clipboard = { type = "clipboard" max_items = 75 truncate.mode = "end" truncate.length = 50 }

    $volume = {
        type = "volume"
        format = "{icon} {percentage}%"
        max_volume = 100
        icons.volume_high = "󰕾"
        icons.volume_medium = "󰖀"
        icons.volume_low = "󰕿"
        icons.muted = "󰝟"
    }

    // -- begin custom --
    $button = { type = "button" name="power-btn" label = "" on_click = "popup:toggle" }

    $popup = {
        type = "box"
        orientation = "vertical"
        widgets = [
            { type = "label" name = "header" label = "Power menu" }
            {
                type = "box"
                widgets = [
                    { type = "button" class="power-btn" label = "<span font-size='40pt'></span>" on_click = "!shutdown now" }
                    { type = "button" class="power-btn" label = "<span font-size='40pt'></span>" on_click = "!reboot" }
                ]
            }
            { type = "label" name = "uptime" label = "Uptime: {{30000:uptime -p | cut -d ' ' -f2-}}" }
        ]
    }

    $power_menu = {
        type = "custom"
        class = "power-menu"

        bar = [ $button ]
        popup = [ $popup ]

        tooltip = "Up: {{30000:uptime -p | cut -d ' ' -f2-}}"
    }
    // -- end custom --

    $left = [ $workspaces $launcher ]
    $right = [ $sys_info $volume $clipboard $power_menu $clock $notifications ]
}
in {
    anchor_to_edges = true
    position = "top"
    icon_theme = "Paper"

    start = $left
    end = $right
}
