131 lines
3.1 KiB
Nix

{ config, pkgs, lib, inputs, ... }:
with lib;
let
cfg = config.settings.desktop-environments.niri.waybar;
in {
options = {
settings.desktop-environments.niri.waybar.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable waybar configuration for configuration
'';
default = config.settings.desktop-environments.niri.enable;
};
};
config = mkIf cfg.enable {
stylix.targets.waybar.addCss = false;
programs.waybar = {
enable = true;
systemd.enable = true;
};
programs.waybar.settings = {
main = {
layer = "top";
position = "top";
modules-left = [
"niri/workspaces"
];
modules-center = [
"clock"
];
modules-right = [
"tray"
"network"
"pulseaudio"
"battery"
];
"clock" = {
"format" = "{:%H:%M - %d}";
};
"tray" = {
"spacing" = 8;
};
"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;
};
};
};
programs.waybar.style = /* css */''
#workspaces,#window,#clock,#battery,#tray,#pulseaudio,#network {
background-color: @base01;
border-radius: 10px;
padding: 0px 10px;
margin-top: 3px;
margin-left: 5px;
margin-right: 5px;
}
#workspaces button {
padding: 0 5px;
background: transparent;
color: @base05;
border-bottom: 2px solid transparent;
border-radius: 0;
}
window#waybar>box {
padding: 0 5px;
}
window#waybar {
background: transparent;
}
#workspaces button.active {
border-bottom: 2px solid @base05;
}
#network {
padding: 0 5px;
}
'';
};
}