nixos_config/home/modules/programs/waybar/default.nix

112 lines
2.8 KiB
Nix
Raw Normal View History

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