diff --git a/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper-random.nix b/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper-random.nix index 67212dc3..3f624d02 100644 --- a/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper-random.nix +++ b/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper-random.nix @@ -10,7 +10,7 @@ if [ -d "$directory" ]; then while true; do - sleep 30 + sleep 30 hyprctl hyprpaper unload all for m in ''${monitor[@]}; do random_background=$(ls $directory/*.{png,jpg} | shuf -n 1) diff --git a/homeManagerModules/desktopEnv/river/default.nix b/homeManagerModules/desktopEnv/river/default.nix index bb373c80..dcdb4626 100644 --- a/homeManagerModules/desktopEnv/river/default.nix +++ b/homeManagerModules/desktopEnv/river/default.nix @@ -4,6 +4,7 @@ config, ... }: { + imports = [./randomWallpaper.nix]; options = { desktopEnv.river.enable = lib.mkEnableOption "Enable riverwm with extra apps."; @@ -41,8 +42,13 @@ xfce.xfce4-settings xfce.xfce4-taskmanager xfce.xfconf + swayidle ]; + desktopEnv.river.randomWallpaper.enable = lib.mkDefault true; + + programs.swaylock.enable = lib.mkDefault true; + services.cliphist.enable = lib.mkDefault true; services.kanshi.enable = true; services.kanshi.profiles.framework = { @@ -162,6 +168,7 @@ pkill -f nm-applet pkill -f swayosd-server pkill -f waybar + pkill -f swayidle touchpad=`riverctl list-inputs|grep -i touchpad` for t in ''${touchpad[@]}; do @@ -326,6 +333,7 @@ swayosd-server & thunar --daemon & waybar & + swayidle -w timeout 300 'swaylock -f -c 000000' before-sleep 'swaylock -f -c 000000' & ''; }; } diff --git a/homeManagerModules/desktopEnv/river/randomWallpaper.nix b/homeManagerModules/desktopEnv/river/randomWallpaper.nix new file mode 100644 index 00000000..8fc041cc --- /dev/null +++ b/homeManagerModules/desktopEnv/river/randomWallpaper.nix @@ -0,0 +1,31 @@ +{ + pkgs, + lib, + config, + ... +}: let + swaybg-random = pkgs.writeShellScriptBin "swaybg-random" '' + directory=${config.home.homeDirectory}/.local/share/backgrounds + + if [ -d "$directory" ]; then + while true; do + kill `pidof swaybg` + random_background=$(ls $directory/*.{png,jpg} | shuf -n 1) + swaybg -i $random_background + sleep 900 + done + fi + ''; +in { + options = { + desktopEnv.river.randomWallpaper.enable = + lib.mkEnableOption "Enables swaybg random wallpaper script."; + }; + + config = lib.mkIf config.desktopEnv.river.randomWallpaper.enable { + # Packages that should be installed to the user profile. + home.packages = with pkgs; [swaybg swaybg-random]; + + wayland.windowManager.river.extraConfig = "swaybg-random &"; + }; +} diff --git a/nixosModules/desktopConfig/windowManagers/default.nix b/nixosModules/desktopConfig/windowManagers/default.nix index 35364c76..e43291ac 100644 --- a/nixosModules/desktopConfig/windowManagers/default.nix +++ b/nixosModules/desktopConfig/windowManagers/default.nix @@ -5,4 +5,6 @@ ... }: { imports = [./hyprland]; + + security.pam.services.swaylock = {}; }