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

112 lines
2.9 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ 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"
"idle_inhibitor"
"sway/language"
"network"
"custom/wireguard"
"bluetooth"
"pulseaudio"
];
};
"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" = {
# this one gobbles all trailing ascii whitespace for some reason. use this unicode instead
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 = "| w: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";
};
};
};
}