From 7903d260541ed23e118c598a97d0619b6fb5e42e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 7 Sep 2024 14:39:40 +0300 Subject: refactor(tazjin/dotfiles): move waybar configuration into Nix Change-Id: Ia031fd755ecf451b0ef1f9e63f3aec8b56fe2d57 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12448 Reviewed-by: tazjin Autosubmit: tazjin Tested-by: BuildkiteCI --- users/tazjin/dotfiles/.skip-subtree | 1 + users/tazjin/dotfiles/default.nix | 7 +++-- users/tazjin/dotfiles/niri.config.kdl | 1 - users/tazjin/dotfiles/waybar/config.jsonc | 29 ------------------ users/tazjin/dotfiles/waybar/config.nix | 51 +++++++++++++++++++++++++++++++ users/tazjin/dotfiles/waybar/style.css | 17 ++++++++++- users/tazjin/home/shared.nix | 9 ++++++ 7 files changed, 82 insertions(+), 33 deletions(-) create mode 100644 users/tazjin/dotfiles/.skip-subtree delete mode 100644 users/tazjin/dotfiles/waybar/config.jsonc create mode 100644 users/tazjin/dotfiles/waybar/config.nix (limited to 'users/tazjin') diff --git a/users/tazjin/dotfiles/.skip-subtree b/users/tazjin/dotfiles/.skip-subtree new file mode 100644 index 000000000000..954981f436ee --- /dev/null +++ b/users/tazjin/dotfiles/.skip-subtree @@ -0,0 +1 @@ +Stuff below here is managed manually, without readTree. diff --git a/users/tazjin/dotfiles/default.nix b/users/tazjin/dotfiles/default.nix index 2e270bbc3891..d536d3a494cd 100644 --- a/users/tazjin/dotfiles/default.nix +++ b/users/tazjin/dotfiles/default.nix @@ -1,5 +1,8 @@ -_: { +args: { dunstrc = ./dunstrc; niri = ./niri.config.kdl; - waybar = ./waybar; + waybar = { + config = import ./waybar/config.nix args; + style = ./waybar/style.css; + }; } diff --git a/users/tazjin/dotfiles/niri.config.kdl b/users/tazjin/dotfiles/niri.config.kdl index 813a049f1b6f..8a9ed39f5a29 100644 --- a/users/tazjin/dotfiles/niri.config.kdl +++ b/users/tazjin/dotfiles/niri.config.kdl @@ -38,7 +38,6 @@ layout { spawn-at-startup "xwayland-satellite" spawn-at-startup "xrandr --output eDP-1 --primary" spawn-at-startup "wpaperd" "-d" -spawn-at-startup "waybar" spawn-at-startup "systemctl --user start xss-lock" environment { diff --git a/users/tazjin/dotfiles/waybar/config.jsonc b/users/tazjin/dotfiles/waybar/config.jsonc deleted file mode 100644 index 6d3dbadb4511..000000000000 --- a/users/tazjin/dotfiles/waybar/config.jsonc +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: idle-inhibitor? image (tux?)? -{ - "layer": "top", - "position": "bottom", - "modules-right": ["pulseaudio", "backlight", "battery", "tray", "clock"], - "pulseaudio": { - "on-click": "pavucontrol", - // Font "Awesome" speaker icons can't be made to render, I don't care why, emoji time. - "format": "{volume}% 🎧", - "format-muted": "{volume}% " - }, - "battery": { - "format": "{capacity}% {icon}", - "format-icons": ["", "", "", "", ""] - }, - "backlight": { - "format": "{percent}% {icon}", - "format-icons": [""], - "on-scroll-up": "light -A 1", - "on-scroll-down": "light -U 1" - }, - "clock": { - "format-alt": "{:%a, %d. %b %H:%M}" - }, - "tray": { - "icon-size": 20, - "spacing": 10 - } -} diff --git a/users/tazjin/dotfiles/waybar/config.nix b/users/tazjin/dotfiles/waybar/config.nix new file mode 100644 index 000000000000..e65edabe7d19 --- /dev/null +++ b/users/tazjin/dotfiles/waybar/config.nix @@ -0,0 +1,51 @@ +{ depot, pkgs, ... }: + +let + launcher = "${pkgs.xfce4-appfinder}/bin/xfce4-appfinder --disable-server"; +in +{ + mainBar = { + layer = "top"; + position = "bottom"; + modules-left = [ "image#start" "custom/start" ]; + + "image#start" = { + path = "${depot.third_party.chicago95}/share/icons/Chicago95/panel/24/start-here.png"; + size = 24; + on-click = "xfce4-appfinder --disable-server"; + }; + + "custom/start" = { + format = " Start"; + on-click = "xfce4-appfinder --disable-server"; + }; + + modules-right = [ "pulseaudio" "backlight" "battery" "tray" "clock" ]; + + pulseaudio = { + on-click = "pavucontrol"; + # Font "Awesome" speaker icons can't be made to render, I don't care why, emoji time. + format = "{volume}% 🎧"; + format-muted = "{volume}% "; + }; + + battery = { + format = "{capacity}% {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; + + backlight = { + format = "{percent}% {icon}"; + format-icons = [ "" ]; + on-scroll-up = "light -A 1"; + on-scroll-down = "light -U 1"; + }; + + clock.format-alt = "{:%a, %d. %b %H:%M}"; + + tray = { + icon-size = 20; + spacing = 10; + }; + }; +} diff --git a/users/tazjin/dotfiles/waybar/style.css b/users/tazjin/dotfiles/waybar/style.css index 5591545085a6..319ef695e23e 100644 --- a/users/tazjin/dotfiles/waybar/style.css +++ b/users/tazjin/dotfiles/waybar/style.css @@ -77,8 +77,23 @@ button:hover { margin: 0 4px; } +#custom-start { + padding-bottom: 1px; + margin-right: 1px; +} + +/* pop out left "modules" (start button) */ +.modules-left { + margin: 3px; + border-right: 1px solid gray; + border-bottom: 1px solid gray; + border-left: 1px solid white; + border-top: 1px solid white; + font-weight: bold; +} + /* indent right modules like in the original */ -.modules-right, .modules-left { +.modules-right { margin: 3px; border-top: 1px solid gray; border-left: 1px solid gray; diff --git a/users/tazjin/home/shared.nix b/users/tazjin/home/shared.nix index 5cbc4b98f068..887668a2f9fd 100644 --- a/users/tazjin/home/shared.nix +++ b/users/tazjin/home/shared.nix @@ -74,6 +74,15 @@ in }; }; + programs.waybar = { + enable = true; + settings = depot.users.tazjin.dotfiles.waybar.config; + style = depot.users.tazjin.dotfiles.waybar.style; + systemd.enable = true; + }; + systemd.user.services.waybar.Unit.After = lib.mkForce [ "niri.service" ]; + + services.swayidle = let cmd = "${pkgs.swaylock}/bin/swaylock -fFkl -c 008080"; in { enable = true; events = [ -- cgit 1.4.1