From 8fcaf6d838c835bc43b609494a3f6cbe075bdbdc Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Sun, 29 Mar 2026 23:27:43 +0000 Subject: [PATCH] Regenerated --- Droidnix/README.html | 596 +++++++++--------- Droidnix/README.org | 20 +- .../Wallpapers/scripts/randomizeWallpapers.sh | 54 ++ .../Wallpapers/scripts/wallpaper.sh | 48 ++ .../scripts/workspace-wallpapers.sh | 71 +-- .../generated/.config/hypr/exec-once.conf | 3 +- .../modules/traveldroid/desktop/wallpaper.nix | 17 +- 7 files changed, 466 insertions(+), 343 deletions(-) create mode 100644 Droidnix/assets/traveldroid/Wallpapers/scripts/randomizeWallpapers.sh create mode 100644 Droidnix/assets/traveldroid/Wallpapers/scripts/wallpaper.sh diff --git a/Droidnix/README.html b/Droidnix/README.html index a0e719e93..ededca2cd 100644 --- a/Droidnix/README.html +++ b/Droidnix/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Droidnix: A Dendritic NixOS + Home Manager Configuration NixOS Configuration Structure @@ -204,114 +204,114 @@

Table of Contents

-
-

Shortcuts

-
+
+

Shortcuts

+

Introduction The Assets Folder @@ -327,26 +327,26 @@

Introduction   intro

-
-

What is Droidnix

-
+
+

What is Droidnix

+

Droidnix is a modular, declarative NixOS + Home Manager configuration system. It allows users to choose between Hyprland and Mangowc as their window manager, with shared and WM-specific configurations managed via Emacs Org and Nix Flakes. The project is designed for reproducibility, maintainability, and cross-machine compatibility.

-
-

Installed components:

-
+
+

Installed components:

+
    -
  • Core
  • -
  • Hyprland
  • -
  • Mangowc
  • +
  • Core
  • +
  • Hyprland
  • +
  • Mangowc
-
-

Goals, project Structure, import hierarchy

-
+
+

Goals, project Structure, import hierarchy

+

This project uses a modular NixOS configuration with Hyprland and MangoWC support, designed for literate programming and cross-device reusability. The Droidnix repository is organized into two main parts: @@ -359,9 +359,9 @@ The Droidnix repository is organized into two main parts:

-
-

Root Level

-
+
+

Root Level

+
  • flake.nix is the entry point and imports:
      @@ -372,16 +372,16 @@ The Droidnix repository is organized into two main parts:
-
-

Generated Structure

-
+
+

Generated Structure

+

The generated/ directory contains all generated configurations, divided into three main groups: system, hyprland, and mangowc.

-
-

First Setup

-
+
+

First Setup

+
  1. Clone this repository.
  2. Run the setup script: ./setup_droid.
  3. @@ -411,9 +411,9 @@ The .assets/ folder contains all static files, such as configs, scr This section contains the Org blocks for tangling Nix code into the generated folders.

-
-

flake.nix

-
+
+

flake.nix

+

The Nix flake definition for Droidnix.

@@ -478,9 +478,9 @@ The Nix flake definition for Droidnix.
-
-

generated/hosts/traveldroid/host.nix

-
+
+

generated/hosts/traveldroid/host.nix

+
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
 
@@ -536,9 +536,9 @@ in
 
-
-

generated/hosts/traveldroid/hardware-configuration.nix

-
+
+

generated/hosts/traveldroid/hardware-configuration.nix

+
  1. Boot into NixOS Live ISO or your installed system.
  2. Open a terminal.
  3. @@ -596,9 +596,9 @@ in
-
-

generated/hosts/traveldroid/boot.nix

-
+
+

generated/hosts/traveldroid/boot.nix

+
{ config, pkgs, lib, flakeRoot, ... }:
 
@@ -650,17 +650,17 @@ in
 
-
-

Following are the imported modules

+
+

Following are the imported modules

-
-

generated/traveldroid/modules/apps

-
+
+

generated/traveldroid/modules/apps

+
-
-

generated/modules/traveldroid/apps/packages.nix

-
+
+

generated/modules/traveldroid/apps/packages.nix

+

This installs a list of apps

@@ -724,9 +724,9 @@ in {
-
-

generated/assets/packages.conf

-
+
+

generated/assets/packages.conf

+

This is a list of additional apps to install

@@ -787,9 +787,9 @@ vlc
-
-

generated/modules/traveldroid/apps/kitty.nix

-
+
+

generated/modules/traveldroid/apps/kitty.nix

+

This file sets up Kitty terminal

@@ -851,9 +851,9 @@ in
-
-

.config/kitty/Catppuccin-Mocha.conf

-
+
+

.config/kitty/Catppuccin-Mocha.conf

+

These are config files for .config/kitty

@@ -944,9 +944,9 @@ color15 #a6adc8
-
-

.config/kitty/kitty.conf

-
+
+

.config/kitty/kitty.conf

+

These are config files for .config/kitty

@@ -968,9 +968,9 @@ font_size 10.0
-
-

generated/modules/traveldroid/apps/starship.nix

-
+
+

generated/modules/traveldroid/apps/starship.nix

+

This file sets up starship prompt

@@ -1010,9 +1010,9 @@ in
-
-

.config/starship.toml

-
+
+

.config/starship.toml

+

These are config files for .config

@@ -1301,9 +1301,9 @@ crust = "#181926"
-
-

generated/modules/traveldroid/apps/thunar.nix

-
+
+

generated/modules/traveldroid/apps/thunar.nix

+

This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

@@ -1343,9 +1343,9 @@ in
-
-

generated/modules/traveldroid/apps/wofi.nix

-
+
+

generated/modules/traveldroid/apps/wofi.nix

+

This is the install for Wofi, the launcher

@@ -1378,9 +1378,9 @@ in
-
-

.config/wofi/config

-
+
+

.config/wofi/config

+

These are config files for .config/wofi

@@ -1427,9 +1427,9 @@ prompt = >
-
-

.config/wofi/style.css

-
+
+

.config/wofi/style.css

+

These are config files for .config/wofi

@@ -1518,9 +1518,9 @@ These are config files for .config/wofi
-
-

generated/modules/traveldroid/apps/zenbrowser.nix

-
+
+

generated/modules/traveldroid/apps/zenbrowser.nix

+

This installs zen browser

@@ -1540,9 +1540,9 @@ in
-
-

generated/modules/traveldroid/apps/zsh.nix

-
+
+

generated/modules/traveldroid/apps/zsh.nix

+

This sets up the zsh in the terminal

@@ -1598,9 +1598,9 @@ in
-
-

=generated/.config/zsh/.zshrc

-
+
+

=generated/.config/zsh/.zshrc

+

This sets up the zsh in the terminal

@@ -1635,9 +1635,9 @@ fi
-
-

generated/modules/traveldroid/apps/emacs/emacs.nix

-
+
+

generated/modules/traveldroid/apps/emacs/emacs.nix

+

This installs emacs

@@ -1733,9 +1733,9 @@ in
-
-

generated/.config/emacs/early-init.el

-
+
+

generated/.config/emacs/early-init.el

+

This contaions emacs

@@ -1836,9 +1836,9 @@ package-archive-priorities '(("gnu" . 99)
-
-

generated/.config/emacs/init.el

-
+
+

generated/.config/emacs/init.el

+

This contaions emacs

@@ -2249,13 +2249,13 @@ the top of the file."
-
-

generated/modules/traveldroid/desktop

-
+
+

generated/modules/traveldroid/desktop

+
-
-

generated/modules/traveldroid/desktop/fonts.nix

-
+
+

generated/modules/traveldroid/desktop/fonts.nix

+

This file installs and configures fonts

@@ -2273,9 +2273,9 @@ This file installs and configures fonts
-
-

generated/modules/traveldroid/desktop/gtk.nix

-
+
+

generated/modules/traveldroid/desktop/gtk.nix

+

Setting up GTK

@@ -2301,9 +2301,9 @@ in
-
-

generated/modules/traveldroid/desktop/hyprland.nix

-
+
+

generated/modules/traveldroid/desktop/hyprland.nix

+

Setting up Hyprland

@@ -2350,9 +2350,9 @@ in
-
-

.config/hypr/animations.conf

-
+
+

.config/hypr/animations.conf

+

These are config files for .config/hypr

@@ -2373,9 +2373,9 @@ animations {
-
-

.config/hypr/behaviour.conf

-
+
+

.config/hypr/behaviour.conf

+

These are config files for .config/hypr

@@ -2417,9 +2417,9 @@ misc {
-
-

.config/hypr/bindings.conf

-
+
+

.config/hypr/bindings.conf

+

These are config files for .config/hypr

@@ -2582,9 +2582,9 @@ bind = $mainMod, W, exec, zen
-
-

.config/hypr/exec-once.conf

-
+
+

.config/hypr/exec-once.conf

+

These are config files for .config/hypr

@@ -2594,14 +2594,15 @@ exec-once = hypridle exec-once = hyprpolkitagent exec-once = systemd-run --user --scope --unit=elephant elephant exec-once = bash -c "sleep 5 && waybar" -exec-once = swww-daemon & +exec-once = swww-daemon & swww img -o eDP-1 ~/Wallpapers/pictures/18.jpg +exec-once = sh ~/Wallpapers/scripts/wallpaper.sh &
-
-

.config/hypr/hypridle.conf

-
+
+

.config/hypr/hypridle.conf

+

These are config files for .config/hypr

@@ -2626,9 +2627,9 @@ listener {
-
-

.config/hypr/hyprland.conf

-
+
+

.config/hypr/hyprland.conf

+

These are config files for .config/hypr

@@ -2675,9 +2676,9 @@ misc {
-
-

.config/hypr/hyprlock.conf

-
+
+

.config/hypr/hyprlock.conf

+

These are config files for .config/hypr

@@ -2718,9 +2719,9 @@ label {
-
-

.config/hypr/layer-rules.conf

-
+
+

.config/hypr/layer-rules.conf

+

These are config files for .config/hypr

@@ -2735,9 +2736,9 @@ layerrule = blur on, ignore_alpha 1, match:namespace swaync-notification-window
-
-

.config/hypr/layout.conf

-
+
+

.config/hypr/layout.conf

+

These are config files for .config/hypr

@@ -2747,9 +2748,9 @@ These are config files for .config/hypr
-
-

.config/hypr/monitor-rules.conf

-
+
+

.config/hypr/monitor-rules.conf

+

These are config files for .config/hypr

@@ -2760,9 +2761,9 @@ monitor=DP-1,3840x1080@144,1920x0,1
-
-

.config/hypr/scripts/layout-selector.sh

-
+
+

.config/hypr/scripts/layout-selector.sh

+

These are config files for .config/hypr/scripts

@@ -2805,9 +2806,9 @@ hyprctl dispatch oSD "Layout: $LAYOUT_NAME" 2000
-
-

.config/hypr/theming.css

-
+
+

.config/hypr/theming.css

+

These are config files for .config/hypr

@@ -2856,9 +2857,9 @@ decoration {
-
-

.config/hypr/window-rules.conf

-
+
+

.config/hypr/window-rules.conf

+

These are config files for .config/hypr

@@ -2882,9 +2883,9 @@ windowrulev2 = floatclass:Wofi,opacity:0.9,blur:15
-
-

.config/hypr/workspace-rules.conf

-
+
+

.config/hypr/workspace-rules.conf

+

These are config files for .config/hypr

@@ -2932,9 +2933,9 @@ workspace {
-
-

generated/modules/traveldroid/desktop/wallpaper.nix

-
+
+

generated/modules/traveldroid/desktop/wallpaper.nix

+

Setting up wallpaper engine + wallpaper gui

@@ -2946,6 +2947,7 @@ let homeDir = "/home/${username}"; wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers"; wallpaperDst = "${homeDir}/Wallpapers"; + randoScript = "${homeDir}/Wallpapers/scripts/randomizeWallpapers.sh"; in { # Make bash available @@ -2984,17 +2986,27 @@ in }; }; - # User service to run the script + # User service to run the script that copies the Wallpaperstuff systemd.user.services.copyWallpapers = { description = "Copy wallpapers from repo to ~/Wallpapers"; - serviceConfig = { Type = "oneshot"; ExecStart = "${homeDir}/copy-wallpapers.sh"; Restart = "no"; WorkingDirectory = homeDir; }; + wantedBy = [ "default.target" ]; + }; + # User service to randomize wallpapers + systemd.user.services.copyWallpapers = { + description = "Copy wallpapers from repo to ~/Wallpapers"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${randoScript}"; + Restart = "no"; + WorkingDirectory = homeDir; + }; wantedBy = [ "default.target" ]; }; @@ -3006,12 +3018,10 @@ in description = "Dynamic wallpapers per workspace for Hyprland"; after = [ "graphical-session.target" ]; wants = [ "graphical-session.target" ]; - serviceConfig = { ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh"; Restart = "always"; }; - wantedBy = [ "default.target" ]; }; } @@ -3019,9 +3029,9 @@ in
-
-

generated/modules/traveldroid/desktop/stylix.nix

-
+
+

generated/modules/traveldroid/desktop/stylix.nix

+
{ lib, config, pkgs, flakeRoot, stylix, ... }:
 
@@ -3113,9 +3123,9 @@ in
 
-
-

.config/stylix/stylix.conf

-
+
+

.config/stylix/stylix.conf

+

These are config files for .config/stylix

@@ -3152,9 +3162,9 @@ icons = {
-
-

.config/stylix/palette.json

-
+
+

.config/stylix/palette.json

+

These are config files for .config/stylix

@@ -3184,9 +3194,9 @@ These are config files for .config/stylix
-
-

.config/stylix/palette.html

-
+
+

.config/stylix/palette.html

+

These are config files for .config/stylix

@@ -3264,9 +3274,9 @@ These are config files for .config/stylix
-
-

generated/modules/traveldroid/desktop/waybar.nix

-
+
+

generated/modules/traveldroid/desktop/waybar.nix

+

This file installs and configures waybar

@@ -3317,9 +3327,9 @@ in
-
-

.config/waybar/config

-
+
+

.config/waybar/config

+

These are config files for waybar

@@ -3442,9 +3452,9 @@ These are config files for waybar
-
-

.config/waybar/style.css

-
+
+

.config/waybar/style.css

+

These are config files for waybar

@@ -3679,9 +3689,9 @@ window#waybar {
-
-

.config/waypaper/config.ini

-
+
+

.config/waypaper/config.ini

+

These are config files for waypaper

@@ -3718,9 +3728,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/modules/traveldroid/desktop/wayland.nix

-
+
+

generated/modules/traveldroid/desktop/wayland.nix

+
{ lib, config, pkgs, ... }:
 
@@ -3750,9 +3760,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
 
-
-

generated/modules/traveldroid/desktop/xdg.nix

-
+
+

generated/modules/traveldroid/desktop/xdg.nix

+

This sets the XDG implementation

@@ -3805,13 +3815,13 @@ in
-
-

generated/modules/traveldroid/system

-
+
+

generated/modules/traveldroid/system

+
-
-

generated/modules/traveldroid/system/bluetooth.nix

-
+
+

generated/modules/traveldroid/system/bluetooth.nix

+
{ lib, config, pkgs, flakeRoot, home-manager, ... }:
 
@@ -3852,9 +3862,9 @@ in
 
-
-

generated/modules/traveldroid/system/dbus.nix

-
+
+

generated/modules/traveldroid/system/dbus.nix

+

This sets the dbus implementation

@@ -3881,9 +3891,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/login-tuigreet.nix

-
+
+

generated/modules/traveldroid/system/login-tuigreet.nix

+

This sets up tuigreeter which is not fancy but imo fits the aesthetic I am aiming for

@@ -3937,9 +3947,9 @@ in
-
-

generated/modules/traveldroid/system/networking.nix

-
+
+

generated/modules/traveldroid/system/networking.nix

+

This sets the networking.

@@ -4003,9 +4013,9 @@ This sets the networking.
-
-

generated/modules/traveldroid/system/nix.nix

-
+
+

generated/modules/traveldroid/system/nix.nix

+
{ lib, config, ... }:
 
@@ -4022,13 +4032,13 @@ This sets the networking.
 
-
-

generated/users

-
+
+

generated/users

+
-
-

generated/parked/users/copy_config_2_config.nix

-
+
+

generated/parked/users/copy_config_2_config.nix

+

This copies stuff to the user home-folder

@@ -4079,9 +4089,9 @@ in
-
-

generated/users/henrov.nix

-
+
+

generated/users/henrov.nix

+

This is the default user, just search and replace henrov another name if you want to change

@@ -4136,9 +4146,9 @@ in

These are all the prepared config files

-
-

.config/waybar/style.css

-
+
+

.config/waybar/style.css

+

These are config files for .config/waybar

@@ -4372,9 +4382,9 @@ window#waybar {
-
-

.config/waypaper/config.ini

-
+
+

.config/waypaper/config.ini

+

These are config files for .config/waypaper

@@ -4411,9 +4421,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

.config/zed/settings.json

-
+
+

.config/zed/settings.json

+

These are config files for .config/zed

@@ -4453,7 +4463,7 @@ These are config files for .config/zed

Author: Henro Veijer

-

Created: 2026-03-29 Sun 21:43

+

Created: 2026-03-29 Sun 23:27

Validate

diff --git a/Droidnix/README.org b/Droidnix/README.org index 530f99e60..9de897016 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -2080,7 +2080,8 @@ exec-once = hypridle exec-once = hyprpolkitagent exec-once = systemd-run --user --scope --unit=elephant elephant exec-once = bash -c "sleep 5 && waybar" -exec-once = swww-daemon & +exec-once = swww-daemon & swww img -o eDP-1 ~/Wallpapers/pictures/18.jpg +exec-once = sh ~/Wallpapers/scripts/wallpaper.sh & #+END_SRC ** =.config/hypr/hypridle.conf= @@ -2366,6 +2367,7 @@ let homeDir = "/home/${username}"; wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers"; wallpaperDst = "${homeDir}/Wallpapers"; + randoScript = "${homeDir}/Wallpapers/scripts/randomizeWallpapers.sh"; in { # Make bash available @@ -2404,17 +2406,27 @@ in }; }; - # User service to run the script + # User service to run the script that copies the Wallpaperstuff systemd.user.services.copyWallpapers = { description = "Copy wallpapers from repo to ~/Wallpapers"; - serviceConfig = { Type = "oneshot"; ExecStart = "${homeDir}/copy-wallpapers.sh"; Restart = "no"; WorkingDirectory = homeDir; }; + wantedBy = [ "default.target" ]; + }; + # User service to randomize wallpapers + systemd.user.services.copyWallpapers = { + description = "Copy wallpapers from repo to ~/Wallpapers"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${randoScript}"; + Restart = "no"; + WorkingDirectory = homeDir; + }; wantedBy = [ "default.target" ]; }; @@ -2426,12 +2438,10 @@ in description = "Dynamic wallpapers per workspace for Hyprland"; after = [ "graphical-session.target" ]; wants = [ "graphical-session.target" ]; - serviceConfig = { ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh"; Restart = "always"; }; - wantedBy = [ "default.target" ]; }; } diff --git a/Droidnix/assets/traveldroid/Wallpapers/scripts/randomizeWallpapers.sh b/Droidnix/assets/traveldroid/Wallpapers/scripts/randomizeWallpapers.sh new file mode 100644 index 000000000..9d22eee50 --- /dev/null +++ b/Droidnix/assets/traveldroid/Wallpapers/scripts/randomizeWallpapers.sh @@ -0,0 +1,54 @@ +#!/run/current-system/sw/bin/bash +set -euo pipefail + +WALLPAPER_DIR="$HOME/Wallpapers/pictures" +echo "Wallpaper dir = $WALLPAPER_DIR" + +randomize_and_rename_wallpapers() { + echo "Randomizing JPG filenames..." + + shopt -s nullglob + + # Grab all jpg/JPG files + files=("$WALLPAPER_DIR"/*.[jJ][pP][gG]) + + if [ ${#files[@]} -eq 0 ]; then + echo "No JPG files found in $WALLPAPER_DIR" + return + fi + + # Shuffle the array + mapfile -t files < <(printf "%s\n" "${files[@]}" | shuf) + + tmp_names=() + + for file in "${files[@]}"; do + ext="${file##*.}" + + # generate a random 16-character alphanumeric name + while : ; do + rand_name=$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c16) + new_path="$WALLPAPER_DIR/$rand_name.$ext" + if [[ ! -e "$new_path" ]]; then + mv "$file" "$new_path" + tmp_names+=("$new_path") + echo "Renamed $file -> $new_path" + break + fi + done + done + + # Sequentially rename to 01.jpg ... 99.jpg + counter=1 + for file in "${tmp_names[@]}"; do + new_name=$(printf "%02d.jpg" "$counter") + mv "$file" "$WALLPAPER_DIR/$new_name" + echo "Final rename $file -> $WALLPAPER_DIR/$new_name" + ((counter++)) + [[ $counter -gt 99 ]] && break + done + + echo "Randomization complete." +} + +randomize_and_rename_wallpapers diff --git a/Droidnix/assets/traveldroid/Wallpapers/scripts/wallpaper.sh b/Droidnix/assets/traveldroid/Wallpapers/scripts/wallpaper.sh new file mode 100644 index 000000000..da4ed4637 --- /dev/null +++ b/Droidnix/assets/traveldroid/Wallpapers/scripts/wallpaper.sh @@ -0,0 +1,48 @@ +#!/bin/sh +set -euo pipefail + +WALLPAPER_DIR="$HOME/Wallpapers" + +# ----------------------------- +# Set wallpaper on all monitors +# ----------------------------- +set_wallpaper_all_monitors() { + pic="$1" + monitors=$(hyprctl monitors -j | jq -r '.[].name') # list all monitor names + for m in $monitors; do + swww img -o "$m" -t fade --transition-duration 1 "$pic" + done +} + +# ----------------------------- +# Handle workspace events +# ----------------------------- +handle() { + case $1 in + workspace*) + workspace="${1: -1}" # last character + pic="" + case $workspace in + 1) pic="$WALLPAPER_DIR/01.jpg" ;; + 2) pic="$WALLPAPER_DIR/02.jpg" ;; + 3) pic="$WALLPAPER_DIR/03.jpg" ;; + 4) pic="$WALLPAPER_DIR/04.jpg" ;; + 5) pic="$WALLPAPER_DIR/05.jpg" ;; + 6) pic="$WALLPAPER_DIR/06.jpg" ;; + 7) pic="$WALLPAPER_DIR/07.jpg" ;; + 8) pic="$WALLPAPER_DIR/08.jpg" ;; + 9) pic="$WALLPAPER_DIR/09.jpg" ;; + 10) pic="$WALLPAPER_DIR/10.jpg" ;; + esac + + [ -n "$pic" ] && set_wallpaper_all_monitors "$pic" + ;; + esac +} + +# ----------------------------- +# Listen to Hyprland socket events +# ----------------------------- +socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do + handle "$line" +done \ No newline at end of file diff --git a/Droidnix/assets/traveldroid/Wallpapers/scripts/workspace-wallpapers.sh b/Droidnix/assets/traveldroid/Wallpapers/scripts/workspace-wallpapers.sh index f44d47de7..177debc1d 100755 --- a/Droidnix/assets/traveldroid/Wallpapers/scripts/workspace-wallpapers.sh +++ b/Droidnix/assets/traveldroid/Wallpapers/scripts/workspace-wallpapers.sh @@ -1,50 +1,41 @@ #!/run/current-system/sw/bin/bash set -euo pipefail -echo "Running as $(whoami)" -currentuser=$(whoami) # or set manually + currentpath=/run/current-system/sw/bin - -while [ ! -S "$IPC_SOCKET" ]; do - echo "Waiting for Hyprland socket..." - sleep 1 -done - -# ----------------------------- -# Configuration -# ----------------------------- PICTURES_DIR="$HOME/Wallpapers/pictures" -NAMESPACE="main" # Fixed swww namespace -MONITOR=$($currentpath/hyprctl monitors -j | $currentpath/jq -r '.[0].name') +NAMESPACE="main" -# ----------------------------- -# Start swww-daemon if not running -# ----------------------------- -if ! pgrep -x $currentpath/swww-daemon >/dev/null; then - echo "Starting swww-daemon..." - $currentpath/swww-daemon --namespace "$NAMESPACE" & - sleep 0.5 # give socket time to appear -fi +: "${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR is not set}" +: "${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE is not set}" -# ----------------------------- -# Gather wallpapers -# ----------------------------- -mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \)) -if [ "${#IMAGES[@]}" -eq 0 ]; then - echo "No images found in $PICTURES_DIR" - exit 1 -fi - -# ----------------------------- -# Workspace event listener -# ----------------------------- IPC_SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" -echo "Listening for workspace events on $IPC_SOCKET..." -$currentpath/socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do - if [[ "$line" =~ workspace\#([0-9]+) ]]; then - WS="${BASH_REMATCH[1]}" - RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}" - echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE" - $currentpath/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS" +while [ ! -S "$IPC_SOCKET" ]; do sleep 1; done + +echo $IPC_SOCKET + +# Start swww-daemon only if not already running for this namespace +if [ ! -S "$XDG_RUNTIME_DIR/swww/$NAMESPACE.sock" ]; then + "$currentpath/swww-daemon" --namespace "$NAMESPACE" & + sleep 0.5 +fi + +# Load wallpapers +mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \)) +[ "${#IMAGES[@]}" -eq 0 ] && exit 1 + +# Subscribe to workspace events +{ + echo '{"subscribe":["workspace"]}' + "$currentpath/socat" - UNIX-CONNECT:"$IPC_SOCKET" +} | while read -r line; do + # Only parse lines starting with '{' (JSON) + if [[ "$line" =~ ^\{ ]]; then + WS_NUM=$(echo "$line" | "$currentpath/jq" -e -r 'select(.type=="workspace" and .active==true) | .workspace' 2>/dev/null || true) + if [ -n "$WS_NUM" ]; then + RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}" + MONITOR=$(echo "$line" | "$currentpath/jq" -r '.monitor') + "$currentpath/swww" img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS_NUM" + fi fi done diff --git a/Droidnix/generated/.config/hypr/exec-once.conf b/Droidnix/generated/.config/hypr/exec-once.conf index fae565cd3..1d15d54e5 100644 --- a/Droidnix/generated/.config/hypr/exec-once.conf +++ b/Droidnix/generated/.config/hypr/exec-once.conf @@ -3,4 +3,5 @@ exec-once = hypridle exec-once = hyprpolkitagent exec-once = systemd-run --user --scope --unit=elephant elephant exec-once = bash -c "sleep 5 && waybar" -exec-once = swww-daemon & +exec-once = swww-daemon & swww img -o eDP-1 ~/Wallpapers/pictures/18.jpg +exec-once = sh ~/Wallpapers/scripts/wallpaper.sh & diff --git a/Droidnix/generated/modules/traveldroid/desktop/wallpaper.nix b/Droidnix/generated/modules/traveldroid/desktop/wallpaper.nix index 2a864ee62..9a1f8ef7d 100644 --- a/Droidnix/generated/modules/traveldroid/desktop/wallpaper.nix +++ b/Droidnix/generated/modules/traveldroid/desktop/wallpaper.nix @@ -5,6 +5,7 @@ let homeDir = "/home/${username}"; wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers"; wallpaperDst = "${homeDir}/Wallpapers"; + randoScript = "${homeDir}/Wallpapers/scripts/randomizeWallpapers.sh"; in { # Make bash available @@ -43,17 +44,27 @@ in }; }; - # User service to run the script + # User service to run the script that copies the Wallpaperstuff systemd.user.services.copyWallpapers = { description = "Copy wallpapers from repo to ~/Wallpapers"; - serviceConfig = { Type = "oneshot"; ExecStart = "${homeDir}/copy-wallpapers.sh"; Restart = "no"; WorkingDirectory = homeDir; }; + wantedBy = [ "default.target" ]; + }; + # User service to randomize wallpapers + systemd.user.services.copyWallpapers = { + description = "Copy wallpapers from repo to ~/Wallpapers"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${randoScript}"; + Restart = "no"; + WorkingDirectory = homeDir; + }; wantedBy = [ "default.target" ]; }; @@ -65,12 +76,10 @@ in description = "Dynamic wallpapers per workspace for Hyprland"; after = [ "graphical-session.target" ]; wants = [ "graphical-session.target" ]; - serviceConfig = { ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh"; Restart = "always"; }; - wantedBy = [ "default.target" ]; }; }