# vim:ft=dosini
#              _       _
#  _ __   ___ | |_   _| |__   __ _ _ __
# | '_ \ / _ \| | | | | '_ \ / _` | '__|
# | |_) | (_) | | |_| | |_) | (_| | |
# | .__/ \___/|_|\__, |_.__/ \__,_|_|
# |_|            |___/
#
# Copyright (c) 2020 Vintage Salt <rehashedsalt@cock.li>
# Distributed under the terms of the MIT License
#

## VARIABLES
[res/colors]
red = #fb4934
green = #b8bb26
yellow = #fabd2f
blue = #83a598
magenta = #de869b
cyan = #8ec07c
white = #ebdbb2
black = #282828
gray = #32302f

bg = ${env:PB_COLOR_BG:#282828}
fg = ${env:PB_COLOR_FG:#ebdbb2}
border = ${env:PB_COLOR_BORDER:#32302f}
selection = #83a598

[res/config]
bar-width = 50
bar-fill = |
bar-empty = |
bar-indicator = 
border-size = 6
padding = 2

[settings]
screenchange-reload = true
format-padding = ${res/config.padding}
format-background = ${res/colors.bg}

## BARS
[template/bar]
bottom = false
wm-restack = ${env:PB_WM_RESTACK:i3}
tray-maxsize = 24
background = ${res/colors.bg}
foreground = ${res/colors.fg}
border-color = ${res/colors.border}
tray-background = ${res/colors.bg}
height = 48
width = 100%:-16
offset-x = 8
padding = 2
border-size = ${res/config.border-size}
font-0 = "IBM Plex Sans:style=Medium:size=12;2"
font-1 = "Deja Vu Sans Mono:style=Regular:size=12;2"
font-2 = "IBM Plex Sans:style=Bold:size=12;2"
font-3 = "Fork Awesome:style=Regular:size=12;2"
font-4 = "Font Awesome 5 Free:style=Regular:size=12;2"
font-5 = "Font Awesome 5 Brands:style=Regular:size=12;2"

[bar/primary]
monitor = ${env:PB_MONITOR:eDP-1}
inherit = template/bar
tray-position = right
modules-left = i3 bspwm service-ansible service-backup reboot-required
modules-center = date
modules-right = xkeyboard backlight pulse battery battery-bat1 |
border-top-size = 0

[bar/secondary]
monitor= ${env:PB_MONITOR:HDMI-A-0}
inherit = template/bar
modules-left = i3 bspwm
modules-right = xkeyboard pulse wlan-desktop-stats mpd | date
border-top-size = 0

## MODULES
[module/|]
type = custom/text
content = |
content-foreground = ${res/colors.border}

[module/backlight]
type = internal/xbacklight
format = <bar>
format-prefix = "BRI: "
format-prefix-foreground = ${res/colors.blue}
bar-width = ${res/config.bar-width}
bar-fill = ${res/config.bar-fill}
bar-fill-foreground = ${res/colors.blue}
bar-empty = ${res/config.bar-empty}
bar-empty-foreground = ${res/colors.border}
bar-indicator = ${res/config.bar-indicator}

[module/battery]
type = internal/battery
full-at = 100
time-format = %H:%M
interval = 60

format-charging = <ramp-capacity> <label-charging>
format-charging-foreground = ${res/colors.green}
format-discharging = <ramp-capacity> <label-discharging>
format-full = <ramp-capacity> <label-full>
format-full-foreground = ${res/colors.green}
label-charging = %percentage%%
label-discharging = %percentage%%
label-full = %percentage%%
ramp-capacity-0 = 
ramp-capacity-0-foreground = ${res/colors.yellow}
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 

[module/battery-bat1]
type = internal/battery
inherit = module/battery
battery = BAT1

[module/bspwm]
type = internal/bspwm
format = <label-state> <label-mode>
format-padding = 0
enable-scroll = false
pin-workspaces = true

label-mode-padding = 4
label-mode-background = ${res/colors.red}
label-focused = %name%
label-focused-padding = 4
label-focused-font = 3
label-focused-foreground = ${res/colors.bg}
label-focused-background = ${res/colors.selection}
label-occupied = %name%
label-occupied-padding = 4
label-occupied-font = 3
label-urgent = %name%
label-urgent-padding = 4
label-urgent-font = 3
label-urgent-foreground = ${res/colors.bg}
label-urgent-background = ${res/colors.yellow}
label-empty = %name%
label-empty-foreground = ${res/colors.border}
label-empty-padding = 4
label-monocle = 
label-monocle-padding = 4
label-monocle-background = ${res/colors.red}
label-pseudotiled = 
label-pseudotiled-padding = ${self.label-monocle-padding}
label-pseudotiled-background = ${res/colors.border}
label-floating = 
label-floating-padding = ${self.label-monocle-padding}
label-floating-background = ${res/colors.border}

[module/cpu]
type = internal/cpu
interval = 1
format = <bar-load>
format-prefix = "CPU: "
format-prefix-foreground = ${res/colors.blue}
bar-load-width = ${res/config.bar-width}
bar-load-fill = ${res/config.bar-fill}
bar-load-fill-foreground = ${res/colors.blue}
bar-load-empty = ${res/config.bar-empty}
bar-load-empty-foreground = ${res/colors.border}
bar-load-indicator = ${res/config.bar-indicator}

[module/date]
type = internal/date
date = %a %b %d
time = %I:%M %p
interval = 5
format = <label>
label = %{T3}%date% %time%%{T-}

[module/fshome]
type = internal/fs
mount-0 = /home
format-mounted = <bar-used> <label-mounted>
format-mounted-prefix = "Home: "
format-mounted-prefix-foreground = ${res/colors.yellow}
format-unmounted = 
label-mounted = %free% free
bar-used-width = ${res/config.bar-width}
bar-used-fill = ${res/config.bar-fill}
bar-used-fill-foreground = ${res/colors.yellow}
bar-used-empty = ${res/config.bar-empty}
bar-used-empty-foreground = ${res/colors.border}
bar-used-indicator = ${res/config.bar-indicator}

[module/fsroot]
type = internal/fs
mount-0 = /
format-mounted = <bar-used> <label-mounted>
format-mounted-prefix = "Root: "
format-mounted-prefix-foreground = ${res/colors.yellow}
label-mounted = %free% free
bar-used-width = ${res/config.bar-width}
bar-used-fill = ${res/config.bar-fill}
bar-used-fill-foreground = ${res/colors.yellow}
bar-used-empty = ${res/config.bar-empty}
bar-used-empty-foreground = ${res/colors.border}
bar-used-indicator = ${res/config.bar-indicator}

[module/i3]
type = internal/i3
format = <label-state> <label-mode>
format-padding = 0
enable-scroll = false
pin-workspaces = true

label-mode-padding = 4
label-mode-background = ${res/colors.red}
label-focused = %name%
label-focused-padding = 4
label-focused-foreground = ${res/colors.bg}
label-focused-background = ${res/colors.selection}
label-unfocused = %name%
label-unfocused-background = ${res/colors.bg}
label-unfocused-padding = 4
label-visible = %name%
label-visible-background = ${res/colors.border}
label-visible-padding = 4

[module/memory]
type = internal/memory
format = <bar-used> <label>
format-prefix = "Memory: "
format-prefix-foreground = ${res/colors.magenta}
label = %gb_free:8%
bar-used-width = ${res/config.bar-width}
bar-used-fill = ${res/config.bar-fill}
bar-used-fill-foreground = ${res/colors.magenta}
bar-used-empty = ${res/config.bar-empty}
bar-used-empty-foreground = ${res/colors.border}
bar-used-indicator = ${res/config.bar-indicator}

[module/mpd]
type=internal/mpd
format-online=<label-song> <label-time>
label-song=%artist% - %title%
label-time=%elapsed% / %total%

[module/pulse]
type = internal/pulseaudio
format-volume = <label-volume>
format-volume-prefix = " "
format-muted = <label-muted>
format-muted-prefix = " "
format-muted-foreground = ${res/colors.border}

[module/reboot-required]
type = custom/script
interval = 300
exec = "echo Reboot required"
exec-if = "[ -f /var/run/reboot-required ]"
format-foreground = ${res/colors.yellow}

[module/service-ansible]
type = custom/script
interval = 300
exec = "echo "
exec-if = "systemctl is-failed --quiet ansible-pull.service"
format-foreground = ${res/colors.red}

[module/service-backup]
type = custom/script
interval = 300
exec = "echo "
exec-if = "systemctl is-failed --quiet backup.service"
format-foreground = ${res/colors.red}

[module/wlan-laptop]
type = internal/network
interface = wlp0s20f3
format-connected-prefix = "WLAN: "
format-connected-prefix-foreground = ${res/colors.green}
format-disconnected-prefix = "WLAN: "
format-disconnected-prefix-foreground = ${res/colors.green}
label-connected = %essid%
label-disconnected = Disconnected

[module/wlan-desktop]
type = internal/network
interface = wlp5s0
format-connected-prefix = "WLAN: "
format-connected-prefix-foreground = ${res/colors.green}
format-disconnected-prefix = "WLAN: "
format-disconnected-prefix-foreground = ${res/colors.green}
label-connected = %essid%
label-disconnected = Disconnected

[module/wlan-desktop-stats]
type = internal/network
interface = wlp5s0
label-connected = U %upspeed% D %downspeed%

[module/xkeyboard]
type = internal/xkeyboard
format = <label-indicator>
label-indicator-on = %icon%
label-indicator-off = %icon%
label-indicator-on-capslock = 
label-indicator-on-capslock-padding = 4
label-indicator-on-capslock-background = ${res/colors.yellow}
label-indicator-on-capslock-foreground = ${res/colors.black}

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