[colors]
bg = #141414
border = #444649
text = #feffd3
dim = #778284
accent = #afb979
red = #c06c43
green = #afb979
yellow = #c2a86c
blue = #444649
magenta = #b4be7b
cyan = #778284

[bar/top]
wm-restack = bspwm
monitor = ${env:MONITOR:}
width = 99%
height = 28
bottom = false
offset-x = 0.5%
offset-y = 0.5%
fixed-center = true

background = ${colors.bg}
foreground = ${colors.text}

border-size = 2
border-color = ${colors.border}

padding = 1
module-margin = 0

modules-left = bspwm
# modules-center = media-window-toggle
modules-center = xwindow
modules-right = cpu sep ram sep gpu sep volume sep time

font-0 = JetBrainsMono Nerd Font:style=Bold:pixelsize=10;2
font-1 = JetBrainsMono Nerd Font:style=Bold:pixelsize=12;2

; Separators
[module/sep]
type = custom/text
content = "|"
content-foreground = ${colors.dim}

; Workspaces
[module/bspwm]
type = internal/bspwm

pin-workspaces = true
inline-mode = true
enable-click = true
enable-scroll = true
reverse-scroll = false

format = <label-state>

ws-icon-0 = 1;1
ws-icon-1 = 2;2
ws-icon-2 = 3;3
ws-icon-3 = 4;4
ws-icon-4 = 5;5
ws-icon-5 = 6;6
ws-icon-6 = 7;7
ws-icon-7 = 8;8

label-focused = "[%icon%]"
label-focused-foreground = ${colors.accent}
label-focused-padding = 1

label-occupied = "%icon%"
label-occupied-foregrounk = ${colors.text}
label-occupied-padding = 1

label-empty = "%icon%"
label-empty-foreground = ${colors.dim}
label-empty-padding = 1

label-urgent = "!%icon%!"
label-urgent-foreground = ${colors.red}
label-urgent-padding = 1

; Titles
[module/xwindow]
type = internal/xwindow
label = %title%
label-maxlen = 50
label-foreground = ${colors.text}
label-empty = Desktop
label-empty-foreground = ${colors.dim}

; Time
[module/time]
type = internal/date
interval = 1

format = <label>
format-padding = 1

label = "%{F#afb979}%{F-}%time% %{F#778284}|%{F-} %date%"
date = %a %d
time = %H:%M

; Resources
[module/cpu]
type = custom/script
exec = "$HOME/.config/scripts/system-info.sh --cpu --normal-color '#b4be7b' --critical-color '#c06c43'"
click-left = "$HOME/bin/system-info.sh --cpu --click"
format = "%{F#b4be7b}CPU%{F-} <label>"
format-padding = 1
interval = 2

[module/ram]
type = custom/script
exec = "$HOME/.config/scripts/system-info.sh --ram --normal-color '#c2a86c' --critical-color '#c06c43'"
format = "%{F#c2a86c}RAM%{F-} <label>"
format-padding = 1
interval = 2

[module/gpu]
type = custom/script
exec = "$HOME/.config/scripts/system-info.sh --gpu --normal-color '#778284' --critical-color '#c06c43'"
click-left = "$HOME/bin/system-info.sh --gpu --click"
format = "%{F#778284}GPU%{F-} <label>"
format-padding = 1
interval = 2

; Audio
[module/volume]
type = custom/script
exec = "SESSION_TYPE=x11 sh $HOME/.config/scripts/volume.sh --device output --status --disabled-color '#c06c43' --enabled-color '#afb979'"
tail = true
click-left = "sh $HOME/bin/volume.sh --device output --action toggle"
scroll-up = "sh $HOME/bin/volume.sh --device output --action increase"
scroll-down = "sh $HOME/bin/volume.sh --device output --action decrease"
format = "%{F#afb979}VOL%{F-} <label>"
format-padding = 1

; Media player
[module/media]
type = custom/script
exec = playerctl metadata --format "{{ artist }} - {{ title }}" 2>/dev/null | head -c 30
exec-if = playerctl status 2>/dev/null
click-left = playerctl play-pause
click-right = playerctl next
click-middle = playerctl previous
scroll-up = playerctl volume 0.05+
scroll-down = playerctl volume 0.05-
format = "%{F#b4be7b}♫%{F-} <label>"
format-padding = 1
interval = 2
label-maxlen = 30

[module/media-window-toggle]
type = custom/script
exec = $HOME/.config/scripts/media.sh
click-left = touch /tmp/polybar-toggle-state
interval = 1
label = %output%
label-maxlen = 80
