;; Colors

[colors]
; https://notes.rcrnstn.net/colors.md
background  = #c0000000
foreground  = #ffc6c6c6
transparent = #00000000
disabled    = #ff5e5e5e
warn        = #ffffb3b3
focused     = ${self.foreground}
visible     = ${self.foreground}
unfocused   = ${self.transparent}
urgent      = ${self.warn}

;; Fonts
; https://en.wikipedia.org/wiki/Open-source_Unicode_typefaces

[fonts]
; fonts-dejavu-core (usually installed)
font-0 = DejaVu Sans Mono:size=10;3
; fonts-noto-mono (usually installed)
font-1 = Noto Sans Mono:size=10;2
; fonts-freefont-ttf (usually installed)
font-2 = FreeMono:style=Bold:size=10;2
font-3 = FreeSans:style=Bold:size=10;2
; System default monospace
font-4 = Monospace:size=10;2
; fonts-symbola
font-5 = Symbola:size=10;2
; fonts-unifont
font-6 = Unifont:size=10;2
font-7 = Unifont Upper:size=10;2
; fonts-font-awesome
; https://fontawesome.com/v4.7/icons
font-8 = FontAwesome:size=10;2
; fonts-material-design-icons-iconfont
; https://jossef.github.io/material-design-icons-iconfont
; https://fonts.google.com/icons
; font-9 = Material Icons:size=10;2
; fonts-octicons
; https://primer.style/octicons/
; font-10 = octicons:size=10;2

;; Icons
; https://www.fileformat.info/info/unicode/char/search.htm
; https://www.fileformat.info/info/unicode/category/So

;;; Unicode

[icons-unicode]
;;;; Miscellaneous Technical (U+2300 - U+23FF)
; https://www.fileformat.info/info/unicode/block/miscellaneous_technical
keyboard = ⌨
; time     = ⌚
; time     = ⏲
; https://en.wikipedia.org/wiki/Media_control_symbols#Symbols
media-play       = ⏵
media-pause      = ⏸
media-play-pause = ⏯
media-stop       = ⏹
media-seekf      = ⏩
media-seekb      = ⏪
media-next       = ⏭
media-prev       = ⏮
media-record     = ⏺
media-eject      = ⏏
; https://en.wikipedia.org/wiki/Power_symbol#Unicode
power-menu-open = ⏻
power-off       = ⏻
power-sleep     = ⏾
;;;; Box Drawing (U+2500 - U+257F)
; https://www.fileformat.info/info/unicode/block/box_drawing
progress-fill      = ─
progress-empty     = ─
progress-indicator = ╂
# progress-indicator = ┼
;;;; Block Elements (U+2580 - U+259F)
; https://www.fileformat.info/info/unicode/block/block_elements
load-0 = ▁
load-1 = ▂
load-2 = ▃
load-3 = ▄
load-4 = ▅
load-5 = ▆
load-6 = ▇
load-7 = █
;;;; Miscellaneous Symbols (U+2600 - U+26FF)
; https://www.fileformat.info/info/unicode/block/miscellaneous_symbols
; backlight = ☀
; backlight = ☼
; temperature-4 = ⚠
; media-music = ♫
; media-music = ♬
; weather = ☁
; weather = ⛅
;;;; Dingbats (U+2700 - U+27BF)
; https://www.fileformat.info/info/unicode/block/dingbats
; mail = ✉
;;;; Miscellaneous Symbols and Arrows (U+2B00 - U+2BFF)
; https://www.fileformat.info/info/unicode/block/miscellaneous_symbols_and_arrows
; power-menu-open = ⚙
; power-menu-open = ⛭
power-menu-close = ⭙
power-reboot     = ⭮
;;;; Miscellaneous Symbols and Pictographs (U+1F300 - U+1F5FF)
; https://www.fileformat.info/info/unicode/block/miscellaneous_symbols_and_pictographs
; backlight   = 🔅
; backlight   = 🔆
; backlight-0 = 🌕
; backlight-1 = 🌔
; backlight-2 = 🌓
; backlight-3 = 🌒
; backlight-4 = 🌑
; backlight-0 = 🌑
; backlight-1 = 🌘
; backlight-2 = 🌗
; backlight-3 = 🌖
; backlight-4 = 🌕
volume-muted = 🔇
volume-0     = 🔈
volume-1     = 🔉
volume-2     = 🔉
volume-3     = 🔊
; volume-0     = 🕨
; volume-1     = 🕩
; volume-2     = 🕩
; volume-3     = 🕪
battery-charging   = 🔌
; battery-charging   = ⚡
; battery-charging   = 🗲
battery-capacity-0 = 🔋
battery-capacity-1 = 🔋
battery-capacity-2 = 🔋
battery-capacity-3 = 🔋
battery-capacity-4 = 🔋
media-music= 🎜
; media-music = 🎵
; https://en.wikipedia.org/wiki/Media_control_symbols#Symbols
media-random = 🔀
media-repeat = 🔁
media-single = 🔂
window = 🗖
temperature-0 = 🌡
temperature-1 = 🌡
temperature-2 = 🌡
temperature-3 = 🌡
temperature-4 = 🌡
power-lock = 🔒
date = 🗓
; date = 📅
; date = 📆
time = 🕐
network-wired    = 🖧
network-wireless = 📶
cpu = 💻
; cpu = 🖳
; cpu = 🖥
; cpu = 📺
; cpu = 📟
; cpu = 🧮
; cpu = 🗠
; cpu = 📈
; cpu = 📉
; cpu = 🧠
memory = 🎟
; memory = 🎫
; filesystem = 🖫
; filesystem = 🖴
; filesystem = 🗀
; filesystem = 🗁
; filesystem = 📁
; filesystem = 📂
; mail = 📧
; mail = 📨
; mail = 📩
; mail = 🖂
; weather = 🌦
;;;; Emoticons (U+1F600 - U+1F64F)
; https://www.fileformat.info/info/unicode/block/emoticons
power-logout = 🚪
;;;; Transport and Map Symbols (U+1F680 - U+1F6FF)
; https://www.fileformat.info/info/unicode/block/transport_and_map_symbols
filesystem = 🛢
;;;; Geometric Shapes Extended (U+1F780 - U+1F7FF)
; https://www.fileformat.info/info/unicode/block/geometric_shapes_extended
backlight-0 = 🞻
backlight-1 = 🞼
backlight-2 = 🞽
backlight-3 = 🞾
backlight-4 = 🞿
signal-0 = 🟁
signal-1 = 🟄
signal-2 = 🟉
signal-3 = 🟎
signal-4 = 🟒
; signal-0 = 🞅
; signal-1 = 🞆
; signal-2 = 🞇
; signal-3 = 🞈
; signal-4 = 🞉

;;; Font Awesome

[icons-font-awesome]
power-menu-open   = 
; power-menu-open = 
; power-menu-open = 
; power-menu-open = 
power-menu-close  = 
power-off         = 
power-reboot      = 
power-sleep       = 
power-logout      = 
power-lock        = 
volume-muted = 
volume-0     = 
volume-1     = 
volume-2     = 
volume-3     = 
; backlight-0 = 
; backlight-1 = 
; backlight-2 = 
; backlight-3 = 
; backlight-4 = 
keyboard = 
filesystem = 
; filesystem = 
; filesystem = 
; filesystem = 
memory = 
; memory = 
cpu = 
; cpu = 
; cpu = 
; cpu = 
temperature-0 = 
temperature-1 = 
temperature-2 = 
temperature-3 = 
temperature-4 = 
; temperature-4 = 
battery-charging   = 
; battery-charging   = 
battery-capacity-0 = 
battery-capacity-1 = 
battery-capacity-2 = 
battery-capacity-3 = 
battery-capacity-4 = 
network-wireless = 
; network-wireless = 
network-wired    = 
; network-wired    = 
; network-wired    = 
network-up   = 
network-down = 
; media-music      = 
; media-play       = 
; media-pause      = 
; media-play-pause = 
; media-stop       = 
; media-seekf      = 
; media-seekb      = 
; ; media-seekf      = 
; ; media-seekb      = 
; media-next       = 
; media-prev       = 
; media-record     = 
; media-eject      = 
; media-random     = 
; media-repeat     = 
; media-single     = 

;;; Icons

[icons]
inherit = icons-font-awesome icons-unicode

;; Settings

[settings]
; pseudo-transparency = true
screenchange-reload = true
format-underline    = ${colors.foreground}

;; Bars

[bar-base]
inherit       = fonts
height        = 24
border-size   = 5
line-size     = 2
dpi-x         = 0
dpi-y         = 0
separator     = " "
foreground    = ${colors.foreground}
background    = ${colors.background}
enable-ipc    = true
; cursor-click  = pointer
; cursor-scroll = ns-resize

[bar/top-noshadow]
inherit         = bar-base
bottom          = false
modules-left    = i3
modules-center  = xwindow
tray-position   = right
; https://github.com/polybar/polybar/pull/2552
; tray-foreground = ${colors.foreground}
tray-background = ${colors.foreground}
border-bottom-size = 2

[bar/bottom-noshadow]
inherit        = bar-base
bottom         = true
padding        = 1
modules-left   = mpd
modules-center = date
modules-right  = eth0 wlan0 eno1 wlo1 battery temperature cpu memory filesystem keyboard backlight volume powermenu
border-top-size = 2

;; Modules

;;; i3
; https://github.com/polybar/polybar/wiki/Module:-i3

[module/i3]
type                      = internal/i3
format-padding            =
label-state-padding       = 1
label-state               = %name%
label-focused-padding     = ${self.label-state-padding}
label-visible-padding     = ${self.label-state-padding}
label-unfocused-padding   = ${self.label-state-padding}
label-urgent-padding      = ${self.label-state-padding}
label-focused             = ${self.label-state}
label-visible             = ${self.label-state}
label-unfocused           = ${self.label-state}
label-urgent              = ${self.label-state}
label-focused-underline   = ${colors.focused}
label-visible-underline   = ${colors.visible}
label-unfocused-underline = ${colors.unfocused}
label-urgent-underline    = ${colors.transparent}
label-urgent-foreground   = ${colors.urgent}

;;; X Window
; https://github.com/polybar/polybar/wiki/Module:-xwindow

[module/xwindow]
type             = internal/xwindow
format-underline =
; format-prefix    = ${icons.window}
label            = %title:0:80:...%
; format-prefix-margin-right = 1

;;; MPD
; https://github.com/polybar/polybar/wiki/Module:-mpd
; {auto}ssh {-f} -N -L localhost:6600:localhost:6600 ${MPD_HOST:-mpd.$(dnsdomainname)}:${MPD_PORT:-6600}

[module/mpd]
type                          = internal/mpd
format-online-underline       =
format-offline-underline      =
format-online-prefix          = ${icons.media-music}
format-offline-prefix         = ${icons.media-music}
format-online                 = %{A3:$TERMINAL -e "$SHELL -i -c ncmpcpp" &:}<icon-random> <icon-repeat> <icon-single> <icon-prev> <icon-seekb> <toggle> <icon-seekf> <icon-next> <bar-progress> <label-song>%{A}
format-offline                = <label-offline>
format-offline-foreground     = ${colors.disabled}
label-song                    = %artist% - %title:0:50:...%
label-offline                 = " "
toggle-off-foreground         = ${colors.disabled}
icon-random                   = ${icons.media-random}
icon-repeat                   = ${icons.media-repeat}
icon-single                   = ${icons.media-single}
icon-prev                     = ${icons.media-prev}
icon-seekb                    = ${icons.media-seekb}
icon-stop                     = ${icons.media-stop}
icon-play                     = ${icons.media-play}
icon-pause                    = ${icons.media-pause}
icon-seekf                    = ${icons.media-seekf}
icon-next                     = ${icons.media-next}
bar-progress-width            = 7
bar-progress-fill             = ${icons.progress-fill}
bar-progress-empty            = ${icons.progress-empty}
bar-progress-indicator        =
bar-progress-fill-foreground  = ${colors.foreground}
bar-progress-empty-foreground = ${colors.disabled}
format-online-prefix-margin-right = 1
format-offline-prefix-margin-right = 1

;;; Date
; https://github.com/polybar/polybar/wiki/Module:-date

[module/date]
type             = internal/date
date             = %a %d %b
date-alt         = %Y-%m-%d
time             = %H:%M
time-alt         = %H:%M:%S
format-underline =
; format-prefix    = ${icons.date}
format           = %{A3:$TERMINAL -e "$SHELL -i -c ikhal" &:}<label>%{A}
label            = %date% %time%
; format-prefix-margin-right = 1

;;; Network
; https://github.com/polybar/polybar/wiki/Module:-network
; https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html

[network-base]
type             = internal/network
unknown-as-up    = true
speed-unit       = ''
format-connected = %{A3:$TERMINAL -e "$SHELL -i -c nmtui" &:}<label-connected>%{A}
label-connected  = %downspeed% %upspeed%
format-connected-prefix-margin-right = 1

[network-wired]
format-connected-prefix = ${icons.network-wired}
; label-connected         = %linkspeed% %downspeed% %upspeed%

[network-wireless]
format-connected-prefix = ${icons.network-wireless}
; format-connected        = <ramp-signal> <label-connected>
label-connected         = %signal%% %downspeed% %upspeed%
; label-connected         = %essid% %signal%% %downspeed% %upspeed%
; ramp-signal-0 = ${icons.signal-0}
; ramp-signal-1 = ${icons.signal-1}
; ramp-signal-2 = ${icons.signal-2}
; ramp-signal-3 = ${icons.signal-3}
; ramp-signal-4 = ${icons.signal-4}

[module/eth0]
inherit   = network-wired network-base
interface = eth0

[module/wlan0]
inherit   = network-wireless network-base
interface = wlan0

[module/eno1]
inherit   = network-wired network-base
interface = eno1

[module/wlo1]
inherit   = network-wireless network-base
interface = wlo1

;;; Battery
; https://github.com/polybar/polybar/wiki/Module:-battery
; ls /sys/class/power_supply/

[module/battery]
type                       = internal/battery
; adapter                    = ${env:BATTERY_ADAPTER}
; battery                    = ${env:BATTERY_BATTERY}
time-format                = %Hh%Mm
format-charging-prefix     = ${icons.battery-charging}
format-full                = <ramp-capacity> <label-full>
format-charging            = <ramp-capacity> <label-charging>
format-discharging         = <ramp-capacity> <label-discharging>
label-full                 = %percentage_raw%%
label-charging             = %percentage_raw%% %consumption%W %time%
label-discharging          = %percentage_raw%% %consumption%W %time%
ramp-capacity-0            = ${icons.battery-capacity-0}
ramp-capacity-1            = ${icons.battery-capacity-1}
ramp-capacity-2            = ${icons.battery-capacity-2}
ramp-capacity-3            = ${icons.battery-capacity-3}
ramp-capacity-4            = ${icons.battery-capacity-4}
ramp-capacity-0-foreground = ${colors.warn}
format-charging-prefix-padding-right = 1

;;; Temperature
; https://github.com/polybar/polybar/wiki/Module:-temperature

; for i in "/sys/class/thermal/thermal_zone"*
; do
;   echo "$i: $(cat "$i/type")"
; done

; for i in "/sys/class/hwmon/hwmon"*"/temp"*"_input"
; do
;    printf '%s: %s %s\n' \
;      "$(cat "$(dirname "$i")/name")" \
;      "$(cat "${i%_*}_label" 2> '/dev/null' || basename "${i%_*}")" \
;      "$(readlink -f "$i")"
; done

[module/temperature]
type                   = internal/temperature
thermal-zone           = ${env:TEMPERATURE_THERMAL_ZONE}
base-temperature       = 20
warn-temperature       = 60
format                 = <ramp> <label>
format-warn            = <ramp> <label-warn>
label-warn-foreground  = ${colors.warn}
ramp-0                 = ${icons.temperature-0}
ramp-1                 = ${icons.temperature-1}
ramp-2                 = ${icons.temperature-2}
ramp-3                 = ${icons.temperature-3}
ramp-4                 = ${icons.temperature-4}

;;; CPU
; https://github.com/polybar/polybar/wiki/Module:-cpu

[module/cpu]
type                  = internal/cpu
format-prefix         = ${icons.cpu}
format                = %{A3:$TERMINAL -e "$SHELL -i -c htop" &:}<label> <ramp-coreload>%{A}
label                 = %percentage:2%%
ramp-coreload-spacing = 0
ramp-coreload-0       = ${icons.load-0}
ramp-coreload-1       = ${icons.load-1}
ramp-coreload-2       = ${icons.load-2}
ramp-coreload-3       = ${icons.load-3}
ramp-coreload-4       = ${icons.load-4}
ramp-coreload-5       = ${icons.load-5}
ramp-coreload-6       = ${icons.load-6}
ramp-coreload-7       = ${icons.load-7}
format-prefix-margin-right = 1

;;; Memory
; https://github.com/polybar/polybar/wiki/Module:-memory

[module/memory]
type             = internal/memory
format-prefix    = ${icons.memory}
format           = %{A3:$TERMINAL -e "$SHELL -i -c htop" &:}<label> <ramp-used><ramp-swap-used>%{A}
label            = %percentage_used:2%%
ramp-used-0      = ${icons.load-0}
ramp-used-1      = ${icons.load-1}
ramp-used-2      = ${icons.load-2}
ramp-used-3      = ${icons.load-3}
ramp-used-4      = ${icons.load-4}
ramp-used-5      = ${icons.load-5}
ramp-used-6      = ${icons.load-6}
ramp-used-7      = ${icons.load-7}
ramp-swap-used-0 = ${icons.load-0}
ramp-swap-used-1 = ${icons.load-1}
ramp-swap-used-2 = ${icons.load-2}
ramp-swap-used-3 = ${icons.load-3}
ramp-swap-used-4 = ${icons.load-4}
ramp-swap-used-5 = ${icons.load-5}
ramp-swap-used-6 = ${icons.load-6}
ramp-swap-used-7 = ${icons.load-7}
format-prefix-margin-right = 1

;;; Filesystem
; https://github.com/polybar/polybar/wiki/Module:-filesystem

[module/filesystem]
type                  = internal/fs
mount-0               = /
format-mounted-prefix = ${icons.filesystem}
format-mounted        = %{A3:$TERMINAL -e "$SHELL -i -c ncdu" &:}<label-mounted>%{A}
format-unmounted      =
label-mounted         = %fsname% %percentage_used%%
format-mounted-prefix-margin-right = 1

;;; Keyboard
; https://github.com/polybar/polybar/wiki/Module:-xkeyboard

[module/keyboard]
type          = internal/xkeyboard
format-prefix = ${icons.keyboard}
format        = <label-layout>
format-prefix-margin-right = 1

;;; Backlight
; https://github.com/polybar/polybar/wiki/Module:-backlight
; ls /sys/class/backlight/
; https://wiki.archlinux.org/title/Backlight

[module/backlight]
type          = internal/backlight
card          = ${env:BACKLIGHT_CARD}
enable-scroll = true
format        = <ramp> <label>
label         = %percentage%%
ramp-0        = ${icons.backlight-0}
ramp-1        = ${icons.backlight-1}
ramp-2        = ${icons.backlight-2}
ramp-3        = ${icons.backlight-3}
ramp-4        = ${icons.backlight-4}

;;; Volume
; https://github.com/polybar/polybar/wiki/Module:-pulseaudio

[module/volume]
type                    = internal/pulseaudio
use-ui-max              = false
format-muted-prefix     = ${icons.volume-muted}
format-muted            = %{A3:$TERMINAL -e "$SHELL -i -c pulsemixer" &:}<label-muted>%{A}
format-volume           = %{A3:$TERMINAL -e "$SHELL -i -c pulsemixer" &:}<ramp-volume> <label-volume>%{A}
format-muted-foreground = ${colors.disabled}
label-muted             = %percentage%%
label-volume            = %percentage%%
ramp-volume-0           = ${icons.volume-0}
ramp-volume-1           = ${icons.volume-1}
ramp-volume-2           = ${icons.volume-2}
ramp-volume-3           = ${icons.volume-3}
format-muted-prefix-margin-right = 1

;;; Powermenu
; https://github.com/polybar/polybar/wiki/Module:-menu
; man systemd-sleep.conf
; https://wiki.archlinux.org/title/Power_management

[module/powermenu]
type            = custom/menu
expand-right    = false
label-open      = ${icons.power-menu-open}
label-close     = ${icons.power-menu-close}
label-separator = " "
menu-0-0        = ${icons.power-off}
menu-0-0-exec   = systemctl poweroff
menu-0-1        = ${icons.power-reboot}
menu-0-1-exec   = systemctl reboot
menu-0-2        = ${icons.power-sleep}
menu-0-2-exec   = systemctl hibernate
menu-0-3        = ${icons.power-logout}
menu-0-3-exec   = loginctl terminate-session $XDG_SESSION_ID
menu-0-4        = ${icons.power-lock}
menu-0-4-exec   = loginctl lock-session $XDG_SESSION_ID