From b503fe7df50b324905013ff5d531ec435d93d054 Mon Sep 17 00:00:00 2001 From: Tomas Rivera <137088692+Totorile1@users.noreply.github.com> Date: Fri, 27 Feb 2026 10:00:33 +0100 Subject: [PATCH] added wallpaper with swww --- hosts/laptop/configuration.nix | 2 ++ hosts/laptop/home.nix | 1 + modules/home-manager/hyprland.nix | 1 + modules/scripts/wallpaper.nix | 39 +++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 modules/scripts/wallpaper.nix diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 24e5afc..919bb38 100755 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -145,6 +145,8 @@ services.upower.enable = true; hyprkeys # keybind helper cowsay cmatrix + swww #wallpaper daemon + socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically) #we need to install gnome and kde utils individually as we dont use gnome gnome-calculator snapshot diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 4a92fe1..e64c49e 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -40,6 +40,7 @@ home.packages = [ (pkgs.callPackage ../../modules/scripts/batterynotify.nix {}) (pkgs.callPackage ../../modules/scripts/weather.nix {}) (pkgs.callPackage ../../modules/scripts/cowsay.nix {}) +(pkgs.callPackage ../../modules/scripts/wallpaper.nix {}) # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. # pkgs.hello diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 130eabc..e4f30d6 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -137,6 +137,7 @@ "wl-paste --type text --watch cliphist store" # clipboard store text data "wl-paste --type image --watch cliphist store" # clipboard store image data "custom-batterynotify" + "custom-wallpaper" ]; # █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ # █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ diff --git a/modules/scripts/wallpaper.nix b/modules/scripts/wallpaper.nix new file mode 100644 index 0000000..92b421f --- /dev/null +++ b/modules/scripts/wallpaper.nix @@ -0,0 +1,39 @@ +{ writeShellApplication, socat, swww, ... }: + +writeShellApplication { + name = "custom-wallpaper"; + runtimeInputs = [ + socat + swww + ]; + text = '' +handle() { + case $1 in + workspace*) + str=$1 + i=$((''${#str}-1)) + workspace="''${str:$i:1}" + case $workspace in + 1 | 6) + swww img -t none ../../assets/wallpaper1.jpg + ;; + 2 | 7) + swww img -t none ../../assets/wallpaper2.jpg + ;; + 3 | 8) + swww img -t none ../../assets/wallpaper3.jpg + ;; + 4 | 9) + swww img -t none ../../assets/wallpaper4.jpg + ;; + 5 | 10) + swww img -t none ../../assets/wallpaper5.jpg + ;; + esac + ;; + esac +} + +socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done + ''; +}