diff --git a/home/programs/waybar/default.nix b/home/programs/waybar/default.nix new file mode 100644 index 0000000..92c404c --- /dev/null +++ b/home/programs/waybar/default.nix @@ -0,0 +1,148 @@ +{ + osConfig, + pkgs, + lib, + ... +}: let + inherit (lib) getExe; +in { + imports = [./style.nix]; + programs.waybar = { + enable = true; + systemd.enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 30; + + margin-top = 6; + margin-left = 6; + margin-right = 6; + margin-bottom = 0; + + modules-left = ["niri/workspaces" "niri/window"]; + modules-center = ["group/clock"]; + modules-right = ["tray" "group/status" "group/power"]; + + battery = { + interval = 60; + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + max-length = 25; + }; + + "niri/window" = { + icon = true; + }; + + "pulseaudio" = { + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = " "; + format-icons = { + "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; + "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = ""; + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + phone-muted = ""; + portable = ""; + car = ""; + default = [ + "" + "" + ]; + }; + scroll-step = 1; + on-click = "pavucontrol"; + ignored-sinks = [ + "Easy Effects Sink" + ]; + }; + + "power-profiles-daemon" = { + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; + }; + }; + + "group/status" = { + orientation = "inherit"; + modules = [ + "pulseaudio" + "power-profiles-daemon" + "network" + "battery" + ]; + }; + + "group/power" = { + orientation = "inherit"; + modules = [ + "custom/power" + ]; + }; + + "group/clock" = { + orientation = "inherit"; + modules = [ + "clock#time" + "clock#date" + ]; + }; + + "custom/power" = { + format = ""; + tooltip = false; + on-click = getExe pkgs.wlogout; + }; + + "clock#date" = { + format = "{:%D}"; + tooltip-format = "{calendar}"; + }; + + "clock#time" = { + format = "{:%H:%M}"; + tooltip-format = "{tz_list}"; + timezones = [ + osConfig.time.timeZone + "US/Eastern" + ]; + }; + + network = { + interface = "wlp1s0"; + format = "{ifname}"; + format-wifi = "({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; + }; + }; + }; + }; + + home.packages = [ + pkgs.pavucontrol + ]; +} diff --git a/home/programs/waybar/style.nix b/home/programs/waybar/style.nix new file mode 100644 index 0000000..74174cd --- /dev/null +++ b/home/programs/waybar/style.nix @@ -0,0 +1,111 @@ +{ + inputs, + lib, + osConfig, + ... +}: let + inherit (inputs.basix.schemeData.base16.${osConfig.theme.scheme}) palette; + inherit (builtins) concatStringsSep; + inherit (lib) mapAttrsToList; + + generateGtkColors = palette: (concatStringsSep "\n" + (mapAttrsToList + (name: color: "@define-color ${name} ${color};") + palette)); +in { + programs.waybar.style = '' + ${ + if osConfig.theme.enable + then generateGtkColors palette + else "" + } + + * { + /* `otf-font-awesome` is required to be installed for icons */ + border: none; + border-radius: 0px; + min-height: 0; + } + + window#waybar { + border-radius: 2em; + font-family: "Symbols Nerd Font", Inter, sans-serif; + font-size: 16px; + font-style: normal; + background: alpha( + @base00, + 0.9999999 + ); /* niri issue workaround, thanks https://github.com/oatmealine/nix-config/blob/bfdddd2cb36ef659bcddc28e0dbb542b6db8b3bc/modules/desktop/themes/catppuccin/waybar.css#L14 */ + color: @base05; + } + + #workspaces, + .modules-right box { + background: @base02; + padding: 0.15em 0.25; + border-radius: 1em; + margin: 0 0.25em; + } + + #workspaces { + padding: 0; + background: @base02; + } + + #workspaces button:nth-child(1) { + border-top-left-radius: 1em; + border-bottom-left-radius: 1em; + } + #workspaces button:nth-last-child(1) { + border-top-right-radius: 1em; + border-bottom-right-radius: 1em; + } + + #workspaces button { + padding: 0 0.5em; + background-color: transparent; + } + + #workspaces button:hover { + background: rgba(255, 255, 255, 0.1); + box-shadow: none; + } + + #workspaces button.active { + background: @base0E; + color: @base02; + } + + #workspaces button.urgent { + background: @base08; + } + + #window { + margin-left: 1em; + } + + .modules-left, + .modules-right { + margin: 0.4em 0.5em; + } + + #battery, + #clock, + #pulseaudio, + #tray, + #power-profiles-daemon { + padding: 0 0.8em; + } + + .modules-left, + .modules-right { + margin: 0.4em 0.5em; + } + + + #custom-power { + padding: 0 1.2em; + color: @base08; + } + ''; +} diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index 135a692..a3a156c 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -34,7 +34,7 @@ in { "${home}/services/udiskie.nix" "${home}/programs/niri" - "${home}/programs/ironbar" + "${home}/programs/waybar" "${home}/programs/fuzzel.nix" "${home}/programs/swaybg.nix" "${home}/programs/swaylock.nix" diff --git a/hosts/vamos/modules/theme.nix b/hosts/vamos/modules/theme.nix index 3576304..79c955f 100644 --- a/hosts/vamos/modules/theme.nix +++ b/hosts/vamos/modules/theme.nix @@ -1,5 +1,6 @@ {pkgs, ...}: { theme = { + enable = true; wallpaper = pkgs.fetchurl { url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/e0cf0eb237dc5baba86661a3572b20a6183c1876/wallpapers/nix-wallpaper-nineish-catppuccin-frappe.png?raw=true"; hash = "sha256-/HAtpGwLxjNfJvX5/4YZfM8jPNStaM3gisK8+ImRmQ4="; diff --git a/modules/theme/default.nix b/modules/theme/default.nix index 802b758..56da004 100644 --- a/modules/theme/default.nix +++ b/modules/theme/default.nix @@ -3,11 +3,12 @@ pkgs, ... }: let - inherit (lib) mkOption; + inherit (lib) mkEnableOption mkOption; inherit (lib.types) string path package; in { imports = [./gtk.nix]; options.theme = { + enable = mkEnableOption "theme"; scheme = mkOption { description = '' Name of the tinted-scheming color scheme to use. diff --git a/system/programs/fonts.nix b/system/programs/fonts.nix index 12b8e9a..8ce3ebb 100644 --- a/system/programs/fonts.nix +++ b/system/programs/fonts.nix @@ -14,7 +14,7 @@ pkgs.noto-fonts-extra pkgs.intel-one-mono inputs.self.packages.${pkgs.system}.apple-emoji-color - (pkgs.nerdfonts.override {fonts = ["IntelOneMono"];}) + (pkgs.nerdfonts.override {fonts = ["IntelOneMono" "NerdFontsSymbolsOnly"];}) ]; enableDefaultPackages = false;