nixos_config/home/modules/programs/waybar/default.nix
2026-05-29 14:25:51 +02:00

111 lines
2.8 KiB
Nix

{ pkgs, repoRoot, ... }:
let
commands = import ../../../../lib/commands.nix { inherit pkgs; };
inherit (commands) uwsm term;
height = 20;
wireguardToggle = "${pkgs.xonsh}/bin/xonsh ${repoRoot}/util/toggle_wg.xsh";
in
{
imports = [
./style.nix
];
programs.waybar = {
enable = true;
systemd = {
enable = true;
target = "graphical-session.target";
};
settings.mainBar = {
layer = "bottom";
position = "top";
height = height;
spacing = 0;
modules-left = [ "sway/workspaces" ];
modules-center = [ "sway/window" ];
modules-right = [
"tray"
"battery"
"group/system"
];
"group/system" = {
"orientation" = "inherit";
"drawer"= {
"transition-duration" = 100;
"transition-left-to-right" = false;
};
"modules" = [
"clock"
"sway/language"
"network"
"custom/wireguard"
"bluetooth"
"pulseaudio"
"idle_inhibitor"
];
};
"sway/workspaces" = {
on-click = "activate";
sort-by-number = true;
format = "{value}";
};
"sway/window".max-length = 64;
tray = {
icon-size = height;
spacing = 8;
};
idle_inhibitor = {
format = "| {icon} ";
start-activated = true;
format-icons = {
activated = "🫨";
deactivated = "😴";
};
};
"sway/language" = {
format = "| {short} ";
tooltip-format = "{long}";
};
clock = {
interval = 60;
tooltip = true;
format = "| {:%H:%M} ";
tooltip-format = "{:%Y-%m-%d}";
};
battery = {
interval = 60;
format = "| {capacity}% ";
format-charging = "| ch:{capacity}%";
};
network = {
tooltip-format = "{ifname} = {ipaddr}/{cidr}";
format-wifi = "| w:{essid} ";
format-ethernet = "| e:{ipaddr} ";
format-linked = "| l:{ipaddr} ";
format-disconnected = "| d ";
interval = 15;
on-click = "${uwsm} ${term} -e nmtui";
};
"custom/wireguard" = {
exec = "${wireguardToggle} status";
on-click = "${wireguardToggle} toggle";
format = "| wg:{text} ";
interval = 15;
tooltip = false;
};
bluetooth = {
format = "| bt:{num_connections} ";
format-disabled = "";
format-no-controller = "";
interval = 15;
on-click = "${uwsm} ${term} -e bluetui";
};
pulseaudio = {
format = "| snd{volume}% ";
format-muted = "| snd:- ";
format-bluetooth = "| snd(bt):{volume}% ";
on-click = "${uwsm} pavucontrol";
};
};
};
}