summaryrefslogtreecommitdiff
path: root/modules/programs/waybar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs/waybar/default.nix')
-rw-r--r--modules/programs/waybar/default.nix212
1 files changed, 212 insertions, 0 deletions
diff --git a/modules/programs/waybar/default.nix b/modules/programs/waybar/default.nix
new file mode 100644
index 0000000..702e3d5
--- /dev/null
+++ b/modules/programs/waybar/default.nix
@@ -0,0 +1,212 @@
+{ config, lib, ... }:
+
+{
+ config = lib.mkIf config.desktop.enable {
+
+ home-manager.users.${config.user} = {
+ programs.waybar = {
+
+ enable = true;
+
+ settings = [{
+ height = 24;
+ layer = "top";
+ position = "top";
+ spacing = 4;
+
+ modules-left = [
+ "hyprland/workspaces"
+ "hyprland/window"
+ ];
+ modules-center = [
+ ];
+ modules-right = [
+ "battery"
+ "wireplumber"
+ "network"
+ "clock"
+ "tray"
+ ];
+
+ "hyprland/workspaces" = {
+ disable-scroll = true;
+ all-outputs = true;
+ format = "{name}";
+ };
+
+ battery = {
+ interval = 1;
+ states = {
+ warning = 30;
+ critical = 15;
+ };
+ forma = " {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 =
+ let
+ accentColor = "#${config.theme.accentColor}";
+ textColor = "#${config.theme.colors.base05}";
+ baseColor = "#${config.theme.colors.base00}";
+ surfaceColor = "#${config.theme.colors.base02}";
+ greenColor = "#${config.theme.colors.base0B}";
+ yellowColor = "#${config.theme.colors.base0A}";
+ redColor = "#${config.theme.colors.base08}";
+ fontSize = "${toString config.theme.fontSize}px";
+ outerGap = "${toString config.theme.outerGap}px";
+ innerGap = "${toString config.theme.innerGap}px";
+ outerRadius = "${toString config.theme.outerRadius}px";
+ innerRadius = "${toString config.theme.innerRadius}px";
+ borderWidth = "${toString config.theme.borderWidth}px";
+ in ''
+
+/** Base */
+
+window#waybar {
+ font-family: "${config.theme.font}", "${config.theme.iconFont}", "${config.theme.monospaceFont}";
+ font-size: ${fontSize};
+ color: ${textColor};
+ background-color: transparent;
+}
+
+window#waybar > box {
+ margin: ${outerGap};
+ margin-bottom: 0px;
+}
+
+.modules-left,
+.modules-right {
+ padding: ${innerGap} 0px;
+ border-radius: ${outerRadius};
+ background-color: @base;
+ border: ${borderWidth} solid ${accentColor};
+}
+
+/** Workspaces */
+
+#workspaces {
+ margin-left: ${innerGap};
+}
+
+#workspaces button {
+ all: initial;
+ color: ${textColor};
+ background-color: transparent;
+ border-radius: ${innerRadius};
+ padding: ${innerGap} ${outerGap};
+}
+
+#workspaces button.focused,
+#workspaces button.active {
+ background-color: ${accentColor};
+ color: ${baseColor};
+}
+
+#workspaces button.urgent {
+ background-color: ${redColor};
+}
+
+/** Window */
+
+window#waybar:not(.empty) #window {
+ padding: 0 ${outerGap};
+ border-left: ${borderWidth} solid ${surfaceColor};
+ margin: 0 ${innerGap};
+}
+
+/** 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,
+#clock {
+ padding: 0 ${outerGap};
+ border-right: ${borderWidth} solid ${surfaceColor};
+ color: @text;
+}
+
+/** Battery */
+
+#battery.charging {
+ color: ${greenColor};
+}
+
+#battery.warning:not(.charging) {
+ color: ${yellowColor};
+}
+
+#battery.critical:not(.charging) {
+ color: ${redColor};
+}
+
+/** Wireplumber */
+
+#wireplumber.muted {
+ color: ${redColor};
+}
+
+/** Network */
+
+#network.wifi,
+#network.ethernet {
+ color: ${greenColor};
+}
+
+#network.disconnected {
+ color: ${redColor};
+}
+ '';
+
+ };
+ };
+
+ };
+}