1
0
forked from extern/nix-config

waybar: Move modules to separate attribute set

Makes it possible to use the same modules in multiple bars.
This commit is contained in:
Donovan Glover 2023-06-29 09:58:23 -04:00
parent bc6f862279
commit c143c065a2
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -6,26 +6,7 @@ let
position = "top";
opposite = builtins.replaceStrings ["left" "right" "top" "bottom"] ["right" "left" "bottom" "top"] position;
isVertical = position == "left" || position == "right";
in
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = position;
width = if isVertical then 45 else null;
height = if isVertical then null else 45;
spacing = 8;
autohide = true;
exclusive = false;
autohide-starthidden = true;
modules-left = if icons then [ "wlr/taskbar" ] else [ "wlr/workspaces" "custom/new-workspace" ];
modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ];
modules = {
tray = {
icon-size = 24;
spacing = 8;
@ -102,6 +83,26 @@ in
tooltip = false;
};
};
in
{
programs.waybar = {
enable = true;
settings = {
mainBar = modules // {
layer = "top";
position = position;
width = if isVertical then 45 else null;
height = if isVertical then null else 45;
spacing = 8;
autohide = true;
exclusive = false;
autohide-starthidden = true;
modules-left = if icons then [ "wlr/taskbar" ] else [ "wlr/workspaces" "custom/new-workspace" ];
modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ];
};
};
style = with config.lib.stylix.colors; lib.mkForce /* css */ ''