dotfiles/modules/desktop/polybar/default.nix

205 lines
6.0 KiB
Nix
Raw Normal View History

2021-09-09 21:55:28 +02:00
{ config, lib, pkgs, ... }:
2021-11-11 18:34:54 +01:00
{
home-manager.users.moritz = {
2021-09-09 21:55:28 +02:00
services.polybar = {
enable = true;
2021-10-06 15:35:31 +02:00
package = pkgs.polybar.override { pulseSupport = true; };
script = ''
for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
MONITOR=$m polybar --reload bottom &
done
2021-11-11 18:34:54 +01:00
'';
2022-02-07 18:13:55 +01:00
config = let
colors = {
background = "#282a36";
current-line = "#44475a";
foreground = "#f8f8f2";
comment = "#6272a4";
cyan = "#8be9fd";
green = "#50fa7b";
orange = "#ffb86c";
pink = "#ff79c6";
purple = "#bd93f9";
red = "#ff5555";
yellow = "#f1fa8c";
};
in {
"global/wm" = { margin-top = 5; };
"bar/bottom" = {
# position
monitor = "\${env:MONITOR}";
bottom = true;
width = "100%:-20";
heigth = 25;
background = colors.background;
foreground = colors.foreground;
radius = 10;
offset-x = 10;
offset-y = 5;
2022-02-11 22:22:50 +01:00
padding = 1;
2022-02-07 18:13:55 +01:00
line-size = 3;
line-color = colors.pink;
2022-02-11 22:22:50 +01:00
module-margin = 1;
2022-02-21 17:44:24 +01:00
separator = "%{F${colors.comment}}%{F-}";
2022-02-11 22:22:50 +01:00
2022-02-07 18:13:55 +01:00
font-0 = "FiraCode Nerd Font:size=10;0";
2022-02-21 17:43:31 +01:00
modules-left = "cpu memory network battery";
2022-02-07 18:13:55 +01:00
modules-center = "bspwm";
2022-02-21 17:44:24 +01:00
modules-right = "pulseaudio date time";
2022-02-07 18:13:55 +01:00
2022-02-15 16:43:03 +01:00
tray-position = "right";
tray-padding = 2;
2022-02-07 18:13:55 +01:00
wm-restack = "bspwm";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
};
"module/battery" = {
type = "internal/battery";
battery = "BATT";
adapter = "ACAD";
time-format = "%H:%M";
2022-02-21 17:44:24 +01:00
format-charging =
"%{${colors.green}}<animation-charging>%{F-} <label-charging>";
format-discharging =
"%{${colors.red}}<animation-discharging>%{F-} <label-discharging>";
format-full = "%{${colors.green}}%{F-} <label-full>";
2022-02-07 18:13:55 +01:00
label-charging = "%percentage%% %time% remaining";
label-discharging = "%percentage%% %time% remaining";
label-full = "Fully charged";
animation-charging-0 = "";
animation-charging-1 = "";
animation-charging-2 = "";
animation-charging-3 = "";
animation-charging-4 = "";
animation-charging-framerate = 500;
animation-discharging-0 = "";
animation-discharging-1 = "";
animation-discharging-2 = "";
animation-discharging-3 = "";
animation-discharging-4 = "";
animation-discharging-framerate = 500;
};
"module/bspwm" = {
type = "internal/bspwm";
label-focused = "";
label-focused-foreground = colors.purple;
label-focused-padding = 1;
label-occupied = "";
label-occupied-foreground = colors.comment;
label-occupied-padding = 1;
label-urgent = "";
label-urgent-foreground = colors.red;
label-urgent-padding = 1;
label-empty = "";
label-empty-foreground = colors.comment;
label-empty-padding = 1;
label-separator = " ";
label-separator-foreground = colors.cyan;
label-separator-padding = 1;
pin-workspaces = true;
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<ramp-load><label>";
ramp-load-0 = " ";
ramp-load-0-foreground = colors.green;
ramp-load-1 = " ";
ramp-load-1-foreground = colors.orange;
ramp-load-2 = " ";
ramp-load-2-foreground = colors.red;
2022-02-07 18:13:55 +01:00
label = "%percentage:2%%";
};
2022-02-21 17:44:24 +01:00
"module/time" = {
type = "internal/date";
interval = 1;
time = "%H:%M";
time-alt = "%H:%M:%S";
label = "%time%";
format-prefix = " ";
format-prefix-foreground = colors.cyan;
};
2022-02-07 18:13:55 +01:00
"module/date" = {
type = "internal/date";
interval = 5;
date = "%A";
date-alt = "%Y-%m-%d";
2022-02-21 17:44:24 +01:00
label = "%date%";
format-prefix = " ";
format-prefix-foreground = colors.orange;
2022-02-07 18:13:55 +01:00
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format = "<ramp-used><label>";
ramp-used-0 = " ";
ramp-used-0-foreground = colors.green;
ramp-used-1 = " ";
ramp-used-1-foreground = colors.orange;
ramp-used-2 = " ";
ramp-used-2-foreground = colors.red;
ramp-used-3 = " ";
2022-02-07 18:13:55 +01:00
2022-02-21 17:44:24 +01:00
label = "%gb_used%";
2022-02-07 18:13:55 +01:00
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<ramp-volume> <label-volume>";
format-underline = colors.orange;
label-volume = "%percentage%%";
label-muted = " muted";
label-muted-foreground = colors.red;
ramp-volume-0 = "";
2022-02-11 22:22:50 +01:00
ramp-volume-0-foreground = colors.green;
ramp-volume-1 = "";
ramp-volume-1-foreground = colors.green;
ramp-volume-2 = "奔";
ramp-volume-2-foreground = colors.green;
ramp-volume-3 = "";
ramp-volume-3-foreground = colors.orange;
ramp-volume-4 = "";
ramp-volume-4-foreground = colors.red;
2022-02-07 18:13:55 +01:00
click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
2022-02-21 17:43:31 +01:00
"module/network" = {
2022-02-07 18:13:55 +01:00
type = "internal/network";
2022-02-21 17:43:31 +01:00
interface =
builtins.head (builtins.attrNames config.networking.interfaces);
2022-02-07 18:13:55 +01:00
interval = 3;
format-connected = "<label-connected>";
2022-02-21 17:43:31 +01:00
label-connected =
"%{F${colors.purple}}%{F-} %upspeed% %{F${colors.pink}}%{F-} %downspeed%";
2022-02-07 18:13:55 +01:00
};
};
2021-09-09 21:55:28 +02:00
};
};
2021-11-11 18:34:54 +01:00
}