Waybar finalized

This commit is contained in:
KoenDR06 2025-08-29 22:35:17 +02:00
parent 5e920cd892
commit 737c3b1de3
4 changed files with 257 additions and 220 deletions

View file

@ -51,108 +51,74 @@
@define-color crust #181926; @define-color crust #181926;
@define-color crust-rgb rgb(24, 25, 38); @define-color crust-rgb rgb(24, 25, 38);
* { #waybar {
font-size: 15px; background: transparent;
font-family: "Hasklug Nerd Font"; font-family: "Hasklug Nerd Font";
} }
window#waybar{
all: unset;
}
.modules-left, .modules-center, .modules-right { .modules-left, .modules-center, .modules-right {
border: 2px solid @lavender;
border-radius: 10px;
margin: 5px; margin: 5px;
padding: 7px; background: @base;
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;
}
tooltip {
background:@surface0;
color: @text; color: @text;
border: 2px solid @lavender;
border-radius: 10px;
} }
#clock, #cpu, #memory { #power {
transition: all .3s ease; padding-left: 10px;
} }
.top #clock, .top #cpu, .top #memory { #power * {
padding: 0px 5px; color: @lavender;
transition: 0.2s color ease;
font-size: 26px;
} }
.right #clock, .right #cpu, .right #memory { #power *:hover {
padding: 5px 0px; color: @red;
} }
.top .modules-right * { #workspaces .empty {
margin-left: 5px; color: @surface0;
} }
#workspaces * {
color: inherit;
padding: 0px 2px;
margin: 0px;
}
#workspaces .active {
color: @red;
font-size: 18px;
}
#clock { #clock {
color: @peach;
}
#battery {
color: @maroon; color: @maroon;
} }
#cpu { #cpu {
color: @yellow; color: @red;
} }
#memory { #memory {
color: @green; color: @mauve;
} }
#pulseaudio { #pulseaudio {
color: @teal; color: @blue;
} }
#network { #network {
color: @sapphire; 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;
} }
#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;
}
.top #power .modules {
margin-right: 5px;
}
.right #power .modules {
margin-bottom: 5px;
}

View file

@ -6,12 +6,12 @@
}: let }: let
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
cfg = config.horseman.wm.hyprland; cfg = config.horseman.wm.hyprland;
homeCfg = config.horseman;
in { in {
imports = [ imports = [
./options.nix ./options.nix
./keybindings.nix ./keybindings.nix
./animations.nix ./animations.nix
./waybar.nix
]; ];
options = { options = {
@ -66,9 +66,6 @@ in {
"suppressevent maximize, class:.*" "suppressevent maximize, class:.*"
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" "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$" "float, initialTitle:^Picture-in-Picture$"
"center, initialTitle:^Picture-in-Picture$" "center, initialTitle:^Picture-in-Picture$"
"size 33% 33%, initialTitle:^Picture-in-Picture$" "size 33% 33%, initialTitle:^Picture-in-Picture$"
@ -77,10 +74,6 @@ in {
"float, initialTitle:GLFW" "float, initialTitle:GLFW"
]; ];
workspaces = [
"w[tv1], gapsout:0, gapsin:0"
];
general = { general = {
gapsIn = 5; gapsIn = 5;
gapsOut = 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 = '' services.logind.extraConfig = ''

View file

@ -3,7 +3,7 @@
config, config,
... ...
}: let }: 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 (builtins) concatStringsSep elem genList elemAt;
inherit (trivial) boolToString; inherit (trivial) boolToString;
inherit (strings) floatToString; inherit (strings) floatToString;
@ -58,10 +58,22 @@
fontWeight = types.enum ["thin" "ultralight" "light" "semilight" "book" "normal" "medium" "semibold" "bold" "ultrabold" "heavy" "ultraheavy"]; fontWeight = types.enum ["thin" "ultralight" "light" "semilight" "book" "normal" "medium" "semibold" "bold" "ultrabold" "heavy" "ultraheavy"];
in { in {
options.horseman.wm.hyprland.config = { options.horseman.wm.hyprland.config = {
execOnce = mkOption {type = types.listOf types.str;}; execOnce = mkOption {
env = mkOption {type = types.listOf types.str;}; type = types.listOf types.str;
windowrules = mkOption {type = types.listOf types.str;}; default = [];
workspaces = mkOption {type = types.listOf types.str;}; };
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 = { general = {
borderSize = mkOption { borderSize = mkOption {
type = types.int; type = types.int;
@ -1222,6 +1234,18 @@ in {
}; };
waybar = { 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 = { formats = {
horizontal = mkOption { horizontal = mkOption {
type = types.attrs; type = types.attrs;
@ -1711,52 +1735,52 @@ in {
); );
in { in {
topBar = topBar =
recursiveUpdate
{ {
layer = "top"; layer = "top";
position = "top"; position = "top";
output = outputMap "top"; output = outputMap "top";
modules-left = ["group/power"]; modules-left = cfg.config.waybar.layout.horizontal.left;
modules-center = ["hyprland/workspaces"]; modules-center = cfg.config.waybar.layout.horizontal.center;
modules-right = ["network" "pulseaudio" "memory" "cpu" "clock"]; modules-right = cfg.config.waybar.layout.horizontal.right;
} } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal);
// cfg.config.waybar.modules // cfg.config.waybar.formats.horizontal;
bottomBar = bottomBar =
recursiveUpdate
{ {
layer = "top"; layer = "top";
position = "bottom"; position = "bottom";
output = outputMap "bottom"; output = outputMap "bottom";
modules-left = ["group/power"]; modules-left = cfg.config.waybar.layout.horizontal.left;
modules-center = ["hyprland/workspaces"]; modules-center = cfg.config.waybar.layout.horizontal.center;
modules-right = ["network" "pulseaudio" "memory" "cpu" "clock"]; modules-right = cfg.config.waybar.layout.horizontal.right;
} } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal);
// cfg.config.waybar.modules // cfg.config.waybar.formats.horizontal;
rightBar = rightBar =
recursiveUpdate
{ {
layer = "top"; layer = "top";
position = "right"; position = "right";
output = outputMap "right"; output = outputMap "right";
modules-left = ["group/power"]; modules-left = cfg.config.waybar.layout.vertical.left;
modules-center = ["hyprland/workspaces"]; modules-center = cfg.config.waybar.layout.vertical.center;
modules-right = ["battery" "clock"]; modules-right = cfg.config.waybar.layout.vertical.right;
} } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical);
// cfg.config.waybar.modules // cfg.config.waybar.formats.vertical;
leftBar = leftBar =
recursiveUpdate
{ {
layer = "top"; layer = "top";
position = "left"; position = "left";
output = outputMap "left"; output = outputMap "left";
modules-left = ["group/power"]; modules-left = cfg.config.waybar.layout.vertical.left;
modules-center = ["hyprland/workspaces"]; modules-center = cfg.config.waybar.layout.vertical.center;
modules-right = ["battery" "clock"]; modules-right = cfg.config.waybar.layout.vertical.right;
} } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical);
// cfg.config.waybar.modules // cfg.config.waybar.formats.vertical;
}; };
}; };
xdg.configFile."waybar/style.css".source = ./config/waybar/style.css; xdg.configFile."waybar/style.css".source = ./config/waybar/style.css;

View file

@ -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 = "󰒳 ";
};
};
};
};
};
};
}