summaryrefslogtreecommitdiff
path: root/lib/polybar.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/polybar.nix')
-rw-r--r--lib/polybar.nix148
1 files changed, 148 insertions, 0 deletions
diff --git a/lib/polybar.nix b/lib/polybar.nix
new file mode 100644
index 0000000..3c454cb
--- /dev/null
+++ b/lib/polybar.nix
@@ -0,0 +1,148 @@
+# https://github.com/0x746866/dots/blob/master/polybar/config
+{ pkgs, lib, ... }:
+let
+ inherit (import ./const.nix) fontSize homedir;
+ inherit (import ./theme.nix { inherit pkgs lib; })
+ colors theme;
+in {
+ services.polybar = {
+ config = {
+
+ "bar/top" = {
+ background = colors."${theme}".background;
+ font-0 = "FiraSans:size=${toString fontSize}";
+ font-1 = "Font Awesome 5:pixelsize=11;1";
+ font-2 = "MaterialIcons:size=10:antialias=false;2";
+ foreground = colors."${theme}".foreground;
+ height = "30";
+ module-margin = 1;
+ modules-center = "date";
+ modules-left = ["ewmh" "volume-bar"];
+ modules-right = [ "battery" "cpu" "mem" "temp" ];
+ radius = 0;
+ separator = "|";
+ tray-background = colors."${theme}".background;
+ tray-detached = false;
+ tray-maxsize = 16;
+ tray-offset-x = 0;
+ tray-offset-y = 0;
+ tray-padding = 0;
+ tray-position = "right";
+ tray-scale = 1;
+ width = "100%";
+ };
+
+ "module/ewmh" = {
+ type = "internal/xworkspaces";
+ label-active-foreground = "#fff";
+ };
+
+ "module/date" = {
+ type = "internal/date";
+ internal = 5;
+ date = "%Y.%m.%d";
+ time = "%H.%M";
+ label = "%date%..%time%";
+ };
+
+ "module/battery" = {
+ type = "internal/battery";
+ battery = "BAT0";
+ adapter = "AC";
+ full-at = 99;
+ };
+
+ "module/volume-bar" = {
+ type = "internal/alsa";
+ master-soundcard = "hw:1";
+ bar-volume-font = 2;
+ bar-volume-width = 9;
+ format-volume = "<label-volume><bar-volume>";
+ label-volume = " .) ";
+ label-muted = " .) mute";
+ label-volume-foreground = colors.${theme}.foreground;
+ format-muted-foreground = colors.${theme}.foreground;
+ bar-volume-foreground-0 = colors.${theme}.foreground;
+ bar-volume-foreground-1 = colors.${theme}.foreground;
+ bar-volume-foreground-2 = colors.${theme}.foreground;
+ bar-volume-foreground-3 = colors.${theme}.foreground;
+ bar-volume-foreground-4 = colors.${theme}.foreground;
+ bar-volume-foreground-5 = colors.${theme}.foreground;
+ bar-volume-foreground-6 = colors.${theme}.foreground;
+ bar-volume-gradient = true;
+ bar-volume-indicator = "•";
+ bar-volume-fill = "•";
+ bar-volume-empty = "·";
+ bar-volume-empty-foreground = colors.${theme}.foreground;
+ };
+
+ "module/ethernet" = {
+ type = "internal/network";
+ interface = "enp1s0";
+ label-connected = "eth up: %upspeed:9% down: %downspeed%";
+ label-disconnected = "no eth";
+ };
+
+ "module/wifi" = {
+ type = "internal/network";
+ interface = "wlan1";
+ label-connected = "wifi up: %upspeed% down: %downspeed%";
+ label-disconnected = "no wifi";
+ };
+
+ "module/cpu" = {
+ type = "internal/cpu";
+ interval = 3;
+ format-padding = 1;
+ format = "<label> <ramp-coreload>";
+ label = " %percentage:2%%";
+ ramp-coreload-0 = "▂";
+ ramp-coreload-1 = "▃";
+ ramp-coreload-2 = "▄";
+ ramp-coreload-3 = "▅";
+ ramp-coreload-4 = "▆";
+ ramp-coreload-5 = "▇";
+ ramp-coreload-0-foreground = colors.${theme}.foreground;
+ ramp-coreload-1-foreground = colors.${theme}.foreground;
+ ramp-coreload-2-foreground = colors.${theme}.foreground;
+ ramp-coreload-3-foreground = colors.${theme}.foreground;
+ ramp-coreload-4-foreground = colors.${theme}.foreground;
+ ramp-coreload-5-foreground = colors.${theme}.highlight;
+ };
+
+ "module/temp" = {
+ type = "internal/temperature";
+ interval = 3;
+ thermal-zone = 0;
+ warn-temperature = 70;
+ format = "<ramp> <label>";
+ format-padding = 1;
+ label = "%temperature-c%";
+ ramp-0 = "_";
+ ramp-1 = ".";
+ ramp-2 = ":";
+ ramp-3 = "|";
+ ramp-4 = "!!";
+ ramp-0-foreground = colors.${theme}.foreground;
+ ramp-1-foreground = colors.${theme}.foreground;
+ ramp-2-foreground = colors.${theme}.foreground;
+ ramp-3-foreground = colors.${theme}.foreground;
+ ramp-4-foreground = colors.${theme}.highlight;
+ format-warn = "<label-warn>";
+ label-warn = " %temperature-c%";
+ label-warn-padding = 1;
+ label-warn-foreground = colors.${theme}.highlight;
+ };
+
+ "module/mem" = {
+ type = "internal/memory";
+ interval = 3;
+ format = "<label>";
+ label-padding = 1;
+ label = " |[ %percentage_used%% ]|";
+ };
+
+ };
+ };
+}
+