2024-09-08 23:23:22 +02:00
{
config ,
lib ,
pkgs ,
. . .
} :
with lib ; {
services . polybar = {
package = pkgs . polybarFull ;
script = ''
# Terminate already running bar instances
killall - q polybar
# Wait until the processes have been shut down
while pgrep - u $ UID - x polybar > /dev/null ; do sleep 1 ; done
# Launch Polybar, using default config location ~/.config/polybar/config
polybar - r main & polybar - r secondary &
'' ;
settings = {
" c o l o r s " = {
# background = "\${xrdb:color0:#222}";
background = " # A A 0 0 0 0 0 0 " ;
background-alt = " # 0 0 0 0 0 0 0 0 " ;
# foreground = "\${xrdb:color7:#222}";
foreground = " # f f f f f f " ;
foreground-alt = " # f f f f f f " ;
primary = " # f f f f f f " ;
secondary = " # e 6 0 0 5 3 " ;
alert = " # b d 2 c 4 0 " ;
} ;
" b a r / m a i n " = {
2024-11-29 01:11:35 +01:00
monitor = config . local . gui . primaryMonitor . monitorId ;
2024-09-08 23:23:22 +02:00
width = " 1 0 0 % " ;
height = 30 ;
offset-x = " 0 % " ;
offset-y = " 0 % " ;
radius = 0 .0 ;
fixed-center = false ;
background = " \$ { c o l o r s . b a c k g r o u n d } " ;
foreground = " \$ { c o l o r s . f o r e g r o u n d } " ;
line-size = 1 ;
line-color = " # f 0 0 0 0 0 0 0 " ;
border-size = 0 ;
border-color = " # 0 0 0 0 0 0 0 0 " ;
padding-left = 0 ;
padding-right = 0 ;
module-margin-left = 1 ;
module-margin-right = 1 ;
# font-0 = "fixed:pixelsize=10;1";
font-0 = " J e t B r a i n s M o n o L i g h t : s i z e = 1 0 ; 0 " ;
font-1 = " u n i f o n t : f o n t f o r m a t = t r u e t y p e : s i z e = 8 : a n t i a l i a s = f a l s e ; 0 " ;
font-2 = " s i j i : p i x e l s i z e = 1 0 ; 1 " ;
# font-2 = "FontAwesome5Free:style=Regular:size=10;4";
modules-left = " i 3 " ;
modules-center = " x w i n d o w " ;
modules-right = " x k e y b o a r d p u l s e a u d i o f i l e s y s t e m m e m o r y c p u t e m p e r a t u r e g p u t e m p e r a t u r e n v m e t e m p e r a t u r e w l a n e t h d a t e s e m a n a t e c " ;
separator = " | " ;
tray-position = " r i g h t " ;
tray-padding = 2 ;
# To allow other windows to be placed above the bar, or to avoid having the bar visible when in fullscreen mode,
# you need to use the following two parameters. Note that it will tell the window manager to back off so no
# area will be reserved, etc.
#
# wm-restack = "i3";
# override-redirect = true;
cursor-click = " p o i n t e r " ;
cursor-scroll = " n s - r e s i z e " ;
} ;
" b a r / s e c o n d a r y " = {
2024-11-29 01:11:35 +01:00
monitor = head ( attrNames ( filterAttrs ( monitorId : v :
! v . primary ) config . local . gui . monitors ) ) ; # this is bad. will fail if more than 2 monitors. this sets all monitors other than the primary one for this bar.
2024-09-08 23:23:22 +02:00
" i n h e r i t " = " b a r / m a i n " ;
modules-left = " i 3 " ;
modules-center = " x w i n d o w " ;
modules-right = " x k e y b o a r d p u l s e a u d i o d a t e " ;
tray-position = " n o n e " ;
} ;
" m o d u l e / x w i n d o w " = {
type = " i n t e r n a l / x w i n d o w " ;
label = " % t i t l e : 0 : 3 0 : . . . % " ;
} ;
" m o d u l e / x k e y b o a r d " = {
type = " i n t e r n a l / x k e y b o a r d " ;
blacklist-0 = " n u m l o c k " ;
format-prefix = " " ;
format-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label-layout = " % l a y o u t % " ;
label-indicator-padding = 2 ;
label-indicator-margin = 1 ;
label-indicator-background = " \$ { c o l o r s . s e c o n d a r y } " ;
} ;
" m o d u l e / f i l e s y s t e m " = {
type = " i n t e r n a l / f s " ;
interval = 10 ;
mount-0 = " / " ;
label-mounted = " % { F # 0 a 8 1 f 5 } % m o u n t p o i n t % % { F - } : % u s e d % / % t o t a l % " ;
label-unmounted = " " ;
} ;
" m o d u l e / i 3 " = {
type = " i n t e r n a l / i 3 " ;
format = " < l a b e l - s t a t e > < l a b e l - m o d e > " ;
index-sort = true ;
wrapping-scroll = false ;
# Only show workspaces on the same output as the bar
# pin-workspaces = true
label-mode-padding = 1 ;
label-mode-foreground = " # 0 0 0 " ;
label-mode-background = " \$ { c o l o r s . p r i m a r y } " ;
# focused = Active workspace on focused monitor
label-focused = " % i n d e x % " ;
label-focused-background = " \$ { c o l o r s . b a c k g r o u n d } " ;
label-focused-underline = " \$ { c o l o r s . p r i m a r y } " ;
label-focused-padding = 1 ;
# unfocused = Inactive workspace on any monitor
label-unfocused = " % i n d e x % " ;
label-unfocused-padding = 1 ;
# visible = Active workspace on unfocused monitor
label-visible = " % i n d e x % " ;
label-visible-background = " \$ { s e l f . l a b e l - f o c u s e d - b a c k g r o u n d } " ;
label-visible-underline = " \$ { s e l f . l a b e l - f o c u s e d - u n d e r l i n e } " ;
label-visible-padding = " \$ { s e l f . l a b e l - f o c u s e d - p a d d i n g } " ;
# urgent = Workspace with urgency hint set
label-urgent = " % i n d e x % " ;
label-urgent-background = " \$ { c o l o r s . a l e r t } " ;
label-urgent-padding = 1 ;
} ;
" m o d u l e / x b a c k l i g h t " = {
type = " i n t e r n a l / x b a c k l i g h t " ;
format = " < l a b e l > < b a r > " ;
label = " B L " ;
bar-width = 10 ;
bar-indicator = " | " ;
bar-indicator-foreground = " # f f f " ;
bar-indicator-font = 2 ;
bar-fill = " ─ " ;
bar-fill-font = 2 ;
bar-fill-foreground = " # 9 f 7 8 e 1 " ;
bar-empty = " ─ " ;
bar-empty-font = 2 ;
bar-empty-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / b a c k l i g h t - a c p i " = {
" i n h e r i t " = " m o d u l e / x b a c k l i g h t " ;
type = " i n t e r n a l / b a c k l i g h t " ;
card = " i n t e l _ b a c k l i g h t " ;
} ;
" m o d u l e / c p u " = {
type = " i n t e r n a l / c p u " ;
interval = 2 ;
format-prefix = " c p u " ;
format-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label = " % p e r c e n t a g e : 2 % % " ;
} ;
" m o d u l e / m e m o r y " = {
type = " i n t e r n a l / m e m o r y " ;
interval = 2 ;
format-prefix = " m e m " ;
format-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label = " % p e r c e n t a g e _ u s e d % % " ;
} ;
" m o d u l e / w l a n " = {
type = " i n t e r n a l / n e t w o r k " ;
interface = " w l p 7 s 0 " ;
interval = 3 .0 ;
format-connected = " < r a m p - s i g n a l > < l a b e l - c o n n e c t e d > " ;
label-connected = " % e s s i d % " ;
format-disconnected = " " ;
# format-disconnected = "<label-disconnected>";
# format-disconnected-underline = "\${self.format-connected-underline}";
# label-disconnected = "%ifname% disconnected";
# label-disconnected-foreground = "\${colors.foreground-alt}";
ramp-signal-0 = " " ;
ramp-signal-1 = " " ;
ramp-signal-2 = " " ;
ramp-signal-3 = " " ;
ramp-signal-4 = " " ;
ramp-signal-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / e t h " = {
type = " i n t e r n a l / n e t w o r k " ;
interface = " e n p 8 s 0 " ;
interval = 3 .0 ;
format-connected-prefix = " " ;
format-connected-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label-connected = " % l o c a l _ i p % " ;
format-disconnected = " " ;
# format-disconnected = "<label-disconnected>";
# format-disconnected-underline = "\${self.format-connected-underline}";
# label-disconnected = "%ifname% disconnected";
# label-disconnected-foreground = "\${colors.foreground-alt}";
} ;
" m o d u l e / d a t e " = {
type = " i n t e r n a l / d a t e " ;
interval = 1 ;
date = " % d / % m / % Y " ;
date-alt = " % c " ;
time = " % H : % M " ;
time-alt = " [ % s ] " ;
format-prefix = " " ;
format-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label = " % d a t e % % t i m e % " ;
} ;
# "module/semanatec" = {
# type = "custom/script"
# exec = "/home/fabian/bin/semanatec/target/release/semanatec"
# interval = 3600
# format-prefix = ""
# };
" m o d u l e / p u l s e a u d i o " = {
type = " i n t e r n a l / p u l s e a u d i o " ;
format-volume = " < l a b e l - v o l u m e > " ;
label-volume = " v o l % p e r c e n t a g e % % " ;
label-volume-foreground = " \$ { r o o t . f o r e g r o u n d } " ;
label-muted = " v o l 0 % " ;
label-muted-foreground = " \$ { r o o t . f o r e g r o u n d } " ;
bar-volume-width = 10 ;
bar-volume-foreground-0 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-1 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-2 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-3 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-4 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-5 = " # f 5 a 7 0 a " ;
bar-volume-foreground-6 = " # f f 5 5 5 5 " ;
bar-volume-gradient = false ;
bar-volume-indicator = " | " ;
bar-volume-indicator-font = 2 ;
bar-volume-fill = " ─ " ;
bar-volume-fill-font = 2 ;
bar-volume-empty = " ─ " ;
bar-volume-empty-font = 2 ;
bar-volume-empty-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / a l s a " = {
type = " i n t e r n a l / a l s a " ;
format-volume = " < l a b e l - v o l u m e > < b a r - v o l u m e > " ;
label-volume = " V O L " ;
label-volume-foreground = " \$ { r o o t . f o r e g r o u n d } " ;
format-muted-prefix = " v o l " ;
format-muted-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
label-muted = " s o u n d m u t e d " ;
bar-volume-width = 10 ;
bar-volume-foreground-0 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-1 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-2 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-3 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-4 = " # 5 5 a a 5 5 " ;
bar-volume-foreground-5 = " # f 5 a 7 0 a " ;
bar-volume-foreground-6 = " # f f 5 5 5 5 " ;
bar-volume-gradient = false ;
bar-volume-indicator = " | " ;
bar-volume-indicator-font = 2 ;
bar-volume-fill = " ─ " ;
bar-volume-fill-font = 2 ;
bar-volume-empty = " ─ " ;
bar-volume-empty-font = 2 ;
bar-volume-empty-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / b a t t e r y " = {
type = " i n t e r n a l / b a t t e r y " ;
battery = " B A T 0 " ;
adapter = " A D P 1 " ;
full-at = 98 ;
format-charging = " < a n i m a t i o n - c h a r g i n g > < l a b e l - c h a r g i n g > " ;
format-charging-underline = " # f f b 5 2 a " ;
format-discharging = " < a n i m a t i o n - d i s c h a r g i n g > < l a b e l - d i s c h a r g i n g > " ;
format-discharging-underline = " \$ { s e l f . f o r m a t - c h a r g i n g - u n d e r l i n e } " ;
format-full-prefix = " " ;
format-full-prefix-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
format-full-underline = " \$ { s e l f . f o r m a t - c h a r g i n g - u n d e r l i n e } " ;
ramp-capacity-0 = " " ;
ramp-capacity-1 = " " ;
ramp-capacity-2 = " " ;
ramp-capacity-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
animation-charging-0 = " " ;
animation-charging-1 = " " ;
animation-charging-2 = " " ;
animation-charging-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
animation-charging-framerate = 750 ;
animation-discharging-0 = " " ;
animation-discharging-1 = " " ;
animation-discharging-2 = " " ;
animation-discharging-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
animation-discharging-framerate = 750 ;
} ;
" m o d u l e / t e m p e r a t u r e " = {
type = " i n t e r n a l / t e m p e r a t u r e " ;
warn-temperature = 60 ;
hwmon-path = " / s y s / d e v i c e s / p c i 0 0 0 0 : 0 0 / 0 0 0 0 : 0 0 : 1 8 . 3 / h w m o n / h w m o n 1 / t e m p 2 _ i n p u t " ;
format = " < r a m p > < l a b e l > " ;
format-warn = " < r a m p > < l a b e l - w a r n > " ;
label = " c p u % t e m p e r a t u r e - c % " ;
label-warn = " c p u % t e m p e r a t u r e - c % " ;
label-warn-foreground = " \$ { c o l o r s . s e c o n d a r y } " ;
ramp-0 = " " ;
ramp-1 = " " ;
ramp-2 = " " ;
ramp-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / g p u t e m p e r a t u r e " = {
type = " i n t e r n a l / t e m p e r a t u r e " ;
warn-temperature = 60 ;
hwmon-path = " / s y s / d e v i c e s / p c i 0 0 0 0 : 0 0 / 0 0 0 0 : 0 0 : 0 3 . 1 / 0 0 0 0 : 0 9 : 0 0 . 0 / h w m o n / h w m o n 3 / t e m p 1 _ i n p u t " ;
format = " < r a m p > < l a b e l > " ;
format-warn = " < r a m p > < l a b e l - w a r n > " ;
label = " g p u % t e m p e r a t u r e - c % " ;
label-warn = " g p u % t e m p e r a t u r e - c % " ;
label-warn-foreground = " \$ { c o l o r s . s e c o n d a r y } " ;
ramp-0 = " " ;
ramp-1 = " " ;
ramp-2 = " " ;
ramp-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / n v m e t e m p e r a t u r e " = {
type = " i n t e r n a l / t e m p e r a t u r e " ;
warn-temperature = 60 ;
hwmon-path = " / s y s / d e v i c e s / p c i 0 0 0 0 : 0 0 / 0 0 0 0 : 0 0 : 0 1 . 1 / 0 0 0 0 : 0 1 : 0 0 . 0 / h w m o n / h w m o n 0 / t e m p 1 _ i n p u t " ;
format = " < r a m p > < l a b e l > " ;
format-warn = " < r a m p > < l a b e l - w a r n > " ;
label = " M . 2 % t e m p e r a t u r e - c % " ;
label-warn = " M . 2 % t e m p e r a t u r e - c % " ;
label-warn-foreground = " \$ { c o l o r s . s e c o n d a r y } " ;
ramp-0 = " " ;
ramp-1 = " " ;
ramp-2 = " " ;
ramp-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
} ;
" m o d u l e / p o w e r m e n u " = {
type = " c u s t o m / m e n u " ;
expand-right = true ;
format-spacing = 1 ;
label-open = " " ;
label-open-foreground = " \$ { c o l o r s . s e c o n d a r y } " ;
label-close = " c a n c e l " ;
label-close-foreground = " \$ { c o l o r s . s e c o n d a r y } " ;
label-separator = " | " ;
label-separator-foreground = " \$ { c o l o r s . f o r e g r o u n d - a l t } " ;
menu-0-0 = " r e b o o t " ;
menu-0-0-exec = " m e n u - o p e n - 1 " ;
menu-0-1 = " p o w e r o f f " ;
menu-0-1-exec = " m e n u - o p e n - 2 " ;
menu-1-0 = " c a n c e l " ;
menu-1-0-exec = " m e n u - o p e n - 0 " ;
menu-1-1 = " r e b o o t " ;
menu-1-1-exec = " s u d o r e b o o t " ;
menu-2-0 = " p o w e r o f f " ;
menu-2-0-exec = " s u d o p o w e r o f f " ;
menu-2-1 = " c a n c e l " ;
menu-2-1-exec = " m e n u - o p e n - 0 " ;
} ;
" m o d u l e / s i n k _ c h a n g e r " = {
type = " c u s t o m / s c r i p t " ;
exec = " / h o m e / f a b i a n / b i n / p o l y b a r _ s c r i p t s / i n f o . s h " ;
label = " % o u t p u t % " ;
click-left = " / h o m e / f a b i a n / b i n / p o l y b a r _ s c r i p t s / s i n k _ c h a n g e r . s h " ;
# format-prefix = " ";
interval = " 0 " ;
# format-prefix-foreground = "${colors.foreground-alt}";
} ;
" s e t t i n g s " = {
screenchange-reload = true ;
# compositing-background = "xor";
# compositing-background = "screen";
# compositing-foreground = "source";
# compositing-border = "over";
# pseudo-transparency = false;
} ;
" g l o b a l / w m " = {
margin-top = 5 ;
margin-bottom = 5 ;
} ;
} ;
} ;
}