Files
nixos-conf/home-manager/packages/waybar/waybar.nix
2025-08-23 08:05:21 -06:00

311 lines
6.2 KiB
Nix

{ config, pkgs, ... }:
{
home.packages = with pkgs; [
waybar
];
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
spacing = 4;
# Module layout
modules-right = [
"pulseaudio"
"network#wifi"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"clock"
"tray"
];
# Module configurations
"tray" = {
icon-size = 21;
spacing = 10;
};
"clock" = {
# timezone = "America/Denver";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format-alt = "{:%Y-%m-%d}";
};
"cpu" = {
format = "{usage}% ";
tooltip = true;
};
"memory" = {
format = "{}% ";
};
"temperature" = {
# thermal-zone = 2;
# hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "{temperatureC}°C {icon}";
format = "{temperatureC}°C {icon}";
format-icons = ["" "" ""];
};
"backlight" = {
format = "{percent}% {icon}";
format-icons = ["" "" "" "" "" "" "" "" ""];
};
"battery" = {
states = {
good = 95;
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-full = "{icon} Full";
format-charging = "{icon} Charging {capacity}% {time}";
format-plugged = "{icon} Charge complete";
format-good = ">{icon} {capacity}%";
format-icons = ["" "" "" "" "" "" "" ""];
};
"network#wifi" = {
interface = "wlp*";
format-wifi = "{essid} ({signalStrength}%) ";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "{ifname} (No IP) ";
format-disconnected = "No WiFi";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
"pulseaudio" = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
};
};
};
# Waybar styling inspired by the referenced swayhome configuration
style = ''
* {
font-family: "JetBrains Mono", "Font Awesome 6 Free";
font-size: 13px;
}
window#waybar {
color: #ffffff;
background-color: #1e3b28;
border-bottom: 3px solid #8f2fef;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
button {
box-shadow: inset 0 -3px transparent;
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button {
padding: 0 15px;
background-color: transparent;
border: 2px solid #8f2fef
}
#workspaces button:hover {
background: rgba(255, 255, 255, 0.2);
}
#workspaces button.focused {
background-color: #8f2fef;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #f38ba8;
}
#backlight,
#battery,
#clock,
#cpu,
#memory,
#mode,
#network,
#pulseaudio,
#temperature,
#tray,
#idle_inhibitor,
#keyboard-state,
#power-profiles-daemon {
padding: 0 8px;
}
#window,
#workspaces {
margin: 0 8px;
}
.modules-left>widget:first-child>#workspaces {
margin-left: 0;
}
.modules-right>widget:last-child>#workspaces {
margin-right: 0;
}
#backlight {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #cba6f7;
}
#battery {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #a6e3a1;
}
#battery.critical.discharging {
background-color: #f38ba8;
animation: blink 1s infinite;
}
#battery.warning.discharging {
background-color: #f9e2af;
animation: blink 1s infinite;
}
@keyframes blink {
to {
background-color: transparent;
}
}
#clock {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #a6e3a1;
}
#cpu {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #cba6f7;
}
#memory {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #f9e2af;
}
#mode {
color: #ffffff;
background-color: #8f2fef;
border-bottom: 3px solid #ffffff;
}
#network {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #a6e3a1;
}
#network.disconnected {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #f38ba8;
}
#pulseaudio {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #a6e3a1;
}
#pulseaudio.muted {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #f38ba8;
}
#temperature {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #a6e3a1;
}
#temperature.critical {
background-color: transparent;
border-bottom: 3px solid #f38ba8;
}
#tray {
background-color: transparent;
border-bottom: 3px solid #8f2fef;
}
#idle_inhibitor {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #f9e2af;
}
#idle_inhibitor.activated {
color: #1e3b28;
background-color: #f9e2af;
border-bottom: 3px solid #f9e2af;
}
#keyboard-state {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #fab387;
}
#power-profiles-daemon {
color: #ffffff;
background-color: transparent;
border-bottom: 3px solid #94e2d5;
}
'';
};
}