From f9e7d0a0390a40db9e70aa8dff80f237508e6833 Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Tue, 6 Jun 2023 19:54:12 +0200 Subject: [PATCH] Configure status bar --- shared/home/gui/default.nix | 1 + shared/home/gui/sway.nix | 3 +- shared/home/gui/waybar.nix | 131 ++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 shared/home/gui/waybar.nix diff --git a/shared/home/gui/default.nix b/shared/home/gui/default.nix index 03f871c..7e0d679 100644 --- a/shared/home/gui/default.nix +++ b/shared/home/gui/default.nix @@ -10,6 +10,7 @@ in { imports = [ ./sway.nix ./term.nix + ./waybar.nix ]; config = lib.mkIf (cfg.enable) { diff --git a/shared/home/gui/sway.nix b/shared/home/gui/sway.nix index 7517d21..e470280 100644 --- a/shared/home/gui/sway.nix +++ b/shared/home/gui/sway.nix @@ -48,7 +48,7 @@ in with lib; { '') ]; - programs.waybar.enable = true; + services.unclutter.enable = true; wayland.windowManager.sway = { # This is all required to get it to not die. @@ -67,6 +67,7 @@ in with lib; { input."type:keyboard".xkb_options = "caps:escape"; terminal = "kitty --single-instance"; + bars = []; # Directional keys modifier = mod; diff --git a/shared/home/gui/waybar.nix b/shared/home/gui/waybar.nix new file mode 100644 index 0000000..96ab82e --- /dev/null +++ b/shared/home/gui/waybar.nix @@ -0,0 +1,131 @@ +{ ... }: { + programs.waybar = { + enable = true; + systemd = { + enable = true; + target = "sway-session.target"; + }; + settings = [{ + layer = "top"; + modules-left = [ + "sway/workspaces" + "sway/mode" + ]; + modules-right = [ + "cpu" + "disk" + "wireplumber" + "network#wifi" + "network#eth" + "clock#date" + "clock#time" + ]; + "clock#time" = { + "format" = "{:%H:%M:%S}"; + "interval" = 1; + }; + "clock#date" = { + "format" = "{:%Y-%m-%d}"; + "interval" = 60; + }; + "network#wifi" = { + "interface" = "wlp6s0"; + }; + "network#eth" = { + "interface" = "enp9s0"; + }; + "wireplumber" = { + "format" = "{node_name}: {volume}%"; + }; + "disk" = { + "format" = "{used} :: {free}"; + }; + }]; + + style = '' + * { + font-family: 'Fira Code'; + font-weight: 700; + font-size: 12px; + } + + window#waybar { + background-color: rgba(0,0,0,0.7); + } + + #workspaces { + margin-left: 5px; + background-color: rgba(0, 0, 0, 0.6); + padding: 0; + margin: 5px; + border-radius: 200px; + } + + #workspaces button { + color: #ffffff; + margin: 0; + padding: 0 5px; + border-radius: 100px; + font-size: 0; + background-color: rgba(0, 0, 0, 0.4); + } + + #workspaces button.visible.focused { + background-color: #ff4787; + } + + #workspaces button.visible { + color: #ffffff; + background-color: rgba(207, 207, 207, 0.4); + } + + #mode { + padding: 2px 10px; + margin: 5px; + border-radius: 100px; + background-color: #1bcf9c; + font-weight: 600; + } + + #clock { + padding: 2px 10px; + margin: 5px; + border-radius: 100px; + color: #ffffff; + background-color: #3988e3; + } + + #clock.date { + background-color: transparent; + } + + #network { + padding: 2px 10px; + margin: 5px; + border-radius: 100px; + background-color: #27e67a; + } + + #wireplumber { + padding: 2px 10px; + margin: 5px; + border-radius: 100px; + background-color: #edd340; + } + + #wireplumber.muted { + color: #ffffff; + background-color: rgba(207, 207, 207, 0.4); + } + + #cpu, #disk { + padding: 2px 10px; + margin: 5px; + border-radius: 100px; + color: #ffffff; + background-color: rgba(0, 0, 0, 0.4); + } + + ''; + }; +}