Files
nixos/home/waybar.nix
2026-01-02 20:43:09 +01:00

325 lines
9.4 KiB
Nix

{ config, pkgs, lib, ... }:
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
output = [ "eDP-1" "DP-5" "DP-6" ];
modules-left = [ "custom/logo" "hyprland/workspaces" "tray" ];
modules-center = [ "clock" ];
modules-right = [ "network" "idle_inhibitor" "bluetooth" "battery" "custom/notification" ];
"custom/logo" = {
format = "";
tooltip = false;
on-click = "wlogout";
on-click-right = "alacritty -e fish -C fastfetch";
};
"hyprland/workspaces" = {
disable-scroll = true;
all-outputs = true;
format = "{name}";
};
"clock" = {
format = "{:%a %d/%m %H:%M}";
tooltip-format = "{:%Y-%m-%d}";
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
tooltip = true;
tooltip-format-activated = "Inhibitor Aktiv";
tooltip-format-deactivated = "Idle Aktiv";
};
"custom/audio_idle_inhibitor" = {
format = "{icon}";
exec = "sway-audio-idle-inhibit --dry-print-both-waybar | sed -u 's/\"alt\":\"output-input\"/&,\"tooltip\":\"Audio \\& Mikrofon aktiv\"/; s/\"alt\":\"output\"/&,\"tooltip\":\"Audio spielt\"/; s/\"alt\":\"input\"/&,\"tooltip\":\"Mikrofon wird benutzt\"/; s/\"alt\":\"none\"/&,\"tooltip\":\"Keine Aktivität\"/'";
"exec-if" = "which sway-audio-idle-inhibit";
"return-type" = "json";
tooltip = true;
format-icons = {
output = " ";
input = "";
"output-input" = " ";
none = "";
};
};
"tray" = {
icon-size = 18;
spacing = 10;
};
"network" = {
format-wifi = " {essid}";
format-ethernet = " {ifname}";
format-linked = "󰌘{ipaddr}";
format = "{essid}";
format-disconnected = "󰤮 no wifi";
on-click = "${pkgs.alacritty}/bin/alacritty -e ${pkgs.networkmanager}/bin/nmtui";
on-click-right = "nmcli radio wifi $(nmcli radio wifi | grep -q 'enabled' && echo off || echo on)";
tooltip-format = " {bandwidthUpBits} {bandwidthDownBits}\n{ifname}\n{ipaddr}/{cidr}\n";
tooltip-format-wifi = " {essid} {frequency}MHz\nStrength: {signalStrength}% ({signaldBm}dBm)\nIP: {ipaddr}/{cidr}\n {bandwidthUpBits} {bandwidthDownBits}";
interval = 10;
};
"backlight" = {
device = "intel_backlight";
format = "{icon}";
format-alt = "{percent}%";
format-alt-click = "click-right";
format-icons = ["" "" "" "" "" "" "" "" ""];
tooltip-format = " Helligkeit: {percent}%";
on-scroll-down = "brightnessctl s 5%-";
on-scroll-up = "brightnessctl s +5%";
};
"bluetooth" = {
format = "";
format-disabled = "󰂲";
format-connected = "󰂱{device_alias}";
format-connected-battery = "󰂱{device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} verbunden\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
on-click = "alacritty -e bluetui";
on-click-right = "rfkill toggle bluetooth";
};
"pulseaudio" = {
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "󰖁";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
on-click-right = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
tooltip-format = "Ausgabelautstärke: {source_volume}% | {desc}";
};
"pulseaudio#microphone" = {
format = "{format_source}";
format-source = " {volume}%";
format-source-muted = "";
on-click = "pavucontrol";
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%+";
on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-";
tooltip-format = "Eingabelautstärke: {source_volume}% | {source_desc}";
scroll-step = 5;
};
"battery" = {
interval = 5;
format = "{icon}";
format-alt = "{capacity}%";
format-alt-click = "click-right";
format-icons = [ "" "" "" "" "" ];
format-charging = "{icon}";
format-plugged = "{icon}";
tooltip-format = "Akkustand: {capacity}% - {timeTo} - {power}W ";
on-click = "alacritty -e btop";
states = {
full = 100;
great = 97;
good = 85;
ok = 50;
warning = 30;
low = 20;
critical = 10;
};
};
"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 = "";
};
return-type = "json";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
};
};
};
style = lib.replaceStrings ["#workspaces button.focused"] ["#workspaces button.active"] ''
@import "${config.home.homeDirectory}/.config/matugen/colors.css";
* {
border: none;
border-radius: 0;
padding: 0;
margin: 0;
font-size: 13px;
font-family: "JetBrainsMono Nerd Font", "NotoSans Nerd Font Mono";
font-weight: bold;
}
tooltip {
background: @background;
color: @foreground;
border: 1px solid @primary;
border-radius: 10px;
}
tooltip label {
color: @foreground;
padding: 5px;
}
window#waybar {
background: @background;
color: @foreground;
border-bottom: 2px solid @primary;
}
#custom-logo {
font-size: 20px;
margin: 0 15px;
color: @primary;
}
#workspaces button {
padding: 0 0px;
margin-right: 4px;
color: @foreground;
background: transparent;
}
#workspaces button:hover {
background: @surface_container_high;
color: @foreground;
border-bottom: 2px solid @primary;
}
#workspaces button.active {
background: @surface_container_high;
color: @primary;
border-bottom: 2px solid @primary;
}
#workspaces button.urgent {
background-color: @urgent;
color: @background;
}
#mode {
background-color: @secondary;
color: @background;
padding: 0 5px;
}
#network {
padding-right: 5px;
padding-left: 5px;
}
#clock, #language, #custom-notification, #backlight, #pulseaudio, #bluetooth, #tray {
margin: 0 5px;
color: @foreground;
}
#custom-notification {
margin-right: 15px;
margin-left: 5px;
color: @foreground;
}
#custom-audio_idle_inhibitor {
margin-left: 5px;
margin-right: 5px;
color: @foreground;
}
#idle_inhibitor {
margin-right: 5px;
margin-left: 7px;
color: @foreground;
font-size: 13px;
}
#idle_inhibitor.activated {
animation: blink-icon 2s infinite alternate;
color: @primary;
}
@keyframes blink-icon {
from { color: @primary; }
to { color: transparent; }
}
#battery {
margin-top: 0;
margin-bottom: 0;
margin-left: 5px;
margin-right: 12px;
color: @foreground;
}
#battery.charging, #battery.plugged {
margin: 0 5px;
color: @foreground;
}
#battery.ok:not(.charging) {
animation: blink-icon 3s infinite alternate;
}
@keyframes blink-icon-yellow {
from { color: yellow; }
to { color: transparent; }
}
#battery.warning:not(.charging) {
animation: blink-icon-yellow 1.5s infinite alternate;
}
@keyframes blink-icon-orange {
from { color: orange; }
to { color: transparent; }
}
#battery.low:not(.charging) {
color: orange;
animation: blink-icon-orange 0.8s infinite alternate;
}
@keyframes blink-icon-red {
from { color: red; }
to { color: transparent; }
}
#battery.critical:not(.charging) {
animation: blink-icon-red 0.3s infinite alternate;
}
'';
};
}