about summary refs log tree commit diff
path: root/home/wm/waybar
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-08 08:30:17 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-08 08:30:17 -0700
commit2aa3e62136109c5c4762e951525d68aff3e1ac5a (patch)
tree0f508cad82717ac70c7da5fd402c9555ce9166d1 /home/wm/waybar
parenthome: fix for yt-dlp configuration (diff)
downloadworld-2aa3e62136109c5c4762e951525d68aff3e1ac5a.tar.gz
home: add more configurations for home-manager
Diffstat (limited to 'home/wm/waybar')
-rw-r--r--home/wm/waybar/default.nix138
1 files changed, 138 insertions, 0 deletions
diff --git a/home/wm/waybar/default.nix b/home/wm/waybar/default.nix
new file mode 100644
index 0000000..6bc385f
--- /dev/null
+++ b/home/wm/waybar/default.nix
@@ -0,0 +1,138 @@
+{ config, lib, pkgs, ... }:
+let isEnabled = config.my.home.wm.windowManager == "sway";
+in {
+  config = lib.mkIf isEnabled {
+    programs.waybar = {
+      enable = true;
+      systemd = { enable = true; };
+
+      settings = [{
+        layer = "bottom";
+        position = "top";
+        margin-top = 0;
+        margin-left = 0;
+        margin-right = 0;
+        margin-bottom = 0;
+        modules-left = [ "sway/workspaces" "sway/mode" ];
+        modules-right = [ "pulseaudio" "network" "battery" "clock" "tray" ];
+        modules = {
+          "sway/workspaces" = { format = "{name}"; };
+          "sway/mode" = { format = "{}"; };
+          tray = { spacing = 10; };
+          clock = { format = "{: %a %b %d %R}"; };
+          battery = {
+            states = {
+              warning = 30;
+              critical = 15;
+            };
+            format = "ac:{capacity}%";
+            tooltip = true;
+            tooltip-format = "{timeTo} ({capacity}%)";
+          };
+          pulseaudio = {
+            format = "vol:{volume}%";
+            format-bluetooth = "bt:{volume}% {icon} ({format_source})";
+            format-bluetooth-muted = "bt:{volume}%";
+            format-muted = "vol:{volume}%";
+            on-click = "pavucontrol";
+          };
+          "network" = {
+            format-wifi = "{essid}:{signalStrength}%";
+            format-ethernet = "{ipaddr}/{cidr}";
+            format-linked = "{ifname} (No IP)";
+            format-disconnected = "network unavailable";
+            format-alt = "{ifname}: {ipaddr}/{cidr}";
+            tooltip = false;
+          };
+        };
+      }];
+
+      style = ''
+        * {
+          border-radius: 0;
+          border: none;
+          margin: 0;
+          min-height: 0;
+          padding: 0;
+        }
+        #waybar {
+          font-family: Source Code Pro;
+          font-size: 15px;
+        }
+        window#waybar {
+          background-color: rgba(43, 48, 59, 0.5);
+          color: #ffffff;
+          transition-property: background-color;
+          transition-duration: .5s;
+        }
+        #workspaces button {
+          padding: 0 3px;
+          background-color: transparent;
+          color: #888888;
+          box-shadow: inset 0 -3px transparent;
+          font-weight: bold;
+        }
+        #workspaces button.focused {
+          background-color: #285577;
+          border: 1px solid #4c7899;
+          color: #ffffff;
+        }
+        #workspaces button.urgent {
+          background-color: #900000;
+          color: #ffffff;
+          border: 1px solid #2f343a;
+        }
+        #tray {
+          /* No styles */
+        }
+        #clock,
+        #battery,
+        #network,
+        #pulseaudio,
+        #tray,
+        #mode {
+          padding-left: 10px;
+          padding-right: 10px;
+        }
+        #mode {
+          background: #64727D;
+          border-top: 2px solid white;
+          /* To compensate for the top border and still have vertical centering */
+          padding-bottom: 2px;
+        }
+        #clock {
+          /* No styles */
+        }
+        #battery {
+          animation-timing-function: linear;
+          animation-iteration-count: infinite;
+          animation-direction: alternate;
+        }
+        #battery.discharging {
+          color: #90a1ad;
+        }
+        #battery.charging {
+          color: #fffff8;
+        }
+        #battery.warning {
+          border-bottom: 2px solid #ff9e21;
+        }
+        #battery.critical {
+          border-bottom: 2px solid #ff3121;
+        }
+        #network {
+          /* No styles */
+        }
+        #network.disconnected {
+          color: orange;
+        }
+        #pulseaudio {
+          /* No styles */
+        }
+        #pulseaudio.muted {
+          color: #90a1ad;
+        }
+      '';
+    };
+  };
+}