From e0a2c929fb39402d069b08f1bfe3d161193e26bc Mon Sep 17 00:00:00 2001 From: kiana-S Date: Fri, 4 Mar 2022 09:50:43 -0500 Subject: [PATCH] Overhaul waybar formatting --- common/config/config.nix | 4 -- common/home-manager/wayland/default.nix | 1 - common/home-manager/wayland/waybar.nix | 67 ++++++++++++++++++------- desktop/config/default.nix | 4 ++ desktop/home-manager/default.nix | 5 +- desktop/home-manager/waybar.nix | 8 +++ flake.nix | 4 +- laptop/home-manager/default.nix | 5 +- laptop/home-manager/waybar.nix | 8 +++ 9 files changed, 80 insertions(+), 26 deletions(-) create mode 100644 desktop/home-manager/waybar.nix create mode 100644 laptop/home-manager/waybar.nix diff --git a/common/config/config.nix b/common/config/config.nix index 3bbd8f4..a81d3b5 100644 --- a/common/config/config.nix +++ b/common/config/config.nix @@ -17,10 +17,6 @@ nixpkgs, # The flake's input version of nixpkgs boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.wireless.networks = { - "NETGEAR97".psk = "pastelcello694"; - }; - # Set your time zone. time.timeZone = "America/New_York"; diff --git a/common/home-manager/wayland/default.nix b/common/home-manager/wayland/default.nix index bd9a60a..c9c1ef4 100644 --- a/common/home-manager/wayland/default.nix +++ b/common/home-manager/wayland/default.nix @@ -8,7 +8,6 @@ imports = [ ./sway.nix ./swaylock.nix - ./waybar.nix ./wofi.nix ./mako.nix ]; diff --git a/common/home-manager/wayland/waybar.nix b/common/home-manager/wayland/waybar.nix index c2e5fe9..44fb5cc 100644 --- a/common/home-manager/wayland/waybar.nix +++ b/common/home-manager/wayland/waybar.nix @@ -1,3 +1,6 @@ +modules-left: +modules-center: +modules-right: { pkgs, ... }: { programs.waybar = { @@ -6,9 +9,7 @@ settings = [{ height = 30; - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-center = [ "sway/window" ]; - modules-right = [ "pulseaudio" "network" "backlight" "idle_inhibitor" "clock" ]; + inherit modules-left modules-center modules-right; modules = { "sway/mode" = { @@ -50,6 +51,16 @@ format = " {usage}%"; tooltip = false; }; + "battery" = { + states.warning = 30; + states.low = 15; + states.critical = 5; + + format-icons = [ "" "" "" "" "" ]; + format = "{icon} {capacity}%"; + format-charging = "{icon} {capacity}% ⚡"; + format-time = "{H}h {M}m"; + }; "memory" = { format = " {}%"; }; @@ -63,13 +74,13 @@ }; "backlight" = { # device = "acpi_video1"; - format = "{percent}% {icon}"; + format = "{icon} {percent}%"; format-icons = [ "" "" ]; }; "network" = { # interface = "wlp2*"; # (Optional) To force the use of this interface - format-wifi = " {essid} {signalStrength}%"; - format-ethernet = " wired"; + format-wifi = " {essid} {signalStrength}%"; + format-ethernet = " wired"; format-disconnected = "disconnected"; tooltip-format = "{ifname} {ipaddr}"; tooltip-format-disconnected = "disconnected"; @@ -77,9 +88,9 @@ "pulseaudio" = { # scroll-step = 1; # %, can be a float format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-bluetooth-muted = "{icon} 0%"; - format-muted = "{icon} 0%"; + format-bluetooth = " {icon} {volume}%"; + format-bluetooth-muted = "  0%"; + format-muted = " {volume}%"; format-icons.headphone = ""; format-icons.hands-free = ""; @@ -87,7 +98,7 @@ format-icons.phone = ""; format-icons.portable = ""; format-icons.car = ""; - format-icons.default = [ "" "" "" ]; + format-icons.default = [ "" "" " " ]; on-click = "pamixer -t"; }; @@ -109,7 +120,7 @@ * { border: none; border-radius: 0; - font-family: "UbuntuMono Nerd Font Mono", sans-serif; + font-family: "UbuntuMono Nerd Font", sans-serif; font-size: 16px; min-height: 0; } @@ -117,8 +128,7 @@ window#waybar { background-color: rgba(0, 0, 0, 0.6); color: #ffffff; - transition-property: background-color; - transition-duration: .2s; + transition: background-color .2s; padding: 5px 0; } @@ -203,15 +213,38 @@ margin-right: 0; } + #clock { + box-shadow: inset 0 -3px #0a6cf5; + } + + #battery { + box-shadow: inset 0 -3px #a0f23c; + } + + #battery.warning:not(.charging) { + box-shadow: inset 0 -3px #fcda44; + color: #fce788; + } + + #battery.low:not(.charging) { + box-shadow: inset 0 -3px #f93920; + color: #f97f6f; + } + @keyframes blink { to { - background-color: #ffffff; - color: #000000; + color: rgba(0, 0, 0, 0); } } - #clock { - box-shadow: inset 0 -3px #0a6cf5; + #battery.critical:not(.charging) { + box-shadow: inset 0 -3px #400000; + color: #ff2525; + animation: blink 1.5s steps(4, start) infinite; + } + + #backlight { + box-shadow: inset 0 -3px #ffff50; } #network { diff --git a/desktop/config/default.nix b/desktop/config/default.nix index d0e4fed..c0ead50 100644 --- a/desktop/config/default.nix +++ b/desktop/config/default.nix @@ -8,6 +8,10 @@ in { networking.hostName = "kiana-desktop"; networking.wireless.enable = true; + networking.wireless.networks = { + "NETGEAR97".psk = "pastelcello694"; + }; + # Passwords users.users.kiana = { inherit hashedPassword; }; users.users.root = { inherit hashedPassword; }; diff --git a/desktop/home-manager/default.nix b/desktop/home-manager/default.nix index d1d344d..ec046a1 100644 --- a/desktop/home-manager/default.nix +++ b/desktop/home-manager/default.nix @@ -1,4 +1,7 @@ { ... }: { - imports = [ ../../common/home-manager ]; + imports = [ + ../../common/home-manager + ./waybar.nix + ]; } diff --git a/desktop/home-manager/waybar.nix b/desktop/home-manager/waybar.nix new file mode 100644 index 0000000..1b02b5e --- /dev/null +++ b/desktop/home-manager/waybar.nix @@ -0,0 +1,8 @@ +# Home manager is being weird about conflicts, +# so I'm doing this. It sucks, but so does home +# manager, so it's fine. + +import ../../common/home-manager/wayland/waybar.nix +[ "sway/workspaces" "sway/mode" ] +[ "sway/window" ] +[ "pulseaudio" "network" "clock" "idle_inhibitor" ] diff --git a/flake.nix b/flake.nix index 37352eb..7701cd2 100644 --- a/flake.nix +++ b/flake.nix @@ -26,8 +26,8 @@ outputs = { self, inherit system; modules = [ { _module.args = moduleArgs; } - ./common/config ./desktop/config + ./common/config home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; @@ -42,8 +42,8 @@ outputs = { self, inherit system; modules = [ { _module.args = moduleArgs; } - ./common/config ./laptop/config + ./common/config home-manager.nixosModules.home-manager nixos-hardware.nixosModules.microsoft-surface { diff --git a/laptop/home-manager/default.nix b/laptop/home-manager/default.nix index d1d344d..ec046a1 100644 --- a/laptop/home-manager/default.nix +++ b/laptop/home-manager/default.nix @@ -1,4 +1,7 @@ { ... }: { - imports = [ ../../common/home-manager ]; + imports = [ + ../../common/home-manager + ./waybar.nix + ]; } diff --git a/laptop/home-manager/waybar.nix b/laptop/home-manager/waybar.nix new file mode 100644 index 0000000..265c6d5 --- /dev/null +++ b/laptop/home-manager/waybar.nix @@ -0,0 +1,8 @@ +# Home manager is being weird about conflicts, +# so I'm doing this. It sucks, but so does home +# manager, so it's fine. + +import ../../common/home-manager/wayland/waybar.nix +[ "sway/workspaces" "sway/mode" ] +[ "sway/window" ] +[ "pulseaudio" "backlight" "network" "battery" "clock" "idle_inhibitor" ]