[{
    "layer": "bottom",
    "position": "top",

    "modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
    "modules-center": [],
    "modules-right": ["pulseaudio", "backlight", "network", "custom/vpn", "custom/pkg", "battery", "clock"],
    "sway/mode": {
        "format": " {}"
    },
    "sway/workspaces": {
        "format": "{name}",
        "disable-scroll": true
    },
    "sway/window": {
        "max-length": 80,
        "tooltip": false
    },
    "clock": {
        "interval": 1,
        "format": "{:%d<span foreground='#929292'>%m</span><span foreground='#606060'>%y</span> %H<span foreground='#929292'>%M</span><span foreground='#606060'>%S</span>}",
        "tooltip-format": "<tt><small>{calendar}</small></tt>",
        "calendar": {
                    "mode"          : "year",
                    "mode-mon-col"  : 3,
                    "weeks-pos"     : "right",
                    "on-scroll"     : 1,
                    "on-click-right": "mode",
                    "format": {
                              "months":     "<span color='#ffead3'><b>{}</b></span>",
                              "days":       "<span color='#ecc6d9'><b>{}</b></span>",
                              "weeks":      "<span color='#99ffdd'><b>W{}</b></span>",
                              "weekdays":   "<span color='#ffcc66'><b>{}</b></span>",
                              "today":      "<span color='#ff6699'><b><u>{}</u></b></span>"
                              }
                    }
    },
    "battery": {
        "format-icons": ["", "", "", "", ""],
        "format": "<span foreground='#929292'>{icon}</span> {capacity}%",
        "format-charging": "<span foreground='#929292'>{icon}</span> {capacity}%",
        "format-discharging": "<span foreground='#929292'>{icon}</span> {time}",
        "format-full": "<span foreground='#929292'>{icon}</span> {capacity}%",
        "interval": 30,
        "states": {
            "warning": 25,
            "critical": 10
        }
    },
    "custom/pkg": {
        "format": "{}",
        "interval": 3600,
        "exec": "~/.config/waybar/modules/pkg.sh",
        "return-type": "json"
    },
    "network": {
        "format-wifi": "<span foreground='#929292'></span> {essid} <span foreground='#929292'>{signalStrength}%</span>",
        "format-ethernet": "<span foreground='#929292'></span> wired",
        "format-disconnected": "",
        "tooltip": false
    },

    "pulseaudio": {
        "format": "{icon} {volume}%",
        "format-muted": "<span foreground='#929292'></span>",
        "format-icons": {
            "default": ["<span foreground='#929292'></span>"],
            "headphones": ["<span foreground='#929292'></span>"]
        },
        "on-scroll-up": "pamixer -ui 2 && pamixer --get-volume > $SWAYSOCK.wob",
        "on-scroll-down": "pamixer -ud 2 && pamixer --get-volume > $SWAYSOCK.wob",
        "tooltip": false
    },
    "custom/vpn": {
        "format": "<span foreground='#929292'></span> vpn",
        "interval": 5,
        "exec" : "echo a",
        "exec-if" : "pgrep openconnect"
    },
    "backlight": {
        "format": "<span foreground='#929292'>{icon}</span> {percent}%",
        "format-icons": [""],
        "on-scroll-up": "brightnessctl set +2% && brightnessctl -m | cut -d',' -f4 | tr -d '%' > $SWAYSOCK.wob",
        "on-scroll-down": "brightnessctl set 2%- && brightnessctl -m | cut -d',' -f4 | tr -d '%' > $SWAYSOCK.wob"
    }
}, {
    "layer": "bottom",
    "position": "bottom",

    "modules-left": ["tray", "custom/spotify"],
    "modules-center": ["network#speed"],
    "modules-right": ["custom/systemd", "custom/backup", "custom/zfs-trim", "custom/zfs-scrub", "temperature", "custom/storage", "cpu", "memory" ],
    "custom/spotify": {
        "format": "<span foreground='#929292'></span> {}",
        "interval": 1,
        "exec": "~/.config/waybar/modules/spotify.sh",
        "exec-if": "pgrep spotify"
    },
    "network#speed": {
        "format-wifi": "<span foreground='#929292'></span> {bandwidthDownOctets} <span foreground='#929292'></span> {bandwidthUpOctets}",
        "format-ethernet": "<span foreground='#929292'></span> {bandwidthDownOctets} <span foreground='#929292'></span> {bandwidthUpOctets}",
        "interval": 1
    },
    "temperature": {
        "format": "<span foreground='#929292'></span> {temperatureC}°C",
        "thermal-zone": 1,
        "critical-threshold": 60,
	    "format-critical": "<span foreground='#ff5c57'></span> {temperatureC}°C"
    },
    "custom/storage": {
        "format": "<span foreground='#929292'></span> {}%",
        "return-type": "json",
        "interval": 60,
        "exec": "~/.config/waybar/modules/storage.sh /"
    },
    "custom/backup": {
        "format": " <span foreground='#f3f99d'>{}</span>",
        "interval": 5,
        "exec": "if test -f /etc/borgmatic/lock; then echo 'backup disabled'; elif pgrep borg >/dev/null; then echo 'backup...'; fi"
    },
    "custom/systemd": {
        "format": "<span foreground='#ff5c57'> {}</span>",
        "interval": 5,
        "exec": "~/.config/waybar/modules/systemd.sh",
        "exec-if": "which systemctl >/dev/null"
    },
    "custom/kubernetes": {
        "format": "<span foreground='#929292'></span> {}",
        "interval": 5,
        "exec": "~/.config/waybar/modules/kubernetes.sh",
        "exec-if": "kubectx -c >/dev/null"
    },
    "cpu": {
        "interval": 3,
        "format": "<span foreground='#929292'></span> {usage}%"
    },
    "memory": {
        "interval": 3,
        "format": "<span foreground='#929292'></span> {percentage}%"
    },
    "tray": {
        "icon-size": 18
    }
}]
