nix-config/dots/polybar/default.nix

164 lines
3.7 KiB
Nix
Raw Permalink Normal View History

2024-11-10 17:54:08 -05:00
{ pkgs, ... }:
{
services.polybar = {
enable = true;
package = pkgs.polybar.override {
pulseSupport = true;
};
script = "polybar main &";
settings =
let
colors = {
background = "#050505";
background-alt = "#373B41";
foreground = "#F1F1F1";
focused = "#4D406B";
primary = "#E04845";
occupied = "#505050";
secondary = "#8ABEB7";
alert = "#A54242";
disabled = "#707880";
};
in
{
"bar/main" = {
width = "100%";
height = "18pt";
radius = 0;
background = "${colors.background}";
foreground = "${colors.foreground}";
line.size = "3pt";
border = {
size = "0pt";
color = "#00000000";
};
padding = {
left = 1;
right = 1;
};
module.margin = 1;
separator.foreground = "${colors.disabled}";
font = [ "JetBrainsMonoNerdFont:size=9" ];
modules = {
left = "bspwm";
right = "volume cpu date";
};
cursor.click = "pointer";
wm.restack = "bspwm";
};
"module/bspwm" = {
type = "internal/bspwm";
pin.workspaces = true;
label = {
focused = {
text = "%index%";
foreground = "${colors.foreground}";
padding = 1;
};
occupied = {
text = "%index%";
foreground = "${colors.occupied}";
padding = 1;
};
urgent = {
text = "%index%";
foreground = "${colors.foreground}";
background = "${colors.background-alt}";
padding = 1;
};
empty = {
text = "";
padding = 1;
};
};
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<ramp-coreload>";
ramp.coreload = {
text = [ "" "" "" "" "" "" "" ];
spacing = 0;
};
};
"module/volume" = {
type = "internal/pulseaudio";
format = {
volume = {
text = "<ramp-volume><label-volume>";
background = "${colors.foreground}";
};
};
label = {
volume = {
text = "%percentage%%";
foreground = "${colors.foreground}";
background = "${colors.background}";
padding.left = 2;
};
muted = {
text = " 0%";
foreground = "${colors.foreground}";
background = "${colors.background}";
padding = 0;
};
};
ramp.volume = {
text = [ "" "" "" ];
foreground = "${colors.foreground}";
background = "${colors.background}";
padding.right = 0;
};
click.right = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"module/date" = {
type = "internal/date";
interval = 1;
date = {
text = "%a, %b %d";
alt = "%a, %b %d";
};
time = {
text = "%H:%M %p";
alt = "%H:%M:%S";
};
label = "%date% %time%";
};
"settings" = {
screenchange.reload = true;
pseudo.transparency = true;
};
};
};
# Make sure polybar starts only during graphical sessions.
systemd.user.services.polybar.Install.WantedBy = [ "graphical-session.target" ];
}