diff --git a/home/default.nix b/home/default.nix index b6a7665..e7b8311 100644 --- a/home/default.nix +++ b/home/default.nix @@ -28,6 +28,7 @@ imports = [ ./hyprland.nix ./git.nix + ./waybar.nix ./packages.nix ]; }; diff --git a/home/packages.nix b/home/packages.nix index 21ae549..eb6eca6 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -9,7 +9,7 @@ brightnessctl playerctl hyprshot - waybar + # waybar # to better find execs nix-index diff --git a/home/waybar.css b/home/waybar.css new file mode 100644 index 0000000..787fe7f --- /dev/null +++ b/home/waybar.css @@ -0,0 +1,194 @@ +/* ============================================================================= + * + * Waybar configuration + * + * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration + * + * =========================================================================== */ + +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +@keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } +} + +@keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } +} + + +/* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: #323232; + color: white; + font-family: Cantarell, Noto Sans, sans-serif; + font-size: 13px; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#custom-keyboard-layout, +#memory, +#mode, +#network, +#pulseaudio, +#temperature, +#tray { + padding-left: 10px; + padding-right: 10px; +} + + +/* ----------------------------------------------------------------------------- + * Module styles + * -------------------------------------------------------------------------- */ + +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#battery.warning { + color: orange; +} + +#battery.critical { + color: red; +} + +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +#clock { + font-weight: bold; +} + +#cpu { + /* No styles */ +} + +#cpu.warning { + color: orange; +} + +#cpu.critical { + color: red; +} + +#memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#memory.warning { + color: orange; +} + +#memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; +} + +#mode { + background: #64727D; + border-top: 2px solid white; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; +} + +#network { + /* No styles */ +} + +#network.disconnected { + color: orange; +} + +#pulseaudio { + /* No styles */ +} + +#pulseaudio.muted { + /* No styles */ +} + +#custom-spotify { + color: rgb(102, 220, 105); +} + +#temperature { + /* No styles */ +} + +#temperature.critical { + color: red; +} + +#tray { + /* No styles */ +} + +#window { + font-weight: bold; +} + +#workspaces button { + border-top: 2px solid transparent; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; + padding-left: 10px; + padding-right: 10px; + color: #888888; +} + +#workspaces button.focused { + border-color: #4c7899; + color: white; + background-color: #285577; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; +} diff --git a/home/waybar.nix b/home/waybar.nix new file mode 100644 index 0000000..588a207 --- /dev/null +++ b/home/waybar.nix @@ -0,0 +1,86 @@ +{ config, pkgs, ... }: +{ + programs.waybar = { + enable = true; + systemd.enable = true; + style = ./waybar.css; + settings = { + mainBar = { + layer = "bottom"; + position = "top"; + output = [ + "DP-3" "DP-4" "DP-5" + "DP-6" "DP-7" "DP-8" + "DP-1" + "eDP-1" + ]; + + modules-left = ["sway/workspaces" "sway/mode" "cpu" "memory"]; + modules-center = []; + modules-right = ["pulseaudio" "backlight" "network" "battery" "clock"]; + + + cpu = { + interval = 15; + format = " {}%"; + max-length = 10; + }; + + memory = { + interval = 30; + format = " {}%"; + max-length = 10; + }; + + "pulseaudio" = { + format = "{volume}% {icon}"; + format-bluetooth = "{volume}% {icon}"; + format-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" ""]; + }; + scroll-step = 1; + on-click = "pavucontrol"; + }; + + backlight = { + tooltip = false; + format = " {}%"; + interval = 1; + on-scroll-up = "brightnessctl s 1515"; + on-scroll-down = "brightnessctl s 1"; + }; + + network = { + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} 󰊗"; + format-disconnected = "󰤮"; + tooltip-format = "{ifname} via {gwaddr} 󰊗"; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + }; + + battery = { + format = "{capacity}% {icon}"; + "format-icons" = ["" "" "" "" ""]; + }; + + clock = { + "format-alt" = "{:%a, %d. %b %H:%M}"; + }; + + + + }; + }; + }; +} diff --git a/modules/shell.nix b/modules/shell.nix index 132c218..e79425c 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -5,7 +5,7 @@ programs.zsh.ohMyZsh.theme = "agnoster"; environment.shellAliases = { - os-update = "unbuffer sudo nixos-rebuild switch --flake '/home/rhea/nix-config' --log-format internal-json -v |& nom --json"; + os-update = "unbuffer sudo nixos-rebuild switch --flake '/home/rhea/nix-config' |& nom"; }; fonts.packages = with pkgs; [