Use waybar alongside sway
- Waybar is an alternative to the default swaybar
- It uses GTK so it looks nicer
- Add waybar configuration
- Add icons to every right-side widget (except tray)
diff --git a/modules/light.nix b/modules/light.nix
new file mode 100644
index 0000000..c6af189
--- /dev/null
+++ b/modules/light.nix
@@ -0,0 +1 @@
+{config.programs.light.enable = true;}
diff --git a/modules/waybar.nix b/modules/waybar.nix
new file mode 100644
index 0000000..f40cc62
--- /dev/null
+++ b/modules/waybar.nix
@@ -0,0 +1,116 @@
+{pkgs, ...}: {
+ home = {
+ programs.waybar = {
+ enable = true;
+ settings = [
+ {
+ modules-left = ["sway/workspaces"];
+
+ modules-center = ["sway/window"];
+
+ modules-right = [
+ "backlight"
+ "pulseaudio"
+ "network"
+ "battery"
+ "clock"
+ "custom/coffee"
+ "custom/notification"
+ "tray"
+ ];
+
+ pulseaudio = {
+ format = "{icon} {volume}%";
+ format-tooltip = "{desc}";
+ format-muted = "đ Muted";
+ format-icons = [
+ "đ"
+ "đ"
+ "đ"
+ ];
+ states.muted = 0;
+ };
+ backlight = {
+ format = "{icon} {percent}%";
+ on-scroll-up = "${pkgs.light}/bin/light -A 3";
+ on-scroll-down = "${pkgs.light}/bin/light -N 1 && ${pkgs.light}/bin/light -U 3";
+ format-icons = [
+ "đ
"
+ "đ"
+ "âī¸"
+ "â¨"
+ ];
+ };
+ network = {
+ format = "đ {ifname}";
+ format-wifi = "đĄ {essid} ({ifname})";
+ format-disabled = "";
+ format-disconnected = "đ No network";
+ tooltip-format = "{ipaddr}/{cidr}";
+ tooltip-format-wifi = "{ipaddr}/{cidr} ({signalStrength}%)";
+ tooltip-format-disconnected = "Disconnected";
+ };
+ battery = {
+ states = {
+ full = 100;
+ warning = 30;
+ critical = 10;
+ };
+ format = "{icon} {capacity}%";
+ format-charging = "đ {capacity}%";
+ format-icons = {
+ full = "đ";
+ warning = "đĒĢ";
+ critical = "đĒĢ";
+ };
+ };
+ "sway/window" = {
+ max-length = 50;
+ };
+ clock = {
+ format = "â° {:%T}";
+ interval = 1;
+ };
+ "custom/notification" = {
+ tooltip = false;
+ format = "{icon}";
+ format-icons = {
+ notification = "đ<sup><span color='#dd2e41'>â</span></sup>";
+ none = "đ";
+ dnd-notification = "đ<sup><span color='#dd2e41'>â</span></sup>";
+ dnd-none = "đ";
+ };
+ "return-type" = "json";
+ "exec-if" = "which ${pkgs.swaynotificationcenter}/bin/swaync-client";
+ "exec" = "${pkgs.swaynotificationcenter}/bin/swaync-client -swb";
+ on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
+ on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw";
+ escape = true;
+ };
+ "custom/coffee" = {
+ tooltip = false;
+ format = "{icon}";
+ format-icons = {
+ none = "đ´";
+ inhibiting = "â";
+ };
+ "return-type" = "json";
+ "exec" = "while sleep 0.1; do ${pkgs.systemd}/bin/systemd-inhibit --list | wc -l | jq '{alt: (if . == 1 then \"none\" else \"inhibiting\" end)} | tostring' -r; done";
+ on-click = ./systemd-inhibit/stop-inhibiting-idle.sh;
+ on-click-right = ./systemd-inhibit/inhibit-idle.sh;
+ escape = true;
+ };
+ }
+ ];
+ style = builtins.readFile ./waybar/main.css;
+ };
+
+ wayland.windowManager.sway.config.startup = [
+ {
+ command = "\"pkill swaync; pkill waybar; ${pkgs.swaynotificationcenter}/bin/swaync & waybar\"";
+ always = true;
+ }
+ ];
+ home.packages = with pkgs; [libappindicator swaynotificationcenter];
+ };
+}
diff --git a/modules/waybar/main.css b/modules/waybar/main.css
new file mode 100644
index 0000000..3f43404
--- /dev/null
+++ b/modules/waybar/main.css
@@ -0,0 +1,119 @@
+window#waybar {
+ background: rgba(0, 0, 0, 0);
+}
+
+window#waybar * * * * {
+ background: alpha(@theme_base_color, 0.6);
+ color: @theme_text_color;
+ padding-left: 10px;
+ padding-right: 10px;
+ border-radius: 5px;
+ margin: 10px 5px;
+ transition: all 0.2s ease-in-out;
+ transition: background 0s;
+}
+
+window#waybar * * *:first-child * {
+ margin-left: 10px;
+}
+
+window#waybar * * *:last-child * {
+ margin-right: 10px;
+}
+
+window#waybar * * * * * {
+ margin: 0;
+ background: rgba(0, 0, 0, 0);
+}
+
+#window {
+ min-width: 50em;
+}
+
+window#waybar * * * #tray * {
+ padding: 0;
+}
+
+window#waybar * * * #tray menu *:first-child {
+ margin-top: 5px;
+}
+
+window#waybar * * * #tray menu *:last-child {
+ margin-bottom: 5px;
+}
+
+window#waybar * * * #tray menu * {
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+window#waybar * * * #tray menu * * {
+ margin: 5px;
+}
+
+window#waybar * * * #tray {
+ padding: 5px;
+}
+
+window#waybar * * * #tray menu {
+ background: alpha(@theme_base_color, 0.8);
+ color: @theme_text_color;
+ border: 0;
+}
+
+#tray menu *:hover {
+ background: alpha(@theme_base_color, 1);
+}
+
+window#waybar #workspaces {
+ padding: 0;
+}
+
+window#waybar #workspaces button {
+ border: 0;
+ margin: 0;
+ padding: 5px;
+}
+
+window#waybar #workspaces button.focused {
+ background: alpha(@theme_base_color, 0.8);
+}
+
+window#waybar #workspaces button.focused:hover {
+ background: alpha(@theme_base_color, 0.9);
+}
+
+window#waybar #workspaces button:hover {
+ background: alpha(@theme_base_color, 0.7);
+}
+
+window#waybar #workspaces button.persistent {
+ background: alpha(#ffdf00, 0.5);
+}
+
+window#waybar #workspaces button.urgent {
+ background: alpha(red, 0.5);
+}
+
+window#waybar #workspaces button:active {
+ background: alpha(@theme_base_color, 1);
+}
+
+#backlight,
+#pulseaudio,
+#network,
+#battery {
+ min-width: 3em;
+}
+
+window#waybar * .modules-right #custom-notification {
+ margin-right: 10px;
+}
+
+window#waybar * .modules-right #tray {
+ margin-left: 0px;
+}
+
+#custom-notification {
+ letter-spacing: -8px;
+}