From 0056cfcceb0bea3d71f45136e1bcad8738d2157f Mon Sep 17 00:00:00 2001 From: James Patrick Date: Tue, 3 May 2022 00:09:21 -0400 Subject: [PATCH] initial commit of polybar stuff --- modules/applications/i3/default.nix | 2 +- modules/applications/i3/polybar.nix | 168 ++++++++++++++++++++++++++++ modules/system/fonts.nix | 2 +- 3 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 modules/applications/i3/polybar.nix diff --git a/modules/applications/i3/default.nix b/modules/applications/i3/default.nix index b454ea2..646a52c 100644 --- a/modules/applications/i3/default.nix +++ b/modules/applications/i3/default.nix @@ -1 +1 @@ -{ config, pkgs, ... }: { imports = [ ./i3.nix ./picom.nix ]; } +{ config, pkgs, ... }: { imports = [ ./i3.nix ./picom.nix ./polybar.nix ]; } diff --git a/modules/applications/i3/polybar.nix b/modules/applications/i3/polybar.nix new file mode 100644 index 0000000..78e40c0 --- /dev/null +++ b/modules/applications/i3/polybar.nix @@ -0,0 +1,168 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.this.application.i3.polybar; + i3 = config.this.application.i3; + colors = { + alert = "#A54242"; + background = "#000000"; + background-alt = "#373B41"; + disabled = "#707880"; + foreground = "#C5C8C6"; + primary = "#F0C674"; + secondary = "#8ABEB7"; + }; +in with lib; { + options = { + this.application.i3.polybar.enable = mkOption { + default = i3.enable; + type = with types; bool; + }; + }; + + config = mkIf cfg.enable { + home-manager.users.james = { + services.polybar = { + enable = true; + script = "polybar"; + package = pkgs.polybar.override { + i3GapsSupport = true; + alsaSupport = true; + iwSupport = true; + githubSupport = true; + }; + config = { + "bar/top" = { + width = "100%"; + height = "12pt"; + background = "${colors.background}"; + foreground = "${colors.foreground}"; + line-size = "3pt"; + border-size = "1pt"; + border-color = "${colors.background}"; + padding-left = "0"; + padding-right = "1"; + module-margin = "1"; + separator = "|"; + separator-foreground = "${colors.disabled}"; + font-0 = "Hasklug Nerd Font:size=8;2"; + font-1 = "Font Awesome 5 Free:size=8;2"; + font-2 = "Font Awesome 5 Free Solid:style=Solid;size=8;2"; + font-3 = "Noto Sans:size=8;1"; + modules-left = "xworkspaces i3 xwindow"; + modules-right = + "demo filesystem pulseaudio memory cpu wlan battery date"; + cursor-click = "pointer"; + cursor-scroll = "ns-resize"; + enable-ipc = "true"; + tray-position = "right"; + }; + "module/i3" = { + type = "internal/i3"; + format = ""; + }; + "module/xworkspaces" = { + type = "internal/xworkspaces"; + label-active = "%name%"; + label-active-background = "${colors.background-alt}"; + label-active-padding = "1"; + label-empty = "%name%"; + label-empty-foreground = "${colors.disabled}"; + label-empty-padding = "1"; + label-occupied = "%name%"; + label-occupied-padding = "1"; + label-urgent = "%name%"; + label-urgent-background = "${colors.alert}"; + label-urgent-padding = "1"; + }; + "module/xwindow" = { + type = "internal/xwindow"; + label = "%title:0:60:...%"; + }; + "module/filesystem" = { + type = "internal/fs"; + interval = "25"; + mount-0 = "/"; + label-mounted = "%{F#F0C674}%mountpoint%%{F-} %percentage_used%%"; + label-unmounted = "%mountpoint% not mounted"; + label-unmounted-foreground = "${colors.disabled}"; + }; + "module/pulseaudio" = { + type = "internal/pulseaudio"; + format-volume-prefix = "VOL "; + format-volume-prefix-foreground = "${colors.primary}"; + format-volume = ""; + label-volume = "%percentage%%"; + label-muted = "muted"; + label-muted-foreground = "${colors.disabled}"; + }; + "module/memory" = { + type = "internal/memory"; + interval = "2"; + format-prefix = "RAM "; + format-prefix-foreground = "${colors.primary}"; + label = "%percentage_used:2%%"; + }; + "module/cpu" = { + type = "internal/cpu"; + interval = "2"; + format-prefix = "CPU "; + format-prefix-foreground = "${colors.primary}"; + label = "%percentage:2%%"; + }; + "network-base" = { + type = "internal/network"; + interval = "5"; + format-connected = ""; + format-disconnected = ""; + label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected"; + }; + "module/wlan" = { + "inherit" = "network-base"; + interface-type = "wireless"; + label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%"; + }; + "module/battery" = { + type = "internal/battery"; + format-charging = " "; + format-discharging = " "; + ramp-capacity-0 = ""; + ramp-capacity-1 = ""; + ramp-capacity-2 = ""; + ramp-capacity-3 = ""; + ramp-capacity-4 = ""; + animation-charging-0 = "%{F#F0C674}%{F-}"; + animation-charging-1 = ""; + animation-charging-2 = ""; + animation-charging-3 = ""; + animation-charging-4 = ""; + animation-charging-framerate = "1500"; + }; + "module/demo" = { + type = "custom/ipc"; + hook-0 = "echo foobar"; + hook-1 = "date +%s"; + hook-2 = "whoami"; + initial = "1"; + click-left = "#demo.hook.0"; + click-right = "#demo.hook.1"; + double-click-left = "#demo.hook.2"; + }; + "module/date" = { + type = "internal/date"; + interval = "1"; + date = "%H:%M"; + date-alt = "%Y-%m-%d %H:%M:%S"; + label = "%date%"; + label-foreground = "${colors.primary}"; + }; + }; + }; + }; + }; +} + +# [settings] +# screenchange-reload = true +# pseudo-transparency = true + +# ; vim:ft=dosini diff --git a/modules/system/fonts.nix b/modules/system/fonts.nix index 9fae415..8d61bf9 100644 --- a/modules/system/fonts.nix +++ b/modules/system/fonts.nix @@ -9,7 +9,7 @@ in { fira-code fira-code-symbols font-awesome - hasklig + (nerdfonts.override { fonts = [ "Hasklig" ]; }) inter liberation_ttf noto-fonts