diff --git a/modules/wm/hyprland/config/waybar/style.css b/modules/wm/hyprland/config/waybar/style.css index bfd51da..d6638bb 100644 --- a/modules/wm/hyprland/config/waybar/style.css +++ b/modules/wm/hyprland/config/waybar/style.css @@ -51,108 +51,74 @@ @define-color crust #181926; @define-color crust-rgb rgb(24, 25, 38); -* { - font-size: 15px; - font-family: "Hasklug Nerd Font"; -} - -window#waybar{ - all: unset; +#waybar { + background: transparent; + font-family: "Hasklug Nerd Font"; } .modules-left, .modules-center, .modules-right { - margin: 5px; - padding: 7px; - border-radius: 10px; - border: 2px solid @lavender; - background: @surface0; -} -.top .modules-left, .top .modules-center, .top .modules-right { - margin-bottom: 0px; -} -.right .modules-left, .right .modules-center, .right .modules-right { - margin-left: 0px; + border: 2px solid @lavender; + border-radius: 10px; + margin: 5px; + background: @base; + color: @text; } -tooltip { - background:@surface0; - color: @text; - border: 2px solid @lavender; - border-radius: 10px; +#power { + padding-left: 10px; +} +#power * { + color: @lavender; + transition: 0.2s color ease; + font-size: 26px; +} +#power *:hover { + color: @red; } -#clock, #cpu, #memory { - transition: all .3s ease; +#workspaces .empty { + color: @surface0; } -.top #clock, .top #cpu, .top #memory { - padding: 0px 5px; +#workspaces * { + color: inherit; + padding: 0px 2px; + margin: 0px; } -.right #clock, .right #cpu, .right #memory { - padding: 5px 0px; +#workspaces .active { + color: @red; + font-size: 18px; } -.top .modules-right * { - margin-left: 5px; -} #clock { + color: @peach; +} +#battery { color: @maroon; } #cpu { - color: @yellow; -} -#memory { - color: @green; -} -#pulseaudio { - color: @teal; -} -#network { - color: @sapphire; -} - -#workspaces { - padding: 0px 0px; -} -#workspaces button { - all:unset; - padding: 0px 5px; - color: @lavender; - transition: all .3s ease; -} -#workspaces button.active { - color: @red; - border: none; -} -#workspaces button.empty { - color: @mantle; - border: none; -} -#workspaces button.empty.active { - color: @red; - border: none; -} -.top #workspaces button { - padding: 0px 5px; -} -.right #workspaces button { - padding: 5px 0px; -} - -#power .module { - font-size: 20px; - color: @lavender; - transition: 0.3s color ease; -} -#power .module:hover { color: @red; } -.top #custom-power { - margin-left: 5px; +#memory { + color: @mauve; } -.top #power .modules { - margin-right: 5px; +#pulseaudio { + color: @blue; } -.right #power .modules { - margin-bottom: 5px; +#network { + color: @teal; } +.horizontal .modules-right { + font-size: 16px; +} +.horizontal .modules-right * { + padding: 0px 8px; +} +.vertical .modules-right { + font-size: 16px; + padding: 0px 8px; +} +.vertical .modules-right * { + padding: 2px 0px; +} + diff --git a/modules/wm/hyprland/default.nix b/modules/wm/hyprland/default.nix index 1dbdffa..223a8e1 100644 --- a/modules/wm/hyprland/default.nix +++ b/modules/wm/hyprland/default.nix @@ -6,12 +6,12 @@ }: let inherit (lib) mkIf mkEnableOption; cfg = config.horseman.wm.hyprland; - homeCfg = config.horseman; in { imports = [ ./options.nix ./keybindings.nix ./animations.nix + ./waybar.nix ]; options = { @@ -66,9 +66,6 @@ in { "suppressevent maximize, class:.*" "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" - "rounding 0, floating:0 onworkspace:w[tv1]" - "bordersize 0, floating:0 onworkspace:w[tv1]" - "float, initialTitle:^Picture-in-Picture$" "center, initialTitle:^Picture-in-Picture$" "size 33% 33%, initialTitle:^Picture-in-Picture$" @@ -77,10 +74,6 @@ in { "float, initialTitle:GLFW" ]; - workspaces = [ - "w[tv1], gapsout:0, gapsin:0" - ]; - general = { gapsIn = 5; gapsOut = 5; @@ -195,109 +188,6 @@ in { } ]; }; - - waybar = { - formats = { - horizontal = { - "clock" = { - format = "󰥔 {:%H:%M:%S}"; - format-alt = "{:%a %d %b %Y}"; - }; - }; - vertical = { - "clock" = { - format = "{:%H\n%M\n%S}"; - format-alt = "{:%d\n%m\n%y}"; - }; - }; - }; - modules = { - "clock" = { - interval = 1; - tooltip = false; - }; - - "cpu" = { - interval = 3; - format = " {usage}%"; - on-click = "kitty btop &"; - }; - - "memory" = { - interval = 3; - format = " {percentage}%"; - on-click = "kitty btop &"; - }; - - "pulseaudio" = { - format = " {volume}"; - on-click = "kitty pulsemixer &"; - }; - - "network" = { - interval = 3; - format = "{ipaddr}"; - format-ethernet = " {ipaddr}"; - format-disconnected = "󰣽 Disconnected"; - format-wifi = "󰤨 {essid}"; - - tooltip = false; - }; - - "battery" = { - interval = 3; - # TODO This needs to be fixed - }; - - "hyprland/workspaces" = { - format = "{icon}"; - format-icons = { - "active" = ""; - "default" = ""; - "empty" = ""; - }; - persistent-workspaces = { - "*" = [1 2 3 4 5 6 7 8 9 10]; - }; - }; - - "group/power" = { - orientation = "horizontal"; - drawer = { - }; - modules = [ - "custom/power" - "custom/reboot" - "custom/lock" - "idle_inhibitor" - ]; - }; - - "custom/lock" = { - format = "󰍁 "; - tooltip = false; - on-click = "hyprlock"; - }; - "custom/reboot" = { - format = "󰜉 "; - tooltip = false; - on-click = "reboot"; - }; - "custom/power" = { - format = " "; - tooltip = false; - on-click = "shutdown now"; - }; - "idle_inhibitor" = { - tooltip = false; - format = "{icon}"; - format-icons = { - deactivated = "󰒲 "; - activated = "󰒳 "; - }; - }; - }; - }; }; services.logind.extraConfig = '' diff --git a/modules/wm/hyprland/options.nix b/modules/wm/hyprland/options.nix index f11bb54..e7c0b7b 100644 --- a/modules/wm/hyprland/options.nix +++ b/modules/wm/hyprland/options.nix @@ -3,7 +3,7 @@ config, ... }: let - inherit (lib) mkOption types mkIf trivial strings lists; + inherit (lib) mkOption types mkIf recursiveUpdate trivial strings lists; inherit (builtins) concatStringsSep elem genList elemAt; inherit (trivial) boolToString; inherit (strings) floatToString; @@ -58,10 +58,22 @@ fontWeight = types.enum ["thin" "ultralight" "light" "semilight" "book" "normal" "medium" "semibold" "bold" "ultrabold" "heavy" "ultraheavy"]; in { options.horseman.wm.hyprland.config = { - execOnce = mkOption {type = types.listOf types.str;}; - env = mkOption {type = types.listOf types.str;}; - windowrules = mkOption {type = types.listOf types.str;}; - workspaces = mkOption {type = types.listOf types.str;}; + execOnce = mkOption { + type = types.listOf types.str; + default = []; + }; + env = mkOption { + type = types.listOf types.str; + default = []; + }; + windowrules = mkOption { + type = types.listOf types.str; + default = []; + }; + workspaces = mkOption { + type = types.listOf types.str; + default = []; + }; general = { borderSize = mkOption { type = types.int; @@ -1222,6 +1234,18 @@ in { }; waybar = { + layout = { + horizontal = { + left = mkOption {type = types.listOf types.str;}; + center = mkOption {type = types.listOf types.str;}; + right = mkOption {type = types.listOf types.str;}; + }; + vertical = { + left = mkOption {type = types.listOf types.str;}; + center = mkOption {type = types.listOf types.str;}; + right = mkOption {type = types.listOf types.str;}; + }; + }; formats = { horizontal = mkOption { type = types.attrs; @@ -1711,52 +1735,52 @@ in { ); in { topBar = + recursiveUpdate { layer = "top"; position = "top"; output = outputMap "top"; - modules-left = ["group/power"]; - modules-center = ["hyprland/workspaces"]; - modules-right = ["network" "pulseaudio" "memory" "cpu" "clock"]; - } - // cfg.config.waybar.modules // cfg.config.waybar.formats.horizontal; + modules-left = cfg.config.waybar.layout.horizontal.left; + modules-center = cfg.config.waybar.layout.horizontal.center; + modules-right = cfg.config.waybar.layout.horizontal.right; + } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal); bottomBar = + recursiveUpdate { layer = "top"; position = "bottom"; output = outputMap "bottom"; - modules-left = ["group/power"]; - modules-center = ["hyprland/workspaces"]; - modules-right = ["network" "pulseaudio" "memory" "cpu" "clock"]; - } - // cfg.config.waybar.modules // cfg.config.waybar.formats.horizontal; + modules-left = cfg.config.waybar.layout.horizontal.left; + modules-center = cfg.config.waybar.layout.horizontal.center; + modules-right = cfg.config.waybar.layout.horizontal.right; + } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal); rightBar = + recursiveUpdate { layer = "top"; position = "right"; output = outputMap "right"; - modules-left = ["group/power"]; - modules-center = ["hyprland/workspaces"]; - modules-right = ["battery" "clock"]; - } - // cfg.config.waybar.modules // cfg.config.waybar.formats.vertical; + modules-left = cfg.config.waybar.layout.vertical.left; + modules-center = cfg.config.waybar.layout.vertical.center; + modules-right = cfg.config.waybar.layout.vertical.right; + } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical); leftBar = + recursiveUpdate { layer = "top"; position = "left"; output = outputMap "left"; - modules-left = ["group/power"]; - modules-center = ["hyprland/workspaces"]; - modules-right = ["battery" "clock"]; - } - // cfg.config.waybar.modules // cfg.config.waybar.formats.vertical; + modules-left = cfg.config.waybar.layout.vertical.left; + modules-center = cfg.config.waybar.layout.vertical.center; + modules-right = cfg.config.waybar.layout.vertical.right; + } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical); }; }; xdg.configFile."waybar/style.css".source = ./config/waybar/style.css; diff --git a/modules/wm/hyprland/waybar.nix b/modules/wm/hyprland/waybar.nix new file mode 100644 index 0000000..f84d10f --- /dev/null +++ b/modules/wm/hyprland/waybar.nix @@ -0,0 +1,157 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf; + cfg = config.horseman.wm.hyprland; +in { + config = mkIf cfg.enable { + horseman.wm.hyprland.config = { + waybar = { + layout = { + vertical = { + left = ["group/power"]; + center = ["hyprland/workspaces"]; + right = ["network" "pulseaudio" "memory" "cpu" "battery" "clock"]; + }; + horizontal = { + left = ["group/power"]; + center = ["hyprland/workspaces"]; + right = ["network" "pulseaudio" "memory" "cpu" "battery" "clock"]; + }; + }; + + formats = { + horizontal = { + "clock" = { + format = "󰥔 {:%H:%M:%S}"; + format-alt = " {:%a %d %b %Y}"; + }; + "cpu" = { + format = " {usage}%"; + }; + "memory" = { + format = " {percentage}%"; + }; + "pulseaudio" = { + format = " {volume}"; + }; + "network" = { + format = "{ipaddr}"; + format-ethernet = " {ipaddr}"; + format-disconnected = "󰣽 Disconnected"; + format-wifi = "󰤨 {essid}"; + }; + "group/power" = { + orientation = "horizontal"; + }; + }; + vertical = { + "clock" = { + format = "{:%H\n%M\n%S}"; + format-alt = "{:%d\n%m\n%y}"; + }; + "cpu" = { + format = " {usage}"; + }; + "memory" = { + format = " {percentage}"; + }; + "pulseaudio" = { + format = " {volume}"; + }; + "network" = { + format = "󰤨"; + format-ethernet = ""; + format-disconnected = "󰣽"; + format-disabled = "󰣽"; + format-wifi = "󰤨"; + }; + "group/power" = { + orientation = "vertical"; + }; + }; + }; + modules = { + "clock" = { + interval = 1; + tooltip = false; + }; + + "cpu" = { + interval = 3; + on-click = "kitty btop &"; + }; + + "memory" = { + interval = 3; + on-click = "kitty btop &"; + }; + + "pulseaudio" = { + on-click = "kitty pulsemixer &"; + }; + + "network" = { + interval = 3; + + tooltip-format = " {bandwidthDownBits} , {bandwidthDownBits} "; + tooltip-format-wifi = "{essid}:  {bandwidthDownBits} , {bandwidthDownBits} "; + }; + + "battery" = { + interval = 3; + # TODO This needs to be fixed + }; + + "hyprland/workspaces" = { + format = "{icon}"; + format-icons = { + "active" = ""; + "default" = ""; + "empty" = ""; + }; + persistent-workspaces = { + "*" = [1 2 3 4 5 6 7 8 9 10]; + }; + }; + + "group/power" = { + drawer = {}; + modules = [ + "custom/lock" + "custom/power" + "custom/reboot" + "idle_inhibitor" + ]; + }; + + "custom/lock" = { + format = " "; + tooltip = false; + on-click = "hyprlock"; + }; + "custom/reboot" = { + format = " "; + tooltip = false; + on-click = "reboot"; + }; + "custom/power" = { + format = " "; + tooltip = false; + on-click = "shutdown now"; + }; + "idle_inhibitor" = { + tooltip = false; + format = "{icon}"; + format-icons = { + deactivated = "󰒲 "; + activated = "󰒳 "; + }; + }; + }; + }; + }; + }; +}