From dd311640f2fcf737d061d4ecf9847dc11fe2c040 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Sun, 21 Jan 2024 13:24:34 -0700 Subject: [PATCH] configs/polybar: init and configure for a few hosts --- configs/default.nix | 9 ++-- configs/polybar.nix | 125 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 configs/polybar.nix diff --git a/configs/default.nix b/configs/default.nix index e5fe8f4..94ac843 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -7,13 +7,14 @@ ./dns.nix ./doas.nix ./git.nix - ./neovim.nix - ./peerix.nix ./manager.nix - ./tmux.nix + ./neovim.nix ./net-overlay.nix - ./zsh.nix ./nix.nix + ./peerix.nix + ./polybar.nix + ./tmux.nix ./update.nix + ./zsh.nix ]; } diff --git a/configs/polybar.nix b/configs/polybar.nix new file mode 100644 index 0000000..bed0d4a --- /dev/null +++ b/configs/polybar.nix @@ -0,0 +1,125 @@ +{ pkgs, ... }: +let + barBase = { + background = "\${colors.background}"; + foreground = "\${colors.foreground}"; + + border-color = "#DEDeff"; + border-size = "2pt"; + + width = "100%"; + height = "24pt"; + + enable-ipc = true; + + font-0 = "Go Mono;3"; + + line-size = "3pt"; + module-margin = 1; + padding = 2; + radius = 15; + separator = "|"; + + modules-left = "xworkspaces"; + modules-right = "wifi ethernet memory cpu battery date"; + }; + settings = { + colors = { + background = "#ffffea"; + background-alt = "#373B41"; + foreground = "#000000"; + primary = "#F0C674"; + secondary = "#8ABEB7"; + alert = "#A54242"; + disabled = "#707880"; + }; + + "module/cpu" = { + type = "internal/cpu"; + interval = 2; + format-prefix = "CPU: "; + label = "%percentage:2%%"; + }; + + "module/date" = { + type = "internal/date"; + interval = 1; + + date = "%H:%M"; + date-alt = "%Y-%m-%d %H:%M:%S"; + + label = "%date%"; + }; + + "module/memory" = { + type = "internal/memory"; + interval = 2; + format-prefix = "RAM: "; + label = "%percentage_used:2%%"; + }; + + "module/xworkspaces" = { + type = "internal/xworkspaces"; + }; + + "module/xwindow" = { + type = "internal/xwindow"; + }; + + "module/systray" = { + type = "internal/tray"; + }; + + "module/battery" = { + type = "internal/battery"; + full-at = 99; + low-at = 5; + + # $ ls -1 /sys/class/power_supply/ + battery = "BAT1"; + adapter = "ACAD"; + + poll-interval = 5; + + time-format = "%H:%M"; + + label-charging = "+%percentage%%"; + label-discharging = "-%percentage%%"; + label-low = "BATTERY LOW"; + }; + + "module/wifi" = { + type = "internal/network"; + interface-type = "wireless"; + + accumulate-stats = true; + + label-connected = "%essid% %netspeed%"; + }; + + "module/ethernet" = { + type = "internal/network"; + interface-type = "wired"; + + accumulate-stats = true; + + label-connected = "%netspeed%"; + }; + + "bar/europa" = barBase // { }; + "bar/clunk" = barBase // { }; + }; + settingsFormat = pkgs.formats.ini { }; + settingsFile = settingsFormat.generate "polybar-config.ini" settings; +in +{ + config = { + environment = { + systemPackages = [ pkgs.polybar ]; + etc = { + "xdg/polybar/config.ini".text = builtins.readFile settingsFile; + }; + }; + fonts = { packages = [ pkgs.go-font ]; }; + }; +}