Files
nixos-blueprint/modules/home/desktop/niri/programs/waybar/default.nix
2025-07-07 13:09:26 +03:00

368 lines
7.7 KiB
Nix

{
colors,
config,
getExe,
ifLaptop,
launcher,
pkgs,
...
}: {
enable = true;
systemd = {
enable = true;
target = "graphical-session.target";
};
settings.bar-0 = {
# layer = "top";
position = "bottom";
height = 40;
spacing = 0;
# margin-left = 3;
# margin-right = 3;
margin-left = 43 + 3;
margin-right = 43 + 3;
margin-bottom = 3;
reload_style_on_change = true;
modules-left = [
"custom/launcher"
"clock"
"wlr/taskbar"
"privacy"
];
modules-center = [
# "clock"
"niri/language"
"niri/workspaces"
"idle_inhibitor"
];
modules-right = [
"wireplumber"
(ifLaptop "group/laptop")
"tray"
"custom/notification"
];
"niri/workspaces" = {
format = "{index}";
};
"niri/language" = {
format = "{}";
format-en = "🇺🇸";
format-uk = "🇺🇦";
};
"group/laptop" = {
orientation = "inherit";
modules = [
"backlight"
"battery"
"power-profiles-daemon"
];
};
"backlight" = {
format = "{percent}% {icon}";
format-icons = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "󰅶";
deactivated = "󰾪";
};
};
"tray" = {
icon-size = 20;
spacing = 6;
};
"clock" = {
interval = 1;
format = "{:%R}";
tooltip = true;
tooltip-format = "{:%B %d, %A}";
};
battery = {
states = {
good = 95;
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-full = "{capacity}% 󱟢";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-alt = "{icon} {time}";
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
mpris = {
format = "{player_icon} {dynamic}";
format-paused = "{status_icon} <i>{dynamic}</i>";
playing-len = 30;
playing-paused = 30;
player-icons = {
default = "";
mpv = "🎵";
};
status-icons = {paused = "";};
};
"upower" = {
icon-size = 16;
format = "{percentage}";
hide-if-empty = true;
tooltip = true;
tooltip-spacing = 20;
};
"power-profiles-daemon" = {
format = "{icon}";
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
format-icons = {
default = "󱡮";
performance = "󱡮";
balanced = "";
power-saver = "";
};
};
"wireplumber" = {
scroll-step = 3;
format = "{volume}% {icon}";
format-muted = "󰖁";
format-icons = ["󰕿" "󰖀" "󰕾"];
on-click = getExe pkgs.pwvucontrol;
on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle";
};
"custom/launcher" = {
format = "";
on-click = launcher;
tooltip = false;
};
"custom/notification" = {
tooltip = false;
format = "{icon}";
format-icons = {
notification = "󱅫";
none = "󰂚";
dnd-notification = "󰂛";
dnd-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
};
"privacy" = {
icon-spacing = 0;
icon-size = 18;
transition-duration = 250;
screenshare = {
type = "screenshare";
tooltip = true;
tooltip-icon-size = 24;
};
audio-in = {
type = "audio-in";
tooltip = true;
tooltip-icon-size = 24;
};
};
"wlr/taskbar" = {
format = "{icon}";
icon-size = 20;
icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}";
tooltip-format = "{title}";
on-click = "activate";
};
};
style = ''
@define-color base00 #${colors.base00};
@define-color base01 #${colors.base01};
@define-color base02 #${colors.base02};
@define-color base03 #${colors.base03};
@define-color base04 #${colors.base04};
@define-color base05 #${colors.base05};
@define-color base06 #${colors.base06};
@define-color base07 #${colors.base07};
@define-color base08 #${colors.base08};
@define-color base09 #${colors.base09};
@define-color base0A #${colors.base0A};
@define-color base0B #${colors.base0B};
@define-color base0C #${colors.base0C};
@define-color base0D #${colors.base0D};
@define-color base0E #${colors.base0E};
@define-color base0F #${colors.base0F};
* {
font-family: ${config.stylix.fonts.sansSerif.name}, FontAwesome;
font-weight: 500;
font-size: 18px;
}
window#waybar {
background: @base00;
border-radius: 9px;
}
.modules-left,
.modules-center,
.modules-right {
background-color: @base00;
border-radius: 9px;
color: @base05;
}
tooltip {
background: @base01;
border: 1px solid @base0D;
border-radius: 12px;
}
tooltip label {
color: @base05;
}
button {
box-shadow: inset 0 -3px transparent;
border-radius: 3px;
}
button:hover {
background: inherit;
box-shadow: inset 0 -3px transparent;
}
#backlight,
#battery,
#clock,
#custom-launcher,
#custom-notification,
#idle_inhibitor,
#language,
#power-profiles-daemon,
#privacy,
#privacy-item,
#taskbar,
#tray,
#wireplumber,
#workspaces button,
#workspaces {
border-radius: 6px;
background-color: @base01;
margin: 3px 3px 3px 0;
padding: 0 6px;
}
/* #clock, */
#custom-launcher,
#language,
#wireplumber {
margin: 3px;
}
#backlight,
#battery,
#custom-notification,
#idle_inhibitor,
#wireplumber {
padding: 0 15px 0 10px;
}
#custom-launcher,
#power-profiles-daemon {
padding: 0 17px 0 8px;
}
#privacy,
#taskbar,
#workspaces {
padding: 0;
}
#privacy-item {
padding: 0 5px;
}
#taskbar button,
#tray button {
padding: 0 3px;
margin: 3px;
}
#workspaces button {
border-radius: 3px;
padding: 0 5px;
margin: 3px;
}
#battery.critical:not(.charging) {
background-color: @base09;
color: @base00;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#mode {
background-color: rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -3px @base05;
}
#power-profiles-daemon.balanced {
color: @base05;
}
#power-profiles-daemon.performance {
background-color: @base0D;
color: @base00;
}
#power-profiles-daemon.power-saver {
background-color: @base0A;
color: @base00;
}
#privacy-item.audio-in {
background-color: @base0E;
color: @base00;
margin: 3px;
}
#privacy-item.screenshare {
background-color: @base0C;
color: @base00;
margin: 3px 0 3px 3px;
}
#taskbar button:hover {
background-color: @base0D;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: @base08;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#workspaces button.active {
color: @base00;
background-color: @base0D;
}
label:focus {
background-color: #000000;
}
'';
}