Files
nix-config/modules/programs/waybar.nix
T

228 lines
6.7 KiB
Nix
Raw Normal View History

{ self, ... }:
2026-03-22 21:30:03 +05:00
{
flake.nixosModules.waybar = { pkgs, ... }:
{
environment.systemPackages = with pkgs; [
bluetui
wiremix
];
fonts.packages = with pkgs; [
font-awesome
];
2026-04-15 19:15:43 +05:00
home-manager.users.${self.user}.imports = [
2026-03-22 21:30:03 +05:00
{
2026-04-30 13:40:52 +05:00
home.activation = {
waybar = ''
${pkgs.procps}/bin/pkill -SIGUSR2 waybar
'';
};
2026-03-22 21:30:03 +05:00
programs.waybar = {
enable = true;
settings = {
bar = {
height = 24;
2026-04-30 12:59:31 +05:00
# width = 24;
layer = "top";
2026-04-12 10:04:23 +05:00
spacing = 0;
2026-04-30 12:59:31 +05:00
position = "bottom";
modules-left = [ "niri/workspaces" "niri/language" ];
2026-03-22 21:30:03 +05:00
modules-center = [ "niri/window" ];
2026-04-12 10:04:23 +05:00
modules-right = [ "tray" "wireplumber" "network" "bluetooth" "backlight" "clock" "battery" "battery#bat2" "custom/power" ];
2026-03-22 21:30:03 +05:00
"niri/workspaces" = {
"disable-scroll" = true;
"all-outputs" = true;
"warp-on-scroll" = false;
"format" = "{icon}";
};
"tray" = {
"spacing" = 10;
};
2026-04-30 12:59:31 +05:00
"niri/language" = {
"format" = "{short}";
};
2026-03-22 21:30:03 +05:00
"clock" = {
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
"backlight" = {
2026-04-12 10:04:23 +05:00
"format" = "{icon} {percent}%";
2026-03-22 21:30:03 +05:00
"format-icons" = ["" "" "" "" "" "" "" "" ""];
};
"battery" = {
"bat" = "BAT0";
"states" = {
"good" = 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-full" = "{icon} {capacity}%";
2026-04-30 12:59:31 +05:00
"format-charging" = " {capacity}%";
2026-03-22 21:30:03 +05:00
"format-icons" = ["" "" "" "" ""];
};
"battery#bat2" = {
"bat" = "BAT1";
"states" = {
"good" = 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-full" = "{icon} {capacity}%";
"format-charging" = " {capacity}%";
"format-plugged" = " {capacity}%";
"format-icons" = ["" "" "" "" ""];
};
"bluetooth" = {
"format" = "";
"format-off" = "󰂲";
"on-click" = "kitty --hold sh -c 'bluetui'";
};
"network" = {
2026-03-26 20:26:24 +05:00
"format-wifi" = " {essid}";
2026-03-22 21:30:03 +05:00
"format-disconnected" = "󰖪";
"on-click" = "kitty --hold sh -c 'nmtui'";
};
"wireplumber" = {
2026-03-26 20:26:24 +05:00
"format" = "{icon} {volume}%";
"format-muted" = "󰖁";
2026-03-22 21:30:03 +05:00
"format-icons" = {
"default" = ["" "" ""];
};
"on-click" = "kitty --hold sh -c 'wiremix'";
};
"custom/power" = {
2026-03-26 20:26:24 +05:00
"format" = "";
2026-03-22 21:30:03 +05:00
"on-click" = "systemctl suspend";
# "shutdown" = "shutdown";
# "reboot" = "reboot";
# "suspend" = "systemctl suspend";
# "hibernate" = "systemctl hibernate"
};
};
};
style = /*css*/ ''
2026-04-30 12:59:31 +05:00
/* @import "/home/${self.user}/.cache/wal/colors-waybar.css"; */
@import "/home/${self.user}/.config/waybar/colors.css";
2026-04-15 19:15:43 +05:00
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: ${self.font.propo}, JetBrainsMonoNerdFontPropo;
font-size: 13pt;
transition-property: background-color;
transition-duration: .25s;
}
window#waybar {
background-color: @background;
2026-04-30 12:59:31 +05:00
color: @on_surface;
2026-04-15 19:15:43 +05:00
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: ${self.border.small};
margin: 2 2;
}
#workspaces button {
2026-04-30 12:59:31 +05:00
/* padding: 5 0; */
padding: 0 5;
2026-04-15 19:15:43 +05:00
background-color: transparent;
}
#workspaces button:hover {
2026-04-30 12:59:31 +05:00
background: @primary_container;
2026-04-15 19:15:43 +05:00
}
#workspaces button.focused, #workspaces button.active {
2026-04-30 12:59:31 +05:00
background-color: @source_color;
2026-04-15 19:15:43 +05:00
color: @background;
/* box-shadow: inset 0 -3px @color3; */
}
#workspaces button.urgent {
2026-04-30 12:59:31 +05:00
background-color: @secondary;
2026-04-15 19:15:43 +05:00
}
#language,
#tray,
#bluetooth,
#wireplumber,
#network,
#backlight,
#clock,
#battery,
#custom-power {
margin: 2 2;
padding: 0 10;
2026-04-30 12:59:31 +05:00
/* padding: 10 0; */
color: @on_surface;
2026-04-15 19:15:43 +05:00
border-radius: ${self.border.small};
}
#battery,
#bluetooth,
#wireplumber,
#custom-power,
#network {
2026-04-30 12:59:31 +05:00
background-color: @primary_container;
2026-04-15 19:15:43 +05:00
color: @background;
}
/* top right bottom left */
#battery {
padding: 0 5 0 10;
2026-04-30 12:59:31 +05:00
/* padding: 5 0 10 0; */
2026-04-15 19:15:43 +05:00
border-radius: ${self.border.small} 0 0 ${self.border.small};
margin: 2 0 2 2;
2026-04-30 12:59:31 +05:00
/* margin: 2 2 0 2; */
2026-04-15 19:15:43 +05:00
}
#battery.bat2 {
padding: 0 10 0 5;
2026-04-30 12:59:31 +05:00
/* padding: 10 0 5 0; */
2026-04-15 19:15:43 +05:00
border-radius: 0 ${self.border.small} ${self.border.small} 0;
margin: 2 2 2 0;
2026-04-30 12:59:31 +05:00
/* margin: 0 2 2 2; */
2026-04-15 19:15:43 +05:00
}
#custom-power {
2026-04-30 12:59:31 +05:00
background-color: @source_color;
2026-04-15 19:15:43 +05:00
}
#bluetooth:hover,
#wireplumber:hover,
#network:hover,
#custom-power:hover {
2026-04-30 12:59:31 +05:00
background-color: @on_primary_container;
2026-04-15 19:15:43 +05:00
}
#window,
#workspaces {
2026-04-30 12:59:31 +05:00
margin: 0 4;
/* margin: 4 0; */
2026-04-15 19:15:43 +05:00
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
2026-03-22 21:30:03 +05:00
'';
};
}
];
};
}