treewide: add waybar configuration

This commit is contained in:
Anthony Rodriguez 2024-11-21 09:49:00 +01:00
parent 858431bc35
commit fce8d778d5
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
3 changed files with 260 additions and 1 deletions

View file

@ -0,0 +1,148 @@
{
osConfig,
pkgs,
lib,
...
}: let
inherit (lib) getExe;
in {
imports = [./style.nix];
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
margin-top = 6;
margin-left = 6;
margin-right = 6;
margin-bottom = 0;
modules-left = ["niri/workspaces" "niri/window"];
modules-center = ["group/clock"];
modules-right = ["tray" "group/status" "group/power"];
battery = {
interval = 60;
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-icons = [
""
""
""
""
""
];
max-length = 25;
};
"niri/window" = {
icon = true;
};
"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"
];
};
"power-profiles-daemon" = {
format-icons = {
default = "";
performance = "";
balanced = "";
power-saver = "";
};
};
"group/status" = {
orientation = "inherit";
modules = [
"pulseaudio"
"power-profiles-daemon"
"network"
"battery"
];
};
"group/power" = {
orientation = "inherit";
modules = [
"custom/power"
];
};
"group/clock" = {
orientation = "inherit";
modules = [
"clock#time"
"clock#date"
];
};
"custom/power" = {
format = "";
tooltip = false;
on-click = getExe pkgs.wlogout;
};
"clock#date" = {
format = "{:%D}";
tooltip-format = "<tt><big>{calendar}</big></tt>";
};
"clock#time" = {
format = "{:%H:%M}";
tooltip-format = "{tz_list}";
timezones = [
osConfig.time.timeZone
"US/Eastern"
];
};
network = {
interface = "wlp1s0";
format = "{ifname}";
format-wifi = "({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} 󰊗";
format-disconnected = "";
tooltip-format = "{ifname} via {gwaddr} 󰊗";
tooltip-format-wifi = "{essid} ({signalStrength}%) ";
tooltip-format-ethernet = "{ifname} ";
tooltip-format-disconnected = "Disconnected";
max-length = 50;
};
};
};
};
home.packages = [
pkgs.pavucontrol
];
}

View file

@ -0,0 +1,111 @@
{
inputs,
lib,
osConfig,
...
}: let
inherit (inputs.basix.schemeData.base16.${osConfig.theme.scheme}) palette;
inherit (builtins) concatStringsSep;
inherit (lib) mapAttrsToList;
generateGtkColors = palette: (concatStringsSep "\n"
(mapAttrsToList
(name: color: "@define-color ${name} ${color};")
palette));
in {
programs.waybar.style = ''
${
if osConfig.theme.enable
then generateGtkColors palette
else ""
}
* {
/* `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.25;
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: @base0E;
color: @base02;
}
#workspaces button.urgent {
background: @base08;
}
#window {
margin-left: 1em;
}
.modules-left,
.modules-right {
margin: 0.4em 0.5em;
}
#battery,
#clock,
#pulseaudio,
#tray,
#power-profiles-daemon {
padding: 0 0.8em;
}
.modules-left,
.modules-right {
margin: 0.4em 0.5em;
}
#custom-power {
padding: 0 1.2em;
color: @base08;
}
'';
}

View file

@ -34,7 +34,7 @@ in {
"${home}/services/udiskie.nix"
"${home}/programs/niri"
"${home}/programs/ironbar"
"${home}/programs/waybar"
"${home}/programs/fuzzel.nix"
"${home}/programs/swaybg.nix"
"${home}/programs/swaylock.nix"