nixos-config/modules/home/waybar.nix
2025-04-29 17:35:06 -04:00

342 lines
6.9 KiB
Nix

{ inputs, pkgs, ... }:
with pkgs.lib.nix-rice;
let strPalette = palette.toRGBHex pkgs.rice.colorPalette;
in {
programs.waybar = {
enable = true;
package = inputs.waybar.packages.${pkgs.stdenv.hostPlatform.system}.waybar;
systemd = {
enable = true;
};
settings = {
mainBar = {
layer = "top";
position = "top";
modules-left = [
"clock"
"niri/workspaces"
"mpris"
];
modules-right = [
"wlr/taskbar"
"tray"
"cpu"
"memory"
"network"
"wireplumber"
"bluetooth"
"power-profiles-daemon"
"upower"
"idle_inhibitor"
"custom/notification"
];
"bluetooth" = {
"format" = "";
"format-off" = "";
"format-disabled" = "!";
"on-click" = "$HOME/.local/bin/wezapp bluetui";
"tooltip-format" = "{status}";
};
"custom/notification" = {
"tooltip" = false;
"format" = "{icon}";
"format-icons" = {
"notification" = "<span foreground='red'><sup></sup></span>";
"none" = "";
"dnd-notification" = "<span foreground='red'><sup></sup></span>";
"dnd-none" = "";
"inhibited-notification" = "<span foreground='red'><sup></sup></span>";
"inhibited-none" = "";
"dnd-inhibited-notification" = "<span foreground='red'><sup></sup></span>";
"dnd-inhibited-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;
};
"idle_inhibitor" = {
"format" = "{icon}";
"tooltip-format-activated" = "idle inhibitor = {status}";
"tooltip-format-deactivated" = "idle inhibitor = {status}";
"format-icons" = {
"activated" = "󱡆";
"deactivated" = "󱡇";
};
};
"power-profiles-daemon" = {
"format" = "{icon}";
"tooltip-format" = "Power profile = {profile}\nDriver = {driver}";
"tooltip" = true;
"format-icons" = {
"default" = "?";
"performance" = "";
"balanced" = "";
"power-saver" = "";
};
};
"memory" = {
"interval" = 30;
"format" = "{used:0.1f}G/{total:0.1f}G ";
"on-click" = "$HOME/.local/bin/wezapp btop";
};
"cpu" = {
"interval" = 10;
"format" = "{}% ";
"max-length" = 10;
"on-click" = "$HOME/.local/bin/wezapp btop";
};
"network" = {
"format-wifi" = "";
"format-ethernet" = "";
"format-disconnected" = "󰱟";
"tooltip-format" = "{essid} {ifname}";
"max-length" = 50;
"on-click" = "$HOME/.local/bin/wezapp impala";
};
"tray" = {
"icon-size" = 22;
"spacing" = 10;
};
"clock" = {
"format" = "{:%I:%M %a %d %b %Y}";
"on-click" = "gnome-calendar";
"tooltip" = false;
};
"wireplumber" = {
"format" = "{volume}% {icon}";
"format-muted" = "";
"format-icons" = [
""
""
""
];
"on-click" = "pavucontrol";
};
"mpris" = {
"interval" = 1;
"format" = "{player_icon} {dynamic}";
"format-paused" = "{status_icon} <i>{dynamic}</i>";
"dynamic-len" = 75;
"player-icons" = {
"default" = "";
};
"status-icons" = {
"paused" = "";
};
};
"wlr/taskbar" = {
"format" = "{icon}";
"icon-size" = 22;
"tooltip-format" = "{title}";
"on-click" = "activate";
"app_ids-mapping" = {
"firefoxdeveloperedition" = "firefox-developer-edition";
};
"ignore-list" = [
"Signal"
];
"rewrite" = {
"Firefox Web Browser" = "Firefox";
};
};
"niri/workspaces" = {
"format" = "{icon}";
"format-icons" = {
"main" = "";
"scratchpad" = "";
};
};
};
};
style = ''
* {
border: none;
font-size: 12pt;
font-family: "JetBrainsMono Nerd Font" ;
min-height: 30px;
}
button:hover {
box-shadow: none; /* Remove predefined box-shadow */
text-shadow: none; /* Remove predefined text-shadow */
background: none; /* Remove predefined background color (white) */
transition: none; /* Disable predefined animations */
}
window#waybar {
background: ${strPalette.normal.background};
margin: 5px;
}
.modules-right {
padding-left: 5px;
margin-top: 2px;
color: #ccc;
}
.modules-center {
padding: 0 15px;
margin-top: 2px;
color: #ccc;
}
.modules-left {
margin-top: 2px;
color: #ccc;
padding-right: 5px;
}
#taskbar > *:hover {
border: none;
box-shadow: none;
text-shadow: none;
border-color: transparent;
background: #333;
}
#network {
padding: 0 10px 0 15px;
}
#battery,
#custom-clipboard,
#custom-colorpicker,
#custom-powerDraw,
#bluetooth,
#pulseaudio,
#wireplumber,
#disk,
#taskbar
#cpu,
#temperature,
#custom-weather,
#idle_inhibitor,
#jack,
#upower,
#power-profiles-daemon
#tray,
#window,
#workspaces,
#clock
#custom-notification {
padding: 0 20px;
}
#memory {
padding: 0 20px 0 10px;
}
#battery {
padding-right: 0;
}
#custom-notification {
min-width: 30px;
padding-right: 6px;
font-size: 13pt;
}
#idle_inhibitor {
min-width: 30px;
padding-left: 0;
font-size: 13pt;
}
#power-profiles-daemon {
min-width: 40px;
}
#temperature.critical,
#pulseaudio.muted {
color: #FF0000;
padding-top: 0;
}
#cpu {
padding-right: 30px;
}
#clock{
padding-left: 6px;
color: ${strPalette.normal.magenta};
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
#battery.warning:not(.charging) {
background-color: #ffbe61;
color: black;
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#mpris {
margin-left: 15px;
}
#workspaces button {
color: #666;
}
#workspaces button:hover {
background: #333;
}
#workspaces button.empty {
color: #222;
}
#workspaces button.focused
{
color: #ccc;
}
#taskbar, #tray {
padding-right: 30px;
}
#taskbar button.active {
background: #333;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
'';
};
}