// -*- mode: jsonc -*-
{
    "layer": "top",
    "position": "top",
    "height": 30,
    "spacing": 4,
    "modules-left": [
        "niri/workspaces"
    ],
    "modules-center": [
        "niri/window"
    ],
    "modules-right": [

% for iface in host.wireless + host.ethernet:
        "network#${iface}",
% endfor

% if not host.ethernet and host.auto_ethernet:
        "network#auto_ethernet",
% endif

        "wireplumber",
        "battery",
        "group/disks",
        "cpu",
        "memory",

% if host.temperature_path:
        "temperature",
% endif

        "clock#utc",
        "clock#local"
    ],
    
% for iface in host.wireless:
    "network#${iface}": {
        "interface": "${iface}",
        "format": "\uf1eb \uf058",
        "format-disconnected": "\uf1eb \uf057",
        "tooltip-format": "${iface} {ipaddr} {essid} {signalStrength}",
        "tooltip-format-disconnected": "${iface} down"
    },
% endfor

% for iface in host.ethernet:
    "network#${iface}": {
        "interface": "${iface}",
        "format": "\uf6ff \uf058",
        "format-disconnected": "\uf6ff \uf057",
        "tooltip-format": "${iface} {ipaddr}",
        "tooltip-format-disconnected": "${iface} down"
    },
% endfor

% if not host.ethernet and host.auto_ethernet:
    "network#auto_ethernet": {
        "interface": "en*",
        "format": "\uf6ff \uf058",
        "format-disconnected": "\uf6ff \uf057",
        "tooltip-format": "${iface} {ipaddr}",
        "tooltip-format-disconnected": "${iface} down"
    },
% endif

    "wireplumber": {
        "format": "{icon} {volume}%",
        "format-muted": "\uf6a9 {volume}%",
        "format-icons": ["\uf026", "\uf027", "\uf028"]
    },

% if host.has_battery:
    "battery": {
        "design-capacity": true,
        "format": "{icon} {capacity}% {time}",
        "format-time": "{H}:{m}",
        "format-icons": [
            "\uf244",
            "\uf243",
            "\uf242",
            "\uf241",
            "\uf240",
        ],
        "format-charging": "\ue55b {capacity}% {time}",
        "format-full": "\ue55c {capacity}%",
    },
% endif

    "group/disks": {
        // TODO: make drawer that expands orthogonally, outside of the bar
        "orientation": "inherit",
        "modules": [
% for disk in host.disks:
            "disk#${disk}",
% endfor
        ],
        "drawer": {}
    },

% for disk in host.disks:
    "disk#${disk}": {
        "path": "${disk}",
        "format": "${disk} {free}",
        "tooltip-format": "{used} / {total} ({percentage_used}%)"
    },
% endfor

    "cpu": {
        "format": "\uf2db {usage}%",
        "tooltip": false
    },
    "memory": {
        "format": "\uf538 {percentage}%",
        "tooltip-format": "{used}GiB / {total}GiB"
    },

% if host.temperature_path:
    "temperature": {
        "format": "{temperatureC}°C",
        "hwmon-path": "${host.temperature_path}"
    },
% endif

    "clock#utc": {
        "interval": 5,
        "format": "{:%Y-%m-%d %H:%M:%S}",
        "timezone": "UTC",
        "tooltip": false
    },
    "clock#local": {
        "interval": 5,
        "format": "{:%H:%M}",
        "tooltip": false
    }
}
