summaryrefslogtreecommitdiff
path: root/modules/desktop/waybar
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-06-23 22:33:44 -0400
committerFreya Murphy <freya@freyacat.org>2025-06-23 22:33:44 -0400
commit328c741b1aac74020412e99e0dca7c728dbc92fa (patch)
tree461f4ebcd3252d542749a34668defd62de356c73 /modules/desktop/waybar
parentremoved unused packages (diff)
downloaddotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.gz
dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.bz2
dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.zip
refactor
Diffstat (limited to 'modules/desktop/waybar')
-rw-r--r--modules/desktop/waybar/default.nix87
-rw-r--r--modules/desktop/waybar/style.nix108
2 files changed, 195 insertions, 0 deletions
diff --git a/modules/desktop/waybar/default.nix b/modules/desktop/waybar/default.nix
new file mode 100644
index 0000000..c2d6927
--- /dev/null
+++ b/modules/desktop/waybar/default.nix
@@ -0,0 +1,87 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.desktop;
+in {
+ config = mkIf cfg.waybar {
+ home-manager.users.${config.user} = {
+ programs.waybar = {
+ enable = false; # using astal now
+
+ settings = [
+ {
+ height = 24;
+ layer = "top";
+ position = "top";
+ spacing = 4;
+
+ modules-left = [
+ "hyprland/workspaces"
+ ];
+ modules-center = [
+ "clock"
+ ];
+ modules-right = [
+ "battery"
+ "wireplumber"
+ "network"
+ "tray"
+ ];
+
+ "hyprland/workspaces" = {
+ disable-scroll = true;
+ all-outputs = true;
+ format = "{name}";
+ };
+
+ battery = {
+ interval = 1;
+ states = {
+ warning = 30;
+ critical = 15;
+ };
+ format = " {capacity}%";
+ format-charging = " {capacity}%";
+ format-plugged = " {capacity}%";
+ format-full = " {capacity}%";
+ format-warning = " {capacity}%";
+ format-critical = " {capacity}%";
+ };
+
+ wireplumber = {
+ format = " {volume}%";
+ format-bluetooth = " {volume}%";
+ format-muted = " muted";
+ scroll-step = 1;
+ on-click = "pavucontrol";
+ ignored-sinks = ["Easy Effects Sink"];
+ };
+
+ network = {
+ format = " disconnected";
+ format-wifi = " {essid}";
+ format-ethernet = " {ipaddr}/{cidr}";
+ format-disconnected = " disconnected";
+ max-length = 50;
+ on-click = "nm-connection-editor";
+ };
+
+ clock = {
+ interval = 1;
+ format = "{:%Y-%m-%d %a %H:%M:%S}";
+ };
+
+ tray = {
+ spacing = config.theme.outerGap;
+ };
+ }
+ ];
+
+ style = import ./style.nix {theme = config.theme;};
+ };
+ };
+ };
+}
diff --git a/modules/desktop/waybar/style.nix b/modules/desktop/waybar/style.nix
new file mode 100644
index 0000000..33db673
--- /dev/null
+++ b/modules/desktop/waybar/style.nix
@@ -0,0 +1,108 @@
+{theme}: let
+ fg = "#${theme.colors.fg}";
+ bg = "#${theme.colors.bg}";
+ surface-fg = "#${theme.colors.surface.fg}";
+ surface-bg = "#${theme.colors.surface.bg}";
+ primary = "#${theme.colors.primary}";
+ success = "#${theme.colors.success}";
+ warning = "#${theme.colors.warning}";
+ error = "#${theme.colors.error}";
+ fontSize = "${toString theme.font.size}px";
+ outerGap = "${toString theme.outerGap}px";
+ innerGap = "${toString theme.innerGap}px";
+ outerRadius = "${toString theme.outerRadius}px";
+ innerRadius = "${toString theme.innerRadius}px";
+ borderWidth = "${toString theme.borderWidth}px";
+in ''
+ /** Base */
+
+ * {
+ all: unset;
+ }
+
+ window#waybar {
+ font-family: "${theme.font.regular}", "${theme.font.icon}", "${theme.font.monospace}";
+ font-size: ${fontSize};
+ color: ${fg};
+ background-color: ${bg};
+ }
+
+ /** Workspaces */
+
+ #workspaces {
+ margin-left: ${outerGap};
+ }
+
+ #workspaces button {
+ border-radius: ${innerRadius};
+ margin: 4px 2px;
+ padding: 0px 7px;
+ background: ${surface-bg};
+ color: ${surface-fg};
+ }
+
+ #workspaces button.focused,
+ #workspaces button.active {
+ background: ${primary};
+ color: ${bg};
+ }
+
+ #workspaces button.urgent {
+ background: ${error};
+ }
+
+ /** Tray */
+
+ #tray {
+ border: none;
+ margin-right: ${outerGap};
+ }
+
+ #tray > .passive {
+ -gtk-icon-effect: dim;
+ }
+
+ #tray > .needs-attention {
+ -gtk-icon-effect: highlight;
+ }
+
+ /** Right modules */
+
+ #battery,
+ #wireplumber,
+ #network {
+ padding: 0 ${outerGap};
+ }
+
+ /** Battery */
+
+ #battery.charging {
+ color: ${success};
+ }
+
+ #battery.warning:not(.charging) {
+ color: ${warning};
+ }
+
+ #battery.critical:not(.charging) {
+ color: ${error};
+ }
+
+ /** Wireplumber */
+
+ #wireplumber.muted {
+ color: ${error};
+ }
+
+ /** Network */
+
+ #network.wifi,
+ #network.ethernet {
+ color: ${success};
+ }
+
+ #network.disconnected {
+ color: ${error};
+ }
+
+''