From fc6703d8532813f575d192ac70a973bbada15408 Mon Sep 17 00:00:00 2001 From: willifan Date: Mon, 21 Apr 2025 12:09:00 +0200 Subject: [PATCH] added waybar --- .../desktop/compositors/default.nix | 1 + .../home-manager/desktop/compositors/niri.nix | 4 - .../desktop/compositors/waybar.nix | 153 ++++++++++++++++++ 3 files changed, 154 insertions(+), 4 deletions(-) create mode 100644 modules/default/home-manager/desktop/compositors/waybar.nix diff --git a/modules/default/home-manager/desktop/compositors/default.nix b/modules/default/home-manager/desktop/compositors/default.nix index 5b27783..d8aafa9 100644 --- a/modules/default/home-manager/desktop/compositors/default.nix +++ b/modules/default/home-manager/desktop/compositors/default.nix @@ -4,5 +4,6 @@ imports = [ ./niri.nix ./river.nix + ./waybar.nix ]; } diff --git a/modules/default/home-manager/desktop/compositors/niri.nix b/modules/default/home-manager/desktop/compositors/niri.nix index ee92db5..cfbdb9f 100644 --- a/modules/default/home-manager/desktop/compositors/niri.nix +++ b/modules/default/home-manager/desktop/compositors/niri.nix @@ -12,7 +12,6 @@ lib.mkIf config.desktop.wm.niri.enable { home.packages = [ pkgs.xwayland-satellite - pkgs.ewwbar ]; programs.niri.settings = { @@ -22,9 +21,6 @@ lib.mkIf config.desktop.wm.niri.enable { { command = [ "xwayland-satellite" ":0" ]; } - { - command = [ "ewwbar" ]; - } ]; hotkey-overlay.skip-at-startup = true; diff --git a/modules/default/home-manager/desktop/compositors/waybar.nix b/modules/default/home-manager/desktop/compositors/waybar.nix new file mode 100644 index 0000000..fedf2ab --- /dev/null +++ b/modules/default/home-manager/desktop/compositors/waybar.nix @@ -0,0 +1,153 @@ +{ lib, config, pkgs, ... }: +let + icons = fetchTarball { + url = "https://files.huwe.mooo.com/waybar.tar.gz"; + sha256 = "0h5r8r7vscm6yv25kgyzx5y325n5ri78n28vmdvgmysp351drm57"; + }; +in +lib.mkIf config.desktop.wm.niri.enable { + home-manager.users.willifan = { + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 25; + output = [ + "eDP-1" + ]; + modules-left = [ "clock" "mpris" ]; + modules-center = [ "niri/workspaces" ]; + modules-right = [ "tray" "group/ressources" "group/peripherals" "group/wireless" "group/power" ]; + + "group/ressources" = { + orientation = "inherit"; + modules = [ "group/cpu" "group/memory" ]; + }; + "group/peripherals" = { + orientation = "inherit"; + modules = [ "group/volume" "group/backlight" ]; + }; + "group/wireless" = { + orientation = "inherit"; + modules = [ "group/networking" "group/bluetooth" ]; + }; + "group/power" = { + orientation = "inherit"; + modules = [ "group/battery" "image#power" ]; + }; + + + "clock" = { + interval = 1; + format = "{:%H:%M:%S}"; + }; + "mpris" = { + format = ""; + format-playing = "{dynamic}"; + dynamic-order = [ "title" "artist" "album" "position" "length" ]; + dynamic-len = 30; + }; + "niri/workspaces" = { + all-outputs = true; + }; + + "group/cpu" = { + orientation = "inherit"; + modules = [ "image#cpu" "cpu" ]; + }; + "image#cpu" = { + path = "${icons}/cpu.png"; + size = 16; + }; + "cpu" = { + format = "{usage}%"; + }; + + "group/memory" = { + orientation = "inherit"; + modules = [ "image#memory" "memory" ]; + }; + "image#memory" = { + path = "${icons}/ram.png"; + size = 16; + }; + "memory" = { + format = "{percentage}%"; + }; + + "group/volume" = { + orientation = "inherit"; + modules = [ "image#volume" "wireplumber" ]; + }; + "image#volume" = { + path = "${icons}/volume.png"; + size = 16; + }; + "wireplumber" = { + format = "{volume}%"; + }; + + "group/backlight" = { + orientation = "inherit"; + modules = [ "image#backlight" "backlight" ]; + }; + "image#backlight" = { + path = "${icons}/brightness.png"; + size = 16; + }; + "backlight" = { + format = "{percent}%"; + }; + + "group/networking" = { + orientation = "inherit"; + modules = [ "image#networking" "network" ]; + }; + "image#networking" = { + path = "${icons}/wifiHigh.png"; + size = 16; + }; + "network" = { + format = "{signalStrength}%"; + }; + + "group/bluetooth" = { + orientation = "inherit"; + modules = [ "image#bluetooth" "bluetooth" ]; + }; + "image#bluetooth" = { + path = "${icons}/bluetooth.png"; + size = 16; + }; + "bluetooth" = { + format = "{status}"; + }; + + "group/battery" = { + orientation = "inherit"; + modules = [ "image#battery" "battery" ]; + }; + "image#battery" = { + path = "${icons}/battery.png"; + size = 16; + }; + "battery" = { + format = "{capacity}%"; + }; + + "image#power" = { + path = "${icons}/power.png"; + size = 16; + }; + }; + }; + + systemd = { + enable = true; + }; + + }; + }; +}