feat: waybar displays

This commit is contained in:
Noa Aarts 2024-08-31 10:53:51 +02:00
parent 8f8dd0d21d
commit af46dcdf41
Signed by: noa
GPG key ID: 1850932741EFF672

View file

@ -41,75 +41,77 @@ in
../../common/colors.nix ../../common/colors.nix
]; ];
config = lib.mkIf cfg.enable config =
{ let
modules.waybar.enabled = ( displays_raw = config.modules.hyprland.displays;
let displays = map (display_raw: lib.builtins.head (lib.strings.splitString "," displays_raw)) displays_raw;
mods = config.modules.waybar.modules; in
allmodules = mods.left ++ mods.center ++ mods.right; lib.mkIf cfg.enable
namedmodules = builtins.map {
(n: { name = n; value = { enable = true; }; }) modules.waybar.enabled = (
allmodules; let
createmodules = builtins.listToAttrs namedmodules; mods = config.modules.waybar.modules;
in allmodules = mods.left ++ mods.center ++ mods.right;
createmodules namedmodules = builtins.map
); (n: { name = n; value = { enable = true; }; })
allmodules;
createmodules = builtins.listToAttrs namedmodules;
in
createmodules
);
home.packages = with pkgs; home.packages = with pkgs;
[ [
font-awesome font-awesome
]; ];
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = cfg.package; package = cfg.package;
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";
position = "top"; position = "top";
height = 39; height = 39;
margin-top = 8; margin-top = 8;
margin-left = 10; margin-left = 10;
margin-right = 10; margin-right = 10;
output = [ output = displays;
"DP-3" modules-left = cfg.modules.left;
"DP-2" modules-center = cfg.modules.center;
]; modules-right = cfg.modules.right;
modules-left = cfg.modules.left; };
modules-center = cfg.modules.center;
modules-right = cfg.modules.right;
}; };
style = ''
* {
font-family: "Maple Mono NF";
font-size: 14px;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -1px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
border-radius: 999px;
}
tooltip {
background-color: #${config.colorScheme.palette.base00};
border: 1px solid;
border-color: #${config.colorScheme.palette.taskbarText};
border-radius: 10px;
color: #${config.colorScheme.palette.base05};
}
tooltip label {
padding: 5px;
}
'';
}; };
style = '' }
* {
font-family: "Maple Mono NF";
font-size: 14px;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -1px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
border-radius: 999px;
}
tooltip {
background-color: #${config.colorScheme.palette.base00};
border: 1px solid;
border-color: #${config.colorScheme.palette.taskbarText};
border-radius: 10px;
color: #${config.colorScheme.palette.base05};
}
tooltip label {
padding: 5px;
}
'';
};
}
; ;
} }