diff --git a/config/home-manager/programs/waybar/default.nix b/config/home-manager/programs/waybar/default.nix index c15a308..0b12fb6 100644 --- a/config/home-manager/programs/waybar/default.nix +++ b/config/home-manager/programs/waybar/default.nix @@ -1,183 +1,177 @@ { pkgs, lib, - osConfig, - config, ... -}: let - inherit (lib) getExe mkMerge mkIf; - inherit (builtins) readFile; -in { +}: { programs.waybar = { enable = true; systemd.enable = true; - style = readFile ./style.css; settings = { - mainBar = mkMerge [ - { - layer = "top"; - position = "top"; - height = 30; + mainBar = { + layer = "top"; + position = "top"; - margin-top = 6; - margin-left = 6; - margin-right = 6; - margin-bottom = 0; + modules-left = [ + "hyprland/window" + "pulseaudio" + "cpu" + "memory" + "idle_inhibitor" + ]; - modules-left = ["hyprland/workspaces" "hyprland/window"]; - modules-center = ["group/clock"]; - modules-right = - ["tray" "group/status" "group/power"] - ++ lib.optional config.services.swaync.enable "custom/swaync"; + modules-center = ["hyprland/workspaces"]; + modules-right = [ + "custom/swaync" + "custom/power" + "network" + "battery" + "tray" + "clock" + ]; - tray = { - icon-size = 16; - spacing = 12; + tray = { + icon-size = 16; + spacing = 12; + }; + + battery = { + interval = 10; + states = { + warning = 30; + critical = 15; }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}% - {time}"; + format-full = " {capacity}% - Full"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + max-length = 25; + }; - battery = { - interval = 10; - states = { - warning = 30; - critical = 15; - }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}% - {time}"; - format-full = " {capacity}% - Full"; - format-icons = [ - "" - "" - "" - "" - "" - ]; - max-length = 25; - }; - - "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" + "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 = ""; - }; + "power-profiles-daemon" = { + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; }; + }; - "group/status" = { - orientation = "inherit"; - modules = [ - "pulseaudio" - "power-profiles-daemon" - "network" - "battery" - ]; - }; + "custom/power" = { + format = ""; + tooltip = false; + on-click = lib.getExe pkgs.wlogout; + }; - "group/power" = { - orientation = "inherit"; - modules = [ - "custom/power" - ]; - }; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + }; - "group/clock" = { - orientation = "inherit"; - modules = [ - "clock#time" - "clock#date" - ]; - }; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; - "custom/power" = { - format = ""; - tooltip = false; - on-click = getExe pkgs.wlogout; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; }; + tooltip = "true"; + }; - "clock#date" = { - format = "{:%D}"; - tooltip-format = "{calendar}"; - }; + "clock" = { + format = " {:L%H:%M}"; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; + }; - "clock#time" = { - format = "{:%H:%M}"; - tooltip-format = "{tz_list}"; - timezones = [ - osConfig.time.timeZone - "US/Eastern" - ]; - }; + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; + }; - network = { - interface = "wlp1s0"; - format = "{ifname}"; - format-wifi = "{icon}"; - 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; - format-icons = [ - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + }; + + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; }; - } - (mkIf osConfig.programs.niri.enable { - "niri/window" = { - icon = true; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; + }; + + "custom/swaync" = { + tooltip = false; + format = "{icon}"; + format-icons = { + none = ""; + notification = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; }; - }) - (mkIf config.services.swaync.enable { - "custom/swaync" = { - format = "{icon}"; - format-icons = { - notification = "󱥁"; - none = "󰍥"; - dnd-notification = "󱅮"; - dnd-none = "󱅯"; - }; - max-length = 3; - return-type = "json"; - escape = true; - exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client"; - exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; - on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; - on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; - tooltip-format = "󰵚 {} notification(s)"; - }; - }) - ]; + return-type = "json"; + escape = true; + exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client"; + exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; + on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; + on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; + }; + }; }; }; home.packages = [ diff --git a/config/home-manager/programs/waybar/style.css b/config/home-manager/programs/waybar/style.css deleted file mode 100644 index a62303b..0000000 --- a/config/home-manager/programs/waybar/style.css +++ /dev/null @@ -1,91 +0,0 @@ -* { - /* `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.25em; - 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: @base0D; - color: @base02; -} - -#workspaces button.urgent { - background: @base08; -} - -#window { - margin-left: 1em; -} - -.modules-left, -.modules-right { - margin: 0.4em 0.5em; -} - -#battery, -#clock, -#network, -#pulseaudio, -#tray, -#power-profiles-daemon { - padding: 0 0.5em; -} - -.modules-left, -.modules-right { - margin: 0.4em 0.5em; -} - -#custom-power { - padding: 0 1.2em; - color: @base08; -} - -#custom-swaync { - padding: 0 1.2em; -} diff --git a/shared/nixosModules/style/modules/waybar.nix b/shared/nixosModules/style/modules/waybar.nix index a9a5e8f..72bdb13 100644 --- a/shared/nixosModules/style/modules/waybar.nix +++ b/shared/nixosModules/style/modules/waybar.nix @@ -1,15 +1,96 @@ { lib, - lib', config, ... }: let cfg = config.local.style; + betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)"; in { config.home-manager.sharedModules = lib.mkIf cfg.enable [ { - programs.waybar.style = - lib'.generateGtkColors lib cfg.scheme.palette; + programs.waybar.style = '' + * { + font-family: "0xProto Nerd Font"; + font-size: 16px; + border-radius: 0px; + border: none; + min-height: 0px; + } + window#waybar { + background: rgba(0,0,0,0); + } + #workspaces { + color: ${cfg.scheme.palette.base00}; + background: ${cfg.scheme.palette.base01}; + margin: 4px 4px; + padding: 5px 5px; + border-radius: 16px; + } + #workspaces button { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: ${cfg.scheme.palette.base00}; + background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + opacity: 0.5; + transition: ${betterTransition}; + } + #workspaces button.active { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: ${cfg.scheme.palette.base00}; + background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + transition: ${betterTransition}; + opacity: 1.0; + min-width: 40px; + } + #workspaces button:hover { + font-weight: bold; + border-radius: 16px; + color: ${cfg.scheme.palette.base00}; + background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + opacity: 0.8; + transition: ${betterTransition}; + } + tooltip { + background: ${cfg.scheme.palette.base00}; + border: 1px solid ${cfg.scheme.palette.base08}; + border-radius: 12px; + } + tooltip label { + color: ${cfg.scheme.palette.base08}; + } + #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { + font-weight: bold; + margin: 4px 0px; + margin-left: 7px; + padding: 0px 18px; + background: ${cfg.scheme.palette.base00}; + color: ${cfg.scheme.palette.base05}; + border-radius: 24px 10px 24px 10px; + } + #network, #battery, + #custom-swaync, #tray, #custom-power { + font-weight: bold; + background: ${cfg.scheme.palette.base00}; + color: ${cfg.scheme.palette.base05}; + margin: 4px 0px; + margin-right: 7px; + border-radius: 10px 24px 10px 24px; + padding: 0px 18px; + } + #clock { + font-weight: bold; + color: ${cfg.scheme.palette.base00}; + background: linear-gradient(90deg, ${cfg.scheme.palette.base0E}, ${cfg.scheme.palette.base0C}); + margin: 0px; + padding: 0px 15px 0px 30px; + border-radius: 0px 0px 0px 40px; + } + ''; } ]; }