treewide: update waybar

This commit is contained in:
Anthony Rodriguez 2024-12-19 18:59:03 +01:00
parent cc7eec6a81
commit 26845938e7
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
3 changed files with 231 additions and 247 deletions

View file

@ -1,183 +1,177 @@
{ {
pkgs, pkgs,
lib, lib,
osConfig,
config,
... ...
}: let }: {
inherit (lib) getExe mkMerge mkIf;
inherit (builtins) readFile;
in {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
style = readFile ./style.css;
settings = { settings = {
mainBar = mkMerge [ mainBar = {
{ layer = "top";
layer = "top"; position = "top";
position = "top";
height = 30;
margin-top = 6; modules-left = [
margin-left = 6; "hyprland/window"
margin-right = 6; "pulseaudio"
margin-bottom = 0; "cpu"
"memory"
"idle_inhibitor"
];
modules-left = ["hyprland/workspaces" "hyprland/window"]; modules-center = ["hyprland/workspaces"];
modules-center = ["group/clock"]; modules-right = [
modules-right = "custom/swaync"
["tray" "group/status" "group/power"] "custom/power"
++ lib.optional config.services.swaync.enable "custom/swaync"; "network"
"battery"
"tray"
"clock"
];
tray = { tray = {
icon-size = 16; icon-size = 16;
spacing = 12; spacing = 12;
};
battery = {
interval = 10;
states = {
warning = 30;
critical = 15;
}; };
format = "{icon} {capacity}%";
format-charging = " {capacity}% - {time}";
format-full = " {capacity}% - Full";
format-icons = [
""
""
""
""
""
];
max-length = 25;
};
battery = { "pulseaudio" = {
interval = 10; format = "{icon} {volume}%";
states = { format-bluetooth = "{icon} {volume}%";
warning = 30; format-muted = " ";
critical = 15; format-icons = {
}; "alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
format = "{icon} {capacity}%"; "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = "";
format-charging = " {capacity}% - {time}"; headphone = "";
format-full = " {capacity}% - Full"; hands-free = "";
format-icons = [ headset = "";
"" phone = "";
"" phone-muted = "";
"" portable = "";
"" car = "";
"" default = [
]; ""
max-length = 25; ""
};
"pulseaudio" = {
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = " ";
format-icons = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = "";
headphone = "";
hands-free = "";
headset = "";
phone = "";
phone-muted = "";
portable = "";
car = "";
default = [
""
""
];
};
scroll-step = 1;
on-click = "pavucontrol";
ignored-sinks = [
"Easy Effects Sink"
]; ];
}; };
scroll-step = 1;
on-click = "pavucontrol";
ignored-sinks = [
"Easy Effects Sink"
];
};
"power-profiles-daemon" = { "power-profiles-daemon" = {
format-icons = { format-icons = {
default = ""; default = "";
performance = ""; performance = "";
balanced = ""; balanced = "";
power-saver = ""; power-saver = "";
};
}; };
};
"group/status" = { "custom/power" = {
orientation = "inherit"; format = "";
modules = [ tooltip = false;
"pulseaudio" on-click = lib.getExe pkgs.wlogout;
"power-profiles-daemon" };
"network"
"battery"
];
};
"group/power" = { "memory" = {
orientation = "inherit"; interval = 5;
modules = [ format = " {}%";
"custom/power" tooltip = true;
]; };
};
"group/clock" = { "cpu" = {
orientation = "inherit"; interval = 5;
modules = [ format = " {usage:2}%";
"clock#time" tooltip = true;
"clock#date" };
];
};
"custom/power" = { "idle_inhibitor" = {
format = ""; format = "{icon}";
tooltip = false; format-icons = {
on-click = getExe pkgs.wlogout; activated = "";
deactivated = "";
}; };
tooltip = "true";
};
"clock#date" = { "clock" = {
format = "{:%D}"; format = " {:L%H:%M}";
tooltip-format = "<tt><big>{calendar}</big></tt>"; tooltip = true;
}; tooltip-format = "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>";
};
"clock#time" = { "network" = {
format = "{:%H:%M}"; format-icons = [
tooltip-format = "{tz_list}"; "󰤯"
timezones = [ "󰤟"
osConfig.time.timeZone "󰤢"
"US/Eastern" "󰤥"
]; "󰤨"
}; ];
format-ethernet = " {bandwidthDownOctets}";
format-wifi = "{icon} {signalStrength}%";
format-disconnected = "󰤮";
tooltip = false;
};
network = { "hyprland/window" = {
interface = "wlp1s0"; max-length = 22;
format = "{ifname}"; separate-outputs = false;
format-wifi = "{icon}"; };
format-ethernet = "{ipaddr}/{cidr} 󰊗";
format-disconnected = ""; "hyprland/workspaces" = {
tooltip-format = "{ifname} via {gwaddr} 󰊗"; format = "{name}";
tooltip-format-wifi = "{essid} ({signalStrength}%)"; format-icons = {
tooltip-format-ethernet = "{ifname} "; default = " ";
tooltip-format-disconnected = "Disconnected"; active = " ";
max-length = 50; urgent = " ";
format-icons = [
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
}; };
} on-scroll-up = "hyprctl dispatch workspace e+1";
(mkIf osConfig.programs.niri.enable { on-scroll-down = "hyprctl dispatch workspace e-1";
"niri/window" = { };
icon = true;
"custom/swaync" = {
tooltip = false;
format = "<big>{icon}</big>";
format-icons = {
none = "";
notification = "<span foreground='red'><sup></sup></span>";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
}; };
}) return-type = "json";
(mkIf config.services.swaync.enable { escape = true;
"custom/swaync" = { exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client";
format = "<big>{icon}</big>"; exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar";
format-icons = { on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait";
notification = "󱥁"; on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait";
none = "󰍥"; };
dnd-notification = "󱅮"; };
dnd-none = "󱅯";
};
max-length = 3;
return-type = "json";
escape = true;
exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client";
exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar";
on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait";
on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait";
tooltip-format = "󰵚 {} notification(s)";
};
})
];
}; };
}; };
home.packages = [ home.packages = [

View file

@ -1,91 +0,0 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
border: none;
border-radius: 0px;
min-height: 0;
}
window#waybar {
border-radius: 2em;
font-family: "Symbols Nerd Font", Inter, sans-serif;
font-size: 16px;
font-style: normal;
background: alpha(
@base00,
0.9999999
); /* niri issue workaround, thanks https://github.com/oatmealine/nix-config/blob/bfdddd2cb36ef659bcddc28e0dbb542b6db8b3bc/modules/desktop/themes/catppuccin/waybar.css#L14 */
color: @base05;
}
#workspaces,
.modules-right box {
background: @base02;
padding: 0.15em 0.25em;
border-radius: 1em;
margin: 0 0.25em;
}
#workspaces {
padding: 0;
background: @base02;
}
#workspaces button:nth-child(1) {
border-top-left-radius: 1em;
border-bottom-left-radius: 1em;
}
#workspaces button:nth-last-child(1) {
border-top-right-radius: 1em;
border-bottom-right-radius: 1em;
}
#workspaces button {
padding: 0 0.5em;
background-color: transparent;
}
#workspaces button:hover {
background: rgba(255, 255, 255, 0.1);
box-shadow: none;
}
#workspaces button.active {
background: @base0D;
color: @base02;
}
#workspaces button.urgent {
background: @base08;
}
#window {
margin-left: 1em;
}
.modules-left,
.modules-right {
margin: 0.4em 0.5em;
}
#battery,
#clock,
#network,
#pulseaudio,
#tray,
#power-profiles-daemon {
padding: 0 0.5em;
}
.modules-left,
.modules-right {
margin: 0.4em 0.5em;
}
#custom-power {
padding: 0 1.2em;
color: @base08;
}
#custom-swaync {
padding: 0 1.2em;
}

View file

@ -1,15 +1,96 @@
{ {
lib, lib,
lib',
config, config,
... ...
}: let }: let
cfg = config.local.style; cfg = config.local.style;
betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)";
in { in {
config.home-manager.sharedModules = lib.mkIf cfg.enable [ config.home-manager.sharedModules = lib.mkIf cfg.enable [
{ {
programs.waybar.style = programs.waybar.style = ''
lib'.generateGtkColors lib cfg.scheme.palette; * {
font-family: "0xProto Nerd Font";
font-size: 16px;
border-radius: 0px;
border: none;
min-height: 0px;
}
window#waybar {
background: rgba(0,0,0,0);
}
#workspaces {
color: ${cfg.scheme.palette.base00};
background: ${cfg.scheme.palette.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: ${cfg.scheme.palette.base00};
background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D});
opacity: 0.5;
transition: ${betterTransition};
}
#workspaces button.active {
font-weight: bold;
padding: 0px 5px;
margin: 0px 3px;
border-radius: 16px;
color: ${cfg.scheme.palette.base00};
background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D});
transition: ${betterTransition};
opacity: 1.0;
min-width: 40px;
}
#workspaces button:hover {
font-weight: bold;
border-radius: 16px;
color: ${cfg.scheme.palette.base00};
background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D});
opacity: 0.8;
transition: ${betterTransition};
}
tooltip {
background: ${cfg.scheme.palette.base00};
border: 1px solid ${cfg.scheme.palette.base08};
border-radius: 12px;
}
tooltip label {
color: ${cfg.scheme.palette.base08};
}
#window, #pulseaudio, #cpu, #memory, #idle_inhibitor {
font-weight: bold;
margin: 4px 0px;
margin-left: 7px;
padding: 0px 18px;
background: ${cfg.scheme.palette.base00};
color: ${cfg.scheme.palette.base05};
border-radius: 24px 10px 24px 10px;
}
#network, #battery,
#custom-swaync, #tray, #custom-power {
font-weight: bold;
background: ${cfg.scheme.palette.base00};
color: ${cfg.scheme.palette.base05};
margin: 4px 0px;
margin-right: 7px;
border-radius: 10px 24px 10px 24px;
padding: 0px 18px;
}
#clock {
font-weight: bold;
color: ${cfg.scheme.palette.base00};
background: linear-gradient(90deg, ${cfg.scheme.palette.base0E}, ${cfg.scheme.palette.base0C});
margin: 0px;
padding: 0px 15px 0px 30px;
border-radius: 0px 0px 0px 40px;
}
'';
} }
]; ];
} }