Add battery module to polybar

inky
Elnu 2 years ago
parent 56eef7a15c
commit f985d16d36

@ -1,5 +1,14 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let
background = "#2e3440";
background-alt = "#3b4252";
foreground = "#eceff4";
primary = "#8fbcbb";
secondary = "#ff00ff"; # not sure what this does
alert = "#ff00ff"; # not sure what this does
disabled = "#434c5e";
in
{ {
# Dependencies # Dependencies
home.packages = with pkgs; [ home.packages = with pkgs; [
@ -15,19 +24,12 @@
}; };
config = { config = {
"colors" = { "colors" = {
background = "#2e3440";
background-alt = "#3b4252";
foreground = "#eceff4";
primary = "#8fbcbb";
secondary = "#ff00ff"; # not sure what this does
alert = "#ff00ff"; # not sure what this does
disabled = "#434c5e";
}; };
"bar/top" = { "bar/top" = {
font-0 = "Noto Sans Mono;2"; font-0 = "Noto Sans Mono;2";
font-1 = "Noto Sans CJK JP;2"; font-1 = "Noto Sans CJK JP;2";
background = "\${colors.background}"; background = "${background}";
foreground = "\${colors.foreground}"; foreground = "${foreground}";
width = "100%"; width = "100%";
height = "24pt"; height = "24pt";
@ -35,7 +37,7 @@
padding-right = 1; padding-right = 1;
module-margin = 1; module-margin = 1;
separator = "|"; separator = "|";
separator-foreground = "\${colors.disabled}"; separator-foreground = "${disabled}";
cursor-click = "pointer"; cursor-click = "pointer";
cursor-scroll = "ns-resize"; cursor-scroll = "ns-resize";
modules-left = [ modules-left = [
@ -49,22 +51,23 @@
"pulseaudio" "pulseaudio"
"memory" "memory"
"cpu" "cpu"
"battery"
"date" "date"
]; ];
}; };
"module/xworkspaces" = { "module/xworkspaces" = {
type = "internal/xworkspaces"; type = "internal/xworkspaces";
label-active-background = "\${colors.background-alt}"; label-active-background = "${background-alt}";
label-active-underline = "\${colors.primary}"; label-active-underline = "${primary}";
label-active-padding-right = 1; label-active-padding-right = 1;
label-occupied-padding-right = 1; label-occupied-padding-right = 1;
label-urgent-background = "\${colors.alert}"; label-urgent-background = "${alert}";
label-urgent-padding-right = 1; label-urgent-padding-right = 1;
label-empty-foreground = "\${colors.disabled}"; label-empty-foreground = "${disabled}";
label-empty-padding-right = 1; label-empty-padding-right = 1;
}; };
"module/xwindow" = { "module/xwindow" = {
@ -93,16 +96,16 @@
label-mounted = "%{F#88c0d0}%mountpoint%%{F-} %percentage_used%%"; label-mounted = "%{F#88c0d0}%mountpoint%%{F-} %percentage_used%%";
label-unmounted = "%mountpoint% not mounted"; label-unmounted = "%mountpoint% not mounted";
label-unmounted-foreground = "\${colors.disabled}"; label-unmounted-foreground = "${disabled}";
}; };
"module/pulseaudio" = { "module/pulseaudio" = {
type = "internal/pulseaudio"; type = "internal/pulseaudio";
format-volume-prefix = "VOL "; format-volume-prefix = "VOL ";
format-volume-prefix-foreground = "\${colors.primary}"; format-volume-prefix-foreground = "${primary}";
label-muted = "muted"; label-muted = "muted";
label-muted-foreground = "\${colors.disabled}"; label-muted-foreground = "${disabled}";
}; };
"module/memory" = { "module/memory" = {
type = "internal/memory"; type = "internal/memory";
@ -110,7 +113,7 @@
interval = 2; interval = 2;
format-prefix = "RAM "; format-prefix = "RAM ";
format-prefix-foreground = "\${colors.primary}"; format-prefix-foreground = "${primary}";
}; };
"module/cpu" = { "module/cpu" = {
type = "internal/cpu"; type = "internal/cpu";
@ -118,7 +121,17 @@
interval = 2; interval = 2;
format-prefix = "CPU "; format-prefix = "CPU ";
format-prefix-foreground = "\${colors.primary}"; format-prefix-foreground = "${primary}";
};
# TODO: Only build battery module on ThinkPad host
"module/battery" = {
type = "internal/battery";
battery = "BAT0";
adapter = "AC";
label-charging = "%{F${primary}}AC%{F-} %percentage%%";
label-discharging = "%{F${primary}}BAT%{F-} %percentage%%";
label-full = "%{F${primary}}AC%{F-}";
}; };
"module/date" = { "module/date" = {
type = "internal/date"; type = "internal/date";
@ -128,7 +141,7 @@
date = "%H:%M"; date = "%H:%M";
date-alt = "%Y-%m-%d %H:%M:%S"; date-alt = "%Y-%m-%d %H:%M:%S";
label-foreground = "\${colors.primary}"; label-foreground = "${primary}";
}; };
}; };
}; };

Loading…
Cancel
Save