add waybar config

This commit is contained in:
ulic-youthlic 2025-01-24 20:22:12 +08:00
parent 98b594aa15
commit 7a037f7721
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
5 changed files with 154 additions and 233 deletions

View file

@ -25,6 +25,7 @@ in
swaynotificationcenter
swaybg
xwayland-satellite
niri-unstable
];
youthlic.programs = {
fuzzel.enable = true;
@ -33,6 +34,7 @@ in
};
programs.niri = {
config = builtins.readFile cfg.config;
package = pkgs.niri-unstable;
};
};
}

View file

@ -11,23 +11,162 @@ in
options = {
youthlic.programs.waybar = {
enable = lib.mkEnableOption "waybar";
configDir = lib.mkOption {
type = lib.types.path;
example = ./config;
description = ''
path to waybar config dir
'';
};
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
waybar
];
xdg.configFile."waybar" = {
programs.waybar = {
enable = true;
source = cfg.configDir;
recursive = true;
systemd.enable = false;
settings = [
{
layer = "top";
position = "top";
modules-left = [
"niri/workspaces"
"wlr/taskbar"
];
modules-center = [ "clock" ];
modules-right = [
"tray"
"idle_inhibitor"
"memory"
"backlight"
"pulseaudio"
"battery"
];
"niri/worksapces" = { };
"niri/taskbar" = {
icon-size = 15;
on-click = "activate";
on-click-middle = "close";
};
"tray" = {
icon-size = 15;
spacing = 10;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
};
memory = {
format = " {percentage}%";
on-click = lib.getExe pkgs.resources;
};
backlight = {
format = "{icon}{percent}%";
format-icons = " ";
on-scroll-up = "${lib.getExe pkgs.brightnessctl} set +1%";
on-scroll-down = "${lib.getExe pkgs.brightnessctl} set 1%-";
};
pulseaudio = {
format = "{icon}{volume}%";
format-bluetooth = " {volume}%";
format-muted = " -%";
format-source = " {volume}%";
format-source-muted = " ";
format-icons = {
default = [
" "
" "
" "
];
headphone = " ";
headset = " ";
hands-free = " ";
};
on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle";
on-click-right = lib.getExe pkgs.pwvucontrol;
tooltip-format = "{icon}{desc} {volume}%";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon}{capacity}%";
format-charging = " {capacity}%";
format-icons = [
" "
" "
" "
" "
" "
];
tooltip-format = ''
{power}W
{timeTo}'';
};
clock = {
format = "{:%a %b %d %R}";
calendar.format = {
months = "<span color='#ff7b63'>{}</span>";
days = "<span color='#ffffff'>{}</span>";
weeks = "<span color='#8ff0a4'>W{}</span>";
weekdays = "<span color='#f8e45c'>{}</span>";
today = "<span color='#78aeed'><u>{}</u></span>";
};
actions = {
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
tooltip-format = "{calendar}";
};
}
];
style = ''
* {
font-family: Noto Sans Mono, Noto Sans Mono CJK SC, FiraCode Nerd Font;
font-weight: bold;
font-size: 14px;
}
window#waybar {
background: alpha(@theme_base_color, 0.9);
color: @theme_text_color;
}
#workspaces,
#taskbar button,
#mode,
#clock,
#tray,
#mpris,
#idle_inhibitor,
#backlight,
#cpu,
#memory,
#pulseaudio,
#battery {
padding: 0 6px;
}
#workspaces button {
padding: 3px 6px;
}
#workspaces button.focused,
#workspaces button.active {
color: #78aeed;
}
#battery.warning {
color: #f8e45c;
}
#battery.critical {
color: #ff7b63;
}
#battery.charging {
color: #8ff0a4;
}
'';
};
};
}