dotfiles/nix/configs/polybar.nix

210 lines
6.5 KiB
Nix

let
colors = {
fg = "#FFFFFF";
foreground = "#FFFFFF";
bg = "#191830";
background = "#191830";
border = "#F72585";
warn = "#f00";
altfg = "#F72585";
invisible = "#00400080";
currentWorkspace = "#FAD000";
seperatorColor = "#FAD000";
};
script = "~/dotifles/scripts";
in
{
imports = [
./polybar/bottom.nix
];
home-manager.users.grape.services.polybar = {
enable = true;
script = "${script}/polybar.sh";
config = {
"module/date" = {
type = "internal/date";
font-1 = "Jetbrains Mono Nerd font";
interval = 1;
time = "%I:%M:%S";
date = "%Y-%m-%d %A";
format = "%{T2}%{F#191830}%{F-}%{T-}<label>%{T2}%{F#191830}%{F-}%{T-}";
label-background = "${colors.bg}";
label = "%time% %date%";
label-foreground = "${colors.fg}";
};
"module/fs-label-system" = {
type = "custom/text";
label = "SYS ";
label-foreground = "${colors.seperatorColor}";
};
"module/fs-label-data" = {
type = "custom/text";
label = "DAT ";
label-foreground = "${ colors. seperatorColor}";
};
"module/s" = {
type = "custom/text";
label = " ";
};
"module/ewmh" = {
type = "internal/xworkspaces";
pin-workspaces = false;
label-active-foreground = "${colors.currentWorkspace}";
label-active-background = "${colors.background}";
label-inactive-background = "${colors.background}";
label-urgent-foreground = colors.warn;
label-empty-background = "${colors.background}";
label-occupied-background = "${colors.background}";
format = "%{T2}%{F#191830}%{F-}%{T-}<label-state>%{T2}%{F#191830}%{F-}%{T-}";
};
"module/cpu-temp" = {
type = "internal/temperature";
base-temperature = 20;
warn-temperature = 85;
label-warn-foreground = "${colors.warn}";
thermal-zone = 0;
zone-type = "x86_pkg_temp";
label-background = "${colors.foreground}";
label-foreground = "${colors.fg}";
hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input";
format = "%{T2}%{F#${colors.background}}%{F-}%{T-}%{B${colors.bg}}%{F${colors.seperatorColor}}CPU %{F-}%{B-}<label>%{T2}%{F#191830}%{F-}%{T-}";
format-warn = "%{F${colors.seperatorColor}}CPU%{F-} <label-warn> ";
};
"module/cpu-usage" = {
type = "internal/cpu";
interval = "1.5";
format = "<label>";
label = "CPU %percentage%%";
label-background = "${colors.foreground}";
format-foreground = "${colors.fg}";
};
"module/gpu-temp" = {
type = "custom/script";
interval = "1.5";
exec = "nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits";
format = "%{B${colors.bg}}%{F${colors.seperatorColor}}GPU %{F-}%{B-}<label>°C";
label-background = "${colors.foreground}";
label-foreground = "${colors.foreground}";
};
"module/gpu-usage" = {
type = "custom/script";
interval = "1.5";
label-background = "${colors.background}";
label-foreground = "${colors.foreground}";
exec = "nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits";
format = "<label> mb";
};
"module/memory" = {
type = "internal/memory";
interval = 1;
label-background = "${colors.background}";
format = "%{T2}%{F#191830}%{F-}%{T-}%{B${colors.bg}}%{F${colors.seperatorColor}}RAM %{F-}%{B-}<label>%{T2}%{F#191830}%{F-}%{T-}";
label = "%used%";
label-warn = "%used%";
warn-percentage = 60;
label-warn-foreground = "${colors.warn}";
};
"module/fs-system" = {
type = "internal/fs";
label-unmounted = "?";
format-prefix-foreground = "${colors.fg}";
warn-precentage = "80%";
mount-0 = "/";
interval = 30;
label-mounted-background = "${colors.background}";
format-mounted = "%{T2}%{F#191830}%{F-}%{T-}%{B${colors.bg}}%{F${colors.seperatorColor}}SYS %{F-}%{B-}<label-mounted>%{T2}%{F#191830}%{F-}%{T-}";
label-mounted = "%free%(%total%)";
# FIXME doesn't work
label-warn = "%{F${colors.warn}} !%free%!%{F-}(%total%)";
};
"module/fs-data" = {
type = "internal/fs";
label-unmounted = "?";
format-prefix-foreground = "${colors.fg}";
warn-precentage = "80%";
label-mounted-background = "${colors.background}";
mount-0 = "/media/terra";
interval = 30;
format-mounted = "%{T2}%{F#191830}%{F-}%{T-}%{B${colors.bg}}%{F${colors.seperatorColor}}DAT %{F-}%{B-}<label-mounted>%{T2}%{F#191830}%{F-}%{T-}";
label-mounted = "%free%(%total%)";
# FIXME doesn't work
label-warn = "%{F${colors.warn}} !%free%!%{F-}(%total%)";
};
"module/battery" = {
type = "internal/battery";
full-at = 95;
low-at = 20;
battery = "BAT0";
adapter = "AC0";
label-background = colors.background;
label-foreground = colors.foreground;
format = "%{T2}%{F#191830}%{F-}%{T-}%{B${colors.bg}}%{F${colors.seperatorColor}}BAT %{F-}%{B-}<label-mounted>%{T2}%{F#191830}%{F-}%{T-}";
poll-interval = 4;
};
"module/keyboard" = {
type = "internal/xkeyboard";
label-layout-background = colors.background;
label-layout-foreground = colors.foreground;
format = "%{T2}%{F#191830}%{F-}%{T-}%{B${colors.background}}<label-layout> <label-indicator>%{B-}%{T2}%{F#191830}%{F-}%{T-}";
};
"global/wm" = {
override-redirect = false;
};
"bar/default" = {
font-0 = "Jetbrains Mono Nerd font:size=11;3";
font-1 = "Jetbrains Mono Nerd font:size=22;5";
bottom = false;
# Dimensions
width = "100%";
height = 34;
radius = 15;
# Padding for modules
padding-left = 2;
padding-right = 2;
# setting colors
#background = "${colors.bg}";
background = "#00191830";
foreground = "${colors.fg}";
# border for bar
border-size = "10px";
border-color = "${colors.invisible}";
# Displayed modules
modules-left = "date s keyboard";
modules-center = "ewmh";
modules-right = "battery-label battery s fs-data s fs-system s memory s start gpu-temp gpu-usage end s cpu-temp cpu-usage";
};
};
};
}