[colors]
background = #222
background-alt = #444
background-deep = #111
foreground = #dfdfdf
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
ramp-0 = #ffe77b
ramp-1 = #ffdf51
ramp-2 = #ffd82a
ramp-3 = #dfb704
ramp-4 = #ae8e00
ramp-5 = #ff872a
ramp-6 = #df6304
ramp-7 = #ae4c00

[bar/top]
monitor = ${env:MONITOR:DVI-0}
height = 25
width = 100%
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}
module-margin = 2 
font-0 = NotoSans\-Regular:pixelsize=10;2
font-1 = FontAwesome:pixelsize=10;2

modules-left = topmenu pavolume
modules-center = cmus 
modules-right = vpn ping date

[bar/bottom]
monitor = ${env:MONITOR:DVI-0}
bottom = true
width = 100%
height = 25
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 4 
padding-left = 0
padding-right = 4
module-margin = 4 
tray-position = left
tray-padding = 5 
tray-transparent = true
tray-background = #0063ff
font-0 = NotoSans\-Regular:pixelsize=10;2
font-1 = FontAwesome:pixelsize=10;2

modules-left = i3
modules-center = xwindow
modules-right = cpu memory

[bar/bottom2]
monitor = ${env:MONITOR:DVI-1}
bottom = true
width = 100%
height = 25
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 4
padding-left = 0
padding-right =  4
module-margin = 4 
font-0 = fixed:pixelsize=10;2
font-1 = FontAwesome:pixelsize=10;2

modules-left = i3 pacman bitcoin
modules-right = filesystem

[module/bspwm]
type = internal/bspwm

label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2

label-occupied = %index%
label-occupied-padding = 2

label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent-padding = 2

label-empty = %index%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2

[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false

; Only show workspaces on the same output as the bar
pin-workspaces = true

label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}

; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${module/bspwm.label-focused-background}
label-focused-underline = ${module/bspwm.label-focused-underline}
label-focused-padding = ${module/bspwm.label-focused-padding}

; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = ${module/bspwm.label-occupied-padding}

; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}

; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${module/bspwm.label-urgent-background}
label-urgent-padding = ${module/bspwm.label-urgent-padding}

[module/xwindow]
type = internal/xwindow
label = %title%
label-maxlen = 50

[module/pavolume]
type = custom/script
tail = true
label = %output%
exec = ~/.dotfiles/polybar/scripts/pavolume.sh --listen
click-right = exec pavucontrol
click-left = ~/.dotfiles/polybar/scripts/pavolume.sh --togmute
scroll-up = ~/.dotfiles/polybar/scripts/pavolume.sh --up
scroll-down = ~/.dotfiles/polybar/scripts/pavolume.sh --down

[module/bitcoin]
type = custom/script
interval = 300 
format = <label>
format-prefix = "  "
exec = ~/.dotfiles/polybar/scripts/bitcoin.py

[module/cmus]
type = custom/script
interval = 1
exec = ~/.dotfiles/polybar/scripts/cmus.sh
exec-if = pgrep -x cmus
label = "♪  %output%"
click-left = cmus-remote --pause
click-right = cmus-remote --stop
scroll-up = cmus-remote --next
scroll-down = cmus-remote --previous

[module/vpn]
type = custom/script
interval = 60
exec = ~/.dotfiles/polybar/scripts/ipaddr.py
exec-if = pgrep -x openvpn
label = "  %output%"

[module/ping]
type = custom/script
interval = 10
exec = ~/.dotfiles/polybar/scripts/ping.py
label = "PING  %output%ms"

[module/date]
type = internal/date
interval = 10
format-background = ${colors.background-deep} 
format-padding = 4
date = "%a %b %e"
time = "%H:%M"
label = "  %date%, %time%"

[module/topmenu]
type = custom/menu
label-open = "☰"
label-close = "✖"
label-separator = " | "
format-background = ${colors.background-deep} 
format-padding = 4
expand-right = true
menu-0-0 = vpn
menu-0-0-exec = menu-open-1
menu-0-1 = sys
menu-0-1-exec = menu-open-2

menu-1-0 = kill
menu-1-0-exec = sudo killall -q openvpn 
menu-1-1 = uk
menu-1-1-exec = ~/.dotfiles/bin/vpn uk &
menu-1-2 = usa
menu-1-2-exec = ~/.dotfiles/bin/vpn us &
menu-1-3 = nl
menu-1-3-exec = ~/.dotfiles/bin/vpn nl &

menu-2-0 = lock
menu-2-0-exec = ~/.dotfiles/bin/i3exit lock &
menu-2-1 = reboot
menu-2-1-exec = ~/.dotfiles/bin/i3exit reboot &
menu-2-2 = shutdown
menu-2-2-exec = ~/.dotfiles/bin/i3exit shutdown &

[module/filesystem]
type = internal/fs
interval = 5 
spacing = 4
fixed-values = true
label-mounted = %mountpoint%: %free%
mount-0 = /
mount-1 = /home
mount-2 = /mnt/repo
mount-3 = /tmp

[module/cpu]
type = internal/cpu
interval = 2
format = <label> <ramp-coreload>
label = "CPU  "
ramp-coreload-0 = ▁
ramp-coreload-0-foreground = ${colors.ramp-0}
ramp-coreload-1 = ▂
ramp-coreload-1-foreground = ${colors.ramp-1}
ramp-coreload-2 = ▃
ramp-coreload-2-foreground = ${colors.ramp-2}
ramp-coreload-3 = ▄
ramp-coreload-3-foreground = ${colors.ramp-3}
ramp-coreload-4 = ▅
ramp-coreload-4-foreground = ${colors.ramp-4}
ramp-coreload-5 = ▆
ramp-coreload-5-foreground = ${colors.ramp-5}
ramp-coreload-6 = ▇
ramp-coreload-6-foreground = ${colors.ramp-6}
ramp-coreload-7 = █
ramp-coreload-7-foreground = ${colors.ramp-7}

[module/memory]
type = internal/memory
interval = 2
format = <label> <bar-used>
label = "RAM  "
bar-used-indicator =
bar-used-width = 50 
bar-used-fill = |
bar-used-empty = |
bar-used-empty-foreground = ${colors.background-alt}
bar-used-foreground-0 = ${colors.ramp-0}
bar-used-foreground-1 = ${colors.ramp-1}
bar-used-foreground-2 = ${colors.ramp-2}
bar-used-foreground-3 = ${colors.ramp-3}
bar-used-foreground-4 = ${colors.ramp-4}
bar-used-foreground-5 = ${colors.ramp-5}
bar-used-foreground-6 = ${colors.ramp-6}
bar-used-foreground-7 = ${colors.ramp-7}

[module/pacman]
type = custom/script
interval = 1800
format = <label>
label = "%output:0:30%"
exec = ~/.dotfiles/polybar/scripts/pacman.sh

