{
config,
config',
inputs,
lib,
pkgs,
...
}: with lib; let
cfg = config.myOptions.programs.waybar;
in {
options.myOptions.programs.waybar.enable = mkEnableOption "enable waybar";
config = mkIf cfg.enable {
home-manager.users.${config'.username} = {
programs.waybar = {
enable = true;
package = inputs.waybar.packages.${pkgs.system}.waybar;
systemd.enable = true;
settings.mainBar = {
gtk-layer-shell = true;
layer = "top";
modules-left = [ "custom/launcher" "custom/xwayland" "tray" "hyprland/workspaces" ];
modules-center = [ "hyprland/window" ];
modules-right = [ "custom/dnd" "backlight" /*"cava"*/ "mpd" "pulseaudio" "clock" "battery" "custom/power" ];
pulseaudio = {
tooltip = false;
scroll-step = "1";
format = " {icon} {volume}%";
format-muted = " {volume}%";
format-icons = {
default = ["" "" ""];
};
on-click = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
"hyprland/workspaces" = {
sort-by-name = true;
sort-by-coordinates = false;
on-click = "activate";
#on-scroll = "~/Scripts/cycle_workspace.sh 1";
active-only = false;
format = "{icon}";
format-icons = {
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = "5";
"6" = "6";
"7" = "7";
"8" = "8";
"9" = "9";
"10" = "10";
"11" = "1";
"12" = "2";
"13" = "3";
"14" = "4";
"15" = "5";
"16" = "6";
"17" = "7";
"18" = "8";
"19" = "9";
"20" = "10";
};
persistent_workspaces = {
"1" = [ "eDP-1" ];
"2" = [ "eDP-1" ];
"3" = [ "eDP-1" ];
"4" = [ "eDP-1" ];
"5" = [ "eDP-1" ];
"6" = [ "eDP-1" ];
"7" = [ "eDP-1" ];
"8" = [ "eDP-1" ];
"9" = [ "eDP-1" ];
"10" = [ "eDP-1" ];
"11" = [ "HDMI-A-1" ];
"12" = [ "HDMI-A-1" ];
"13" = [ "HDMI-A-1" ];
"14" = [ "HDMI-A-1" ];
"15" = [ "HDMI-A-1" ];
"16" = [ "HDMI-A-1" ];
"17" = [ "HDMI-A-1" ];
"18" = [ "HDMI-A-1" ];
"19" = [ "HDMI-A-1" ];
"20" = [ "HDMI-A-1" ];
};
};
network = {
tooltip = false;
format = "{ipaddr} {icon}";
format-alt = "{icon}";
format-icons = {
wifi = [ "" ];
ethernet = [ "" ];
disconnected = [ "" ];
};
on-click-right = "foot -e nmtui";
};
backlight = {
interval = 1;
align = 0;
rotate = 0;
format = "{icon} {percent}%";
format-icons = [ "" "" "" "" "" "" "" ];
#on-scroll-up = "~/Scripts/bright.sh s +1%";
#on-scroll-down = "~/Scripts/bright.sh s 1%-";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set +1%";
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set 1%-";
smooth-scrolling-threshold = 1;
};
battery = {
interval = 1;
states = {
good = 75;
warning = 30;
critical = 20;
};
format = "{icon}{capacity}%";
format-charging = "{icon}{capacity}% {power}";
format-discharging = "{icon}{capacity}% {power}";
format-icons = ["" "" "" "" "" "" "" "" "" "" ""];
format-charging-icons = ["" "" "" "" "" "" "" "" "" "" ""];
};
tray = {
icon-size = 18;
spacing = 10;
};
clock = {
interval = 1;
format = "{: %H:%M:%S %d/%m/%Y}";
format-alt = "{: %H:%M:%S}";
tooltip-format = "{calendar}";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "{}";
days = "{}";
weeks = "T{:%W}";
weekdays = "{}";
today = "{}";
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
};
};
cpu = {
interval = 1;
format = " {}%";
max-length = 10;
};
memory = {
interval = 1;
format = " {}%";
max-length = 10;
};
"custom/launcher" = {
format = " ";
on-click = "~/.config/rofi/launchers/type-2/launcher.sh";
on-click-right = "pkill rofi";
};
"custom/power" = {
format = "";
on-click = "~/.config/rofi/powermenu/type-2/powermenu.sh";
};
"hyprland/window" = {
format = "{}";
separate-outputs = true;
};
gamemode = {
format = "{glyph}";
format-alt = "{glyph} {count}";
glyph = "";
hide-not-running = true;
use-icon = true;
icon-name = "input-gaming-symbolic";
icon-spacing = 4;
icon-size = 20;
tooltip = true;
tooltip-format = "Games running: {count}";
};
"custom/dnd" = {
exec = "~/Scripts/waybar-dunst.sh";
on-click = "~/Scripts/dnd.sh";
restart-interval = 1;
tooltip = false;
};
cava = {
framerate = 165;
autosens = 1;
sensitivity = 100;
bars = 14;
lower_cutoff_freq = 50;
higher_cutoff_freq = 10000;
method = "pipewire";
source = "auto";
stereo = true;
reverse = false;
bar_delimiter = 0;
monstercat = false;
waves = false;
noise_reduction = 0.77;
input_delay = 2;
format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" ];
actions = {
on-click-right = "mode";
};
};
"custom/power_profile" = {
exec = "asusctl profile -p | sed s:'Active profile is'::";
interval = 30;
format = "{}";
format-alt-click = "click-right";
format-alt = "";
on-click = "asusctl profile -n; pkill -SIGRTMIN+8 waybar";
signal = 8;
};
"custom/xwayland" = {
exec = "${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl clients | ${pkgs.ripgrep}/bin/rg -e 'xwayland: [1]' | ${pkgs.coreutils-full}/bin/wc -l";
interval = 1;
format = "X {}";
};
mpd = {
format = " {artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})";
format-disconnected = " Disconnected";
format-stopped = " Stopped";
interval = 1;
tooltip-format = "MPD (connected)";
tooltip-format-disconnected = "MPD (disconnected)";
on-click = "mpc toggle";
};
};
style = ''
@define-color base #1e1e2e;
@define-color mantle #181825;
@define-color crust #11111b;
@define-color text #cdd6f4;
@define-color subtext0 #a6adc8;
@define-color subtext1 #bac2de;
@define-color surface0 #313244;
@define-color surface1 #45475a;
@define-color surface2 #585b70;
@define-color overlay0 #6c7086;
@define-color overlay1 #7f849c;
@define-color overlay2 #9399b2;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color sapphire #74c7ec;
@define-color sky #89dceb;
@define-color teal #94e2d5;
@define-color green #a6e3a1;
@define-color yellow #f9e2af;
@define-color peach #fab387;
@define-color maroon #eba0ac;
@define-color red #f38ba8;
@define-color mauve #cba6f7;
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;
* {
border-radius: 10px;
font-family: Material Design Icons;
font-size: 16px;
}
window#waybar {
background-color: alpha(@base, 0.5);
border-radius: 0px;
}
window#waybar.hidden {
opacity: 0.2;
}
#window {
margin-top: 4px;
margin-bottom: 4px;
padding-left: 10px;
padding-right: 10px;
background: @mantle;
color: @teal;
font-family: JetBrains Mono;
}
#workspaces {
padding-left: 5px;
}
#workspaces button {
border-radius: 15px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin-top: 6px;
margin-right: 3px;
margin-bottom: 6px;
margin-left: 3px;
background-color: @mantle;
color: @text;
min-width: 24px;
}
#workspaces button.active {
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
padding-left: 0px;
margin-top: 6px;
margin-right: 3px;
margin-bottom: 6px;
margin-left: 3px;
background-color: @blue;
color: @mantle;
min-width: 24px;
}
#workspaces button:hover {
background: alpha(@mantle, 0.7);
transition-property: background, min-width;
transition-duration: 0.5s;
transition-timing-function: ease;
}
#workspaces button.focused {
background-color: @yellow;
}
#workspaces button.urgent {
background-color: @red;
}
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
.modules-right > widget:first-child > #workspaces {
margin-right: 0;
}
#pulseaudio {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 0px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @peach;
/*border-top-left-radius: 0;
border-bottom-left-radius: 0;*/
}
#cava {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
margin-right: 0px;
padding-left: 10px;
padding-right: 0px;
transition: none;
background: @mantle;
color: @peach;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
#battery {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @teal;
}
@keyframes blink {
to {
background-color: @red;
}
}
#battery.charging, #battery.plugged {
background-color: @mantle;
}
#battery.critical:not(.charging) {
background-color: @mantle;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#backlight {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @yellow;
}
#clock {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition-property: min-width;
transition-duration: 0.5s;
background: @mantle;
color: @pink;
}
#custom-power_profile {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @rosewater;
}
#tray {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
}
#custom-launcher {
font-size: 16px;
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 5px;
transition: none;
background: @mantle;
color: @blue;
}
#custom-power {
font-size: 20px;
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
margin-right: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @red;
}
#custom-wallpaper {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
}
#custom-updates {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
}
#custom-media {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
}
#custom-dnd {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @flamingo;
}
#custom-xwayland {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @green;
}
#mpd {
margin-top: 3px;
margin-bottom: 3px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
transition: none;
background: @mantle;
color: @green;
}
'';
};
};
};
}