nix/modules/home/desktop-environments/hyprland/waybar.nix

158 lines
3.9 KiB
Nix

{ pkgs, lib, config, ... }:
{
programs.waybar = {
enable = config.settings.desktop-environments.hyprland.enable;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 32;
modules-left = [
"hyprland/workspaces"
"hyprland/window"
];
modules-center = [
"clock"
];
modules-right = [
"tray"
"network"
"pulseaudio"
"battery"
];
# Modules left
"hyprland/workspaces" = {
"format" = "{icon}";
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
"on-click" = "activate";
"persistent-workspaces" = lib.mkMerge [{
}
(lib.mkIf (config.host == "xv-laptop") {
"DP-10" = [ 1 2 3 4 ];
"DP-9" = [ 5 6 7 ];
"eDP-1" = [ 8 9 10 ];
})
(lib.mkIf (config.host == "xv-desktop") {
"DP-1" = [ 1 2 3 4 5 ];
"HDMI-A-1" = [ 6 7 8 9 10 ];
})];
"format-icons" = {
"default" = "";
"empty" = "";
"active" = "";
};
};
"hyprland/window" = {
"max-length" = 200;
"seperate-outputs" = true;
};
# Modules middle
"clock" = {
"interval" = 1;
"format" = "{:%a %d %b | %H:%M:%S}";
};
# Modules right
"tray" = {
"spacing" = 10;
"icon-size" = 21;
};
"battery" = {
"bat" = "BAT1";
"interval" = 60;
"states" = {
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-icons" = [ "" "" "" "" "" ];
};
"pulseaudio" = {
"format" = "{icon} {volume}%";
"format-bluetooth" = "{volume}% {icon}";
"format-muted" = "󰝟";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = ["" ""];
};
"scroll-step" = 1;
"on-click" = "pavucontrol";
"ignored-sinks" = ["Easy Effects Sink"];
};
"network" = {
"interface" = "wlan0";
"format" = "{ifname}";
"format-wifi" = " {essid}";
"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;
};
};
};
style = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: DejaVuSans, FontAwesome6Free;
}
#workspaces,#window,#clock,#battery,#tray,#pulseaudio,#network {
background-color: @theme_bg_color;
border-radius: 50px;
padding: 0px 15px;
margin: 5px 3px 0px 3px;
}
#workspaces {
margin-left: 10px;
padding: 0px 5px;
font-size: 15px;
}
window#waybar.empty #window {
background-color: transparent;
}
window#waybar {
background-color: transparent;
font-size: 12px;
}
#workspaces button.active {
color: @theme_text_color;
}
#workspaces button {
color: shade(@theme_text_color, 0.5);
padding: 2px 5px;
}
#battery {
margin-right: 10px;
}
#battery.warning {
background-color: #ff8000;
}
#battery.critical {
background-color: #f00;
}
'';
};
}