treewide: configure waybar
commitfce8d778d5
Author: Anthony Rodriguez <anthony@nezia.dev> Date: Thu Nov 21 09:49:00 2024 +0100 treewide: add waybar configuration commit858431bc35
Author: Anthony Rodriguez <anthony@nezia.dev> Date: Thu Nov 21 09:48:51 2024 +0100 system/programs/fonts: add nerd fonts symbols only commit8a225b4763
Author: Anthony Rodriguez <anthony@nezia.dev> Date: Thu Nov 21 09:47:00 2024 +0100 modules: add a theme enable option
This commit is contained in:
parent
64db2313b0
commit
8358a2ba12
6 changed files with 264 additions and 3 deletions
148
home/programs/waybar/default.nix
Normal file
148
home/programs/waybar/default.nix
Normal 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
|
||||
];
|
||||
}
|
111
home/programs/waybar/style.nix
Normal file
111
home/programs/waybar/style.nix
Normal 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;
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -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"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{pkgs, ...}: {
|
||||
theme = {
|
||||
enable = true;
|
||||
wallpaper = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/e0cf0eb237dc5baba86661a3572b20a6183c1876/wallpapers/nix-wallpaper-nineish-catppuccin-frappe.png?raw=true";
|
||||
hash = "sha256-/HAtpGwLxjNfJvX5/4YZfM8jPNStaM3gisK8+ImRmQ4=";
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib) mkEnableOption mkOption;
|
||||
inherit (lib.types) string path package;
|
||||
in {
|
||||
imports = [./gtk.nix];
|
||||
options.theme = {
|
||||
enable = mkEnableOption "theme";
|
||||
scheme = mkOption {
|
||||
description = ''
|
||||
Name of the tinted-scheming color scheme to use.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
pkgs.noto-fonts-extra
|
||||
pkgs.intel-one-mono
|
||||
inputs.self.packages.${pkgs.system}.apple-emoji-color
|
||||
(pkgs.nerdfonts.override {fonts = ["IntelOneMono"];})
|
||||
(pkgs.nerdfonts.override {fonts = ["IntelOneMono" "NerdFontsSymbolsOnly"];})
|
||||
];
|
||||
enableDefaultPackages = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue