Files
nixos-config/home-manager/programs/hypr/waybar.nix

535 lines
16 KiB
Nix

{
pkgs,
lib,
hostname,
...
}:
let
betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)";
clock24h = false;
colors = {
base00 = "0D0E15";
base01 = "1a1b26";
base02 = "24283b";
base03 = "414868";
base04 = "565f89";
base05 = "a9b1d6";
base06 = "cbccd1";
base07 = "d5d6db";
base08 = "f7768e";
base09 = "ff9e64";
base0A = "e0af68";
base0B = "9ece6a";
base0C = "7dcfff";
base0D = "7aa2f7";
base0E = "bb9af7";
base0F = "ff9e64";
};
# Laptop hostnames that should show battery
isLaptop = builtins.elem hostname [ "eva-01" ];
in
with lib;
{
# Configure & Theme Waybar
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = [
{
layer = "top";
position = "top";
height = 36;
exclusive = true;
passthrough = false;
gtk-layer-shell = true;
modules-center = [ "hyprland/workspaces" ];
modules-left = [
"custom/startmenu"
"hyprland/window"
"pulseaudio"
"pulseaudio#microphone"
"cpu"
"memory"
"disk"
"temperature"
"idle_inhibitor"
"backlight"
];
modules-right = [
"network"
"bluetooth"
"custom/hyprbindings"
"custom/notification"
"custom/exit"
] ++ (optionals isLaptop [ "battery" ]) ++ [
"tray"
"clock"
];
"hyprland/workspaces" = {
format = "{name}";
format-icons = {
"1" = "󰲠";
"2" = "󰲢";
"3" = "󰲤";
"4" = "󰲦";
"5" = "󰲨";
"6" = "󰲪";
"7" = "󰲬";
"8" = "󰲮";
"9" = "󰲰";
"10" = "󰿬";
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
persistent-workspaces = {
"*" = 5;
};
};
"clock" = {
format = if clock24h then " {:L%H:%M}" else " {:L%I:%M %p}";
tooltip = true;
tooltip-format = "<big>󰃭 {:%A, %d %B %Y}</big>\n<tt><small>{calendar}</small></tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
format = {
months = "<span color='#${colors.base0E}'><b>{}</b></span>";
days = "<span color='#${colors.base05}'>{}</span>";
weeks = "<span color='#${colors.base0C}'><b>W{}</b></span>";
weekdays = "<span color='#${colors.base0A}'><b>{}</b></span>";
today = "<span color='#${colors.base08}'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
};
"hyprland/window" = {
max-length = 30;
separate-outputs = true;
rewrite = {
"(.*) - Brave" = "󰖟 $1";
"(.*) - Firefox" = "󰈹 $1";
"(.*) - nvim" = " $1";
"(.*) - fish" = " $1";
"(.*) - zsh" = " $1";
"(.*) - bash" = " $1";
"" = "󰙞 Desktop";
};
};
"memory" = {
interval = 5;
format = "󰾆 {percentage}%";
format-alt = "󰾆 {used}/{total} GiB";
tooltip = true;
tooltip-format = "󰾆 RAM: {used:0.1f}GiB / {total:0.1f}GiB\n󰾉 Swap: {swapUsed:0.1f}GiB / {swapTotal:0.1f}GiB";
on-click = "sleep 0.1 && kitty --title btop sh -c 'btop'";
};
"cpu" = {
interval = 5;
format = "󰘚 {usage}%";
format-alt = "󰘚 {avg_frequency}GHz";
tooltip = true;
tooltip-format = "󰘚 CPU Usage: {usage}%\n {avg_frequency}GHz avg frequency";
on-click = "sleep 0.1 && kitty --title btop sh -c 'btop'";
};
"temperature" = {
interval = 5;
format = "{icon} {temperatureC}°C";
format-critical = "󰸁 {temperatureC}°C";
format-icons = [ "" "" "" "" "" ];
critical-threshold = 80;
tooltip = true;
tooltip-format = " Temperature: {temperatureC}°C\n{temperatureF}°F";
};
"disk" = {
interval = 30;
format = "󰋊 {percentage_used}%";
format-alt = "󰋊 {free} free";
path = "/";
tooltip = true;
tooltip-format = "󰋊 {path}\n Used: {used} / {total}\n Free: {free} ({percentage_free}%)";
on-click = "sleep 0.1 && kitty --title yazi sh -c 'yazi'";
};
"network" = {
interval = 5;
format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ];
format-ethernet = "󰈀 {bandwidthDownBits} {bandwidthUpBits} ";
format-wifi = "{icon} {essid} {signalStrength}%";
format-disconnected = "󰤮 Offline";
format-linked = "󰈀 {ifname} (No IP)";
tooltip = true;
tooltip-format = "󰈀 {ifname}\n󰩟 {ipaddr}/{cidr}\n󰕒 Up: {bandwidthUpBits}\n󰇚 Down: {bandwidthDownBits}";
tooltip-format-wifi = "{icon} {essid}\n󰩟 {ipaddr}/{cidr}\n󰑴 Strength: {signalStrength}%\n󰕒 Up: {bandwidthUpBits}\n󰇚 Down: {bandwidthDownBits}";
on-click = "sleep 0.1 && kitty --title nmtui sh -c 'nmtui'";
};
"bluetooth" = {
format = "󰂯";
format-disabled = "󰂲";
format-off = "󰂲";
format-on = "󰂯";
format-connected = "󰂱 {device_alias}";
format-connected-battery = "󰂱 {device_alias} {device_battery_percentage}%";
tooltip = true;
tooltip-format = "󰂯 Bluetooth: {status}\n󰌌 {num_connections} connected";
tooltip-format-connected = "󰂯 {device_enumerate}";
tooltip-format-enumerate-connected = " {device_alias}";
tooltip-format-enumerate-connected-battery = " {device_alias} 󰁹{device_battery_percentage}%";
on-click = "sleep 0.1 && blueman-manager";
};
"tray" = {
icon-size = 18;
spacing = 10;
show-passive-items = true;
};
"pulseaudio" = {
format = "{icon} {volume}%";
format-bluetooth = "󰂱 {volume}%";
format-bluetooth-muted = "󰂲 Muted";
format-muted = "󰖁 Muted";
format-icons = {
headphone = "󰋋";
hands-free = "󰋋";
headset = "󰋎";
phone = "󰏲";
portable = "󰏲";
car = "󰄋";
default = [ "󰕿" "󰖀" "󰕾" ];
};
scroll-step = 5;
on-click = "sleep 0.1 && pavucontrol";
on-click-right = "sleep 0.1 && pactl set-sink-mute @DEFAULT_SINK@ toggle";
tooltip = true;
tooltip-format = "{icon} {desc}\nVolume: {volume}%";
};
"pulseaudio#microphone" = {
format = "{format_source}";
format-source = "󰍬 {volume}%";
format-source-muted = "󰍭 Muted";
on-click = "sleep 0.1 && pavucontrol";
on-click-right = "sleep 0.1 && pactl set-source-mute @DEFAULT_SOURCE@ toggle";
scroll-step = 5;
tooltip = true;
tooltip-format = "󰍬 {source_desc}\nVolume: {volume}%";
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "󰒳";
deactivated = "󰒲";
};
tooltip = true;
tooltip-format-activated = "Idle inhibitor: ON";
tooltip-format-deactivated = "Idle inhibitor: OFF";
};
"custom/exit" = {
tooltip = false;
format = "󰗼";
on-click = "sleep 0.1 && wlogout";
};
"custom/startmenu" = {
tooltip = false;
format = "";
on-click = "sleep 0.1 && rofi-launcher";
on-click-right = "sleep 0.1 && rofi -show drun";
};
"custom/hyprbindings" = {
tooltip = false;
format = "󱕴";
on-click = "sleep 0.1 && list-keybinds";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {count}";
format-icons = {
notification = "<span foreground='#${colors.base08}'><sup>󰅸</sup></span>󰂚";
none = "󰂚";
dnd-notification = "<span foreground='#${colors.base08}'><sup>󰅸</sup></span>󱏧";
dnd-none = "󱏧";
inhibited-notification = "<span foreground='#${colors.base08}'><sup>󰅸</sup></span>󰂛";
inhibited-none = "󰂛";
dnd-inhibited-notification = "<span foreground='#${colors.base08}'><sup>󰅸</sup></span>󰂛";
dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "sleep 0.1 && swaync-client -t -sw";
on-click-right = "sleep 0.1 && swaync-client -d -sw";
escape = true;
};
"battery" = {
states = {
good = 95;
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = "󰂄 {capacity}%";
format-plugged = "󱘖 {capacity}%";
format-good = "{icon} {capacity}%";
format-full = "󰁹 Full";
format-icons = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ];
tooltip = true;
tooltip-format = "{icon} {capacity}%\n{timeTo}";
on-click = "";
};
"backlight" = {
interval = 2;
format = "{icon} {percent}%";
format-icons = [ "󰃞" "󰃟" "󰃝" "󰃠" ];
scroll-step = 5;
on-scroll-up = "brightnessctl set 5%+";
on-scroll-down = "brightnessctl set 5%-";
on-click = "brightnessctl set 50%";
tooltip = true;
tooltip-format = "󰃠 Brightness: {percent}%";
min-length = 6;
};
}
];
style = concatStrings [
''
* {
font-family: JetBrainsMono Nerd Font Mono;
font-size: 14px;
border-radius: 0px;
border: none;
min-height: 0px;
}
window#waybar {
background: rgba(0,0,0,0);
}
/* ===== Workspaces ===== */
#workspaces {
color: #${colors.base00};
background: #${colors.base01};
margin: 4px 4px;
padding: 5px 5px;
border-radius: 16px;
}
#workspaces button {
font-weight: bold;
padding: 0px 5px;
margin: 0px 3px;
border-radius: 16px;
color: #${colors.base00};
background: linear-gradient(45deg, #${colors.base08}, #${colors.base0D});
opacity: 0.5;
transition: ${betterTransition};
}
#workspaces button.active {
font-weight: bold;
padding: 0px 5px;
margin: 0px 3px;
border-radius: 16px;
color: #${colors.base00};
background: linear-gradient(45deg, #${colors.base08}, #${colors.base0D});
transition: ${betterTransition};
opacity: 1.0;
min-width: 40px;
}
#workspaces button.urgent {
background: linear-gradient(45deg, #${colors.base08}, #${colors.base09});
opacity: 1.0;
animation: blink 1s linear infinite;
}
#workspaces button:hover {
font-weight: bold;
border-radius: 16px;
color: #${colors.base00};
background: linear-gradient(45deg, #${colors.base08}, #${colors.base0D});
opacity: 0.8;
transition: ${betterTransition};
}
/* ===== Tooltips ===== */
tooltip {
background: #${colors.base00};
border: 1px solid #${colors.base08};
border-radius: 12px;
padding: 5px;
}
tooltip label {
color: #${colors.base05};
padding: 2px;
}
/* ===== Left Modules ===== */
#window,
#pulseaudio,
#pulseaudio.microphone,
#cpu,
#memory,
#disk,
#temperature,
#idle_inhibitor {
font-weight: bold;
margin: 4px 0px;
margin-left: 7px;
padding: 0px 14px;
background: #${colors.base04};
color: #${colors.base00};
border-radius: 24px 10px 24px 10px;
transition: ${betterTransition};
}
#window:hover,
#pulseaudio:hover,
#pulseaudio.microphone:hover,
#cpu:hover,
#memory:hover,
#disk:hover,
#temperature:hover,
#idle_inhibitor:hover {
background: #${colors.base0D};
color: #${colors.base00};
transition: ${betterTransition};
}
#pulseaudio.muted,
#pulseaudio.microphone.source-muted {
background: #${colors.base03};
color: #${colors.base05};
}
#temperature.critical {
background: #${colors.base08};
animation: blink 1s linear infinite;
}
#idle_inhibitor.activated {
background: #${colors.base0A};
color: #${colors.base00};
}
#cpu.warning {
background: #${colors.base0A};
}
#cpu.critical {
background: #${colors.base08};
animation: blink 1s linear infinite;
}
#memory.warning {
background: #${colors.base0A};
}
#memory.critical {
background: #${colors.base08};
animation: blink 1s linear infinite;
}
/* ===== Start Menu ===== */
#custom-startmenu {
color: #${colors.base0B};
background: #${colors.base02};
font-size: 28px;
margin: 0px;
padding: 0px 30px 0px 15px;
border-radius: 0px 0px 40px 0px;
transition: ${betterTransition};
}
#custom-startmenu:hover {
color: #${colors.base0D};
transition: ${betterTransition};
}
/* ===== Right Modules ===== */
#custom-hyprbindings,
#custom-notification,
#custom-exit,
#network,
#bluetooth,
#battery,
#tray {
font-weight: bold;
background: #${colors.base0F};
color: #${colors.base00};
margin: 4px 0px;
margin-right: 7px;
border-radius: 10px 24px 10px 24px;
padding: 0px 14px;
transition: ${betterTransition};
}
#custom-hyprbindings:hover,
#custom-notification:hover,
#custom-exit:hover,
#network:hover,
#bluetooth:hover {
background: #${colors.base0E};
transition: ${betterTransition};
}
#network.disconnected {
background: #${colors.base08};
}
#bluetooth.off,
#bluetooth.disabled {
background: #${colors.base03};
color: #${colors.base05};
}
#bluetooth.connected {
background: #${colors.base0D};
color: #${colors.base00};
}
/* ===== Battery ===== */
#battery.good {
background: #${colors.base0B};
color: #${colors.base00};
}
#battery.warning {
background: #${colors.base0A};
color: #${colors.base00};
}
#battery.critical {
background: #${colors.base08};
color: #${colors.base00};
animation: blink 1s linear infinite;
}
#battery.charging {
background: #${colors.base0B};
color: #${colors.base00};
}
/* ===== Clock ===== */
#clock {
font-weight: bold;
color: #${colors.base00};
background: linear-gradient(90deg, #${colors.base0E}, #${colors.base0C});
margin: 0px;
padding: 0px 15px 0px 30px;
border-radius: 0px 0px 0px 40px;
transition: ${betterTransition};
}
#clock:hover {
background: linear-gradient(90deg, #${colors.base0C}, #${colors.base0E});
transition: ${betterTransition};
}
''
];
};
}