Files
nixos-blueprint/hosts/sarien/work_user/desktop/river/waybar.nix
unexplrd 2e6e28ef32 initial
2025-02-06 00:33:06 +02:00

419 lines
11 KiB
Nix

{
config,
lib,
pkgs,
...
}: {
options = {
waybar.enable =
lib.mkEnableOption "enable waybar";
};
config = lib.mkIf config.waybar.enable {
stylix.targets.waybar.enable = false;
programs.waybar = {
enable = true;
#package = pkgs.waybar-0.11.0";
systemd = {
enable = true;
target = "graphical-session.target";
};
settings = {
bar-0 = {
layer = "top";
position = "top";
height = 40;
spacing = 4;
margin-left = 48;
margin-right = 48;
margin-top = 4;
reload_style_on_change = true;
modules-left = [
#"custom/notification"
"group/niri"
"wlr/taskbar"
];
modules-center = ["clock" "privacy"];
modules-right = [
"tray"
"wireplumber"
"group/laptop"
"idle_inhibitor"
];
"niri/workspaces" = {
format = "{icon}";
format-icons = {
focused = "󰗝";
active = "󰻃";
default = "󰄰";
};
};
"niri/language" = {
format = "{}";
format-en = "🇺🇸";
format-uk = "🇺🇦";
};
"custom/separator" = {
format = "|";
interval = "once";
tooltip = false;
};
"custom/text" = {
format = "here will be workspaces";
interval = "once";
tooltip = false;
};
"group/niri" = {
orientation = "inherit";
modules = [
"niri/language"
"niri/workspaces"
];
};
"group/laptop" = {
orientation = "inherit";
drawer = {
transition-duration = 500;
children-class = "laptop";
transition-left-to-right = false;
};
modules = [
"battery"
"custom/kbd-backlight"
"custom/separator"
"backlight"
"custom/separator"
];
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "󰈈";
deactivated = "󰈉";
};
};
"tray" = {
icon-size = 24;
spacing = 3;
};
"clock" = {
interval = 1;
format = "{:%H:%M:%S}";
tooltip-format = "{:%d.%m.%Y}";
};
"backlight" = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = ["󰃞" "󰃟" "󰃝" "󰃠"];
on-scroll-up = "light -A 2%";
on-scroll-down = "light -U 2%";
};
"custom/kbd-backlight" = {
exec = "cat /sys/class/leds/platform::kbd_backlight/brightness";
interval = 1;
format = "{}% {icon}";
format-icons = ["󰌌"];
on-scroll-up = "light -s sysfs/leds/platform::kbd_backlight -A 5%";
on-scroll-down = "light -s sysfs/leds/platform::kbd_backlight -U 5%";
};
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 = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
"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 = "pwvucontrol";
on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle";
};
"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 = 4;
icon-size = 16;
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 = 24;
icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}";
tooltip-format = "{title}";
on-click = "activate";
};
};
};
style = ''
@define-color base00 #${config.lib.stylix.colors.base00};
@define-color base01 #${config.lib.stylix.colors.base01};
@define-color base02 #${config.lib.stylix.colors.base02};
@define-color base03 #${config.lib.stylix.colors.base03};
@define-color base04 #${config.lib.stylix.colors.base04};
@define-color base05 #${config.lib.stylix.colors.base05};
@define-color base06 #${config.lib.stylix.colors.base06};
@define-color base07 #${config.lib.stylix.colors.base07};
@define-color base08 #${config.lib.stylix.colors.base08};
@define-color base09 #${config.lib.stylix.colors.base09};
@define-color base0A #${config.lib.stylix.colors.base0A};
@define-color base0B #${config.lib.stylix.colors.base0B};
@define-color base0C #${config.lib.stylix.colors.base0C};
@define-color base0D #${config.lib.stylix.colors.base0D};
@define-color base0E #${config.lib.stylix.colors.base0E};
@define-color base0F #${config.lib.stylix.colors.base0F};
* {
font-family: Iosevka Nerd Font Propo, FontAwesome;
font-size: 100%;
/* margin: 0px 2px 2px 2px; */
}
window#waybar {
background-color: transparent;
/* border-top: 3px solid @overlay0; */
color: @base05;
/* padding: 0px 2px 0px 0px; */
transition-property: background-color;
transition-duration: 0.5s;
}
.modules-left {
border-radius: 12px;
margin-right: 4px;
}
.modules-center {
border-radius: 12px;
}
.modules-right {
border-radius: 12px;
margin-left: 4px;
}
tooltip {
background: @base01;
border: 1px solid @base0E;
}
tooltip label {
color: @base05;
}
/* .modules-center {
margin: 4px;
margin-top: 6px;
}*/
button {
box-shadow: inset 0 -3px transparent;
border-radius: 12px;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
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;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#custom-kbd-backlight,
#workspaces,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#laptop,
#tray,
#mode,
#privacy
#privacy-item,
#idle_inhibitor,
#backlight-slider,
#custom-notification,
#scratchpad,
#power-profiles-daemon,
#taskbar,
#language,
#upower,
#mpris,
#mpd {
padding: 0 0.8em;
border-radius: 12px;
color: @base05;
background-color: @base00;
}
/* #upower, */
#battery,
#backlight,
#custom-kbd-backlight,
#backlight-slider,
#cpu,
#memory,
#disk,
#network,
#wireplumber,
#power-profiles-daemon {
padding-right: 0.8em;
}
#language {
padding-right: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
#workspaces {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
#taskbar,
#workspaces {
padding: 0 0.5em;
}
#taskbar button,
#workspaces button {
padding: 0 0.3em;
}
#taskbar button:hover {
box-shadow: transparent;
}
#taskbar.empty,
window#empty {
background-color: transparent;
}
#battery.critical:not(.charging) {
background-color: #ed8796;
color: #181926;
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: #ed8796;
color: #000000;
}
#power-profiles-daemon.balanced {
background-color: #b7bdf8;
color: #000000;
}
#power-profiles-daemon.power-saver {
background-color: #8aadf4;
color: #000000;
}
label:focus {
background-color: #000000;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
padding: 0 0.9em;
}
#idle_inhibitor:hover {
box-shadow: inset 0 -3px @base05;
}
#idle_inhibitor.activated {
background-color: @base05;
color: @base00;
}
#idle_inhibitor.activated:hover {
box-shadow: inset 0 -3px @base00;
}
#laptop,
#privacy {
padding: 0em;
}
#privacy-item.screenshare {
background-color: @base00;
color: @base0C;
}
#privacy-item.audio-in {
background-color: @base00;
color: @base0E;
}
#privacy-item.audio-out {
background-color: @base;
}
'';
};
};
}