Files
nixos-blueprint/modules/home/desktop/niri/programs/waybar/default.nix
2025-07-01 10:30:28 +03:00

381 lines
8.7 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
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 = 33 + 3;
margin-right = 33 + 3;
margin-bottom = 3;
reload_style_on_change = true;
modules-left = [
"custom/launcher"
"niri/language"
"niri/workspaces"
"wlr/taskbar"
"privacy"
];
modules-center = ["clock"];
modules-right = [
"wireplumber"
(ifLaptop "group/laptop")
"tray"
"idle_inhibitor"
"custom/notification"
];
"niri/workspaces" = {
format = "{index}";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
general = "󰘧";
web = "󰖟";
chat = "󰻞";
code = "󰅩";
uni = "󱆀";
games = "󰺶";
system = "󰢻";
media = "󱜐";
tray = "󱊖";
};
};
"niri/language" = {
format = "{}";
format-en = "🇺🇸";
format-uk = "🇺🇦";
};
"custom/separator" = {
format = "󰝠";
interval = "once";
tooltip = false;
};
"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 = "{:%B %d - %R - %A}";
tooltip = false;
# tooltip-format = "{%y.%m.%d - %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;
}
.modules-center,
.mpris.stopped {
background-color: transparent;
}
window#waybar {
background: @base00;
border-radius: 24px;
}
.modules-left,
.modules-center,
.modules-right {
/* border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
border-top-left-radius: 0px;
border-top-right-radius: 0px; */
background-color: @base00;
border-radius: 24px;
color: @base05;
/* margin: 1px; for the window#waybar border */
}
tooltip {
background: @base01;
border: 1px solid @base0D;
border-radius: 24px;
}
tooltip label {
color: @base05;
}
button {
box-shadow: inset 0 -3px transparent;
border-radius: 16px;
}
button:hover {
background: inherit;
box-shadow: inset 0 -3px transparent;
}
#mode {
background-color: rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -3px @base05;
}
#backlight,
#battery,
#clock,
#custom-launcher,
#custom-notification,
#custom-separator,
#idle_inhibitor,
#language,
#power-profiles-daemon,
#privacy,
#privacy-item,
#taskbar,
#tray,
#wireplumber,
#workspaces button,
#workspaces {
border-radius: 24px;
background-color: @base01;
margin: 3px 3px 3px 0;
padding: 0 6px;
}
/* left modules */
#custom-launcher,
/* #language, */
#clock,
#wireplumber {
margin: 3px;
}
#taskbar button {
padding: 0 3px;
margin: 3px;
}
#workspaces button {
padding: 0 5px;
margin: 3px;
}
#tray button {
padding: 0 6px;
margin: 3px;
}
#privacy-item {
padding: 0 4px;
}
#backlight,
#battery,
#custom-notification,
#idle_inhibitor,
#wireplumber {
padding: 0 14px 0 10px;
}
#custom-launcher,
#power-profiles-daemon {
padding: 0 17px 0 8px;
}
#privacy,
#taskbar,
#workspaces {
padding: 0;
}
#taskbar.empty,
window#empty {
padding: 0;
margin: 0;
background-color: transparent;
}
#taskbar button:hover {
background-color: @base0D;
}
#workspaces button.active {
color: @base00;
background-color: @base0D;
}
#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;
}
#power-profiles-daemon.performance {
background-color: @base0D;
color: @base00;
}
#power-profiles-daemon.balanced {
color: @base05;
}
#power-profiles-daemon.power-saver {
background-color: @base0A;
color: @base00;
}
label:focus {
background-color: #000000;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: @base08;
}
#privacy-item.screenshare {
background-color: @base0C;
color: @base00;
margin: 3px 0 3px 3px;
}
#privacy-item.audio-in {
background-color: @base0E;
color: @base00;
margin: 3px;
}
'';
}