From e370d6dc9deac7022d8975f7c760688944129fd4 Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Fri, 19 Jan 2024 21:40:26 -0600 Subject: [PATCH] Trying to fix swaync reloading it's still a pain, and improve wallpaper script next --- config/home/hyprland.nix | 3 +- config/home/packages.nix | 6 ++- config/scripts/theme-selector.nix | 2 +- config/scripts/themechange.nix | 7 ++- config/scripts/wallsetter.nix | 73 ++++++++++++++++--------------- config/system/autorun.nix | 15 ++----- default.nix | 4 +- flake.nix | 2 +- 8 files changed, 55 insertions(+), 57 deletions(-) diff --git a/config/home/hyprland.nix b/config/home/hyprland.nix index 0e36d52..9b34aa4 100644 --- a/config/home/hyprland.nix +++ b/config/home/hyprland.nix @@ -1,4 +1,5 @@ -{ pkgs, config, lib, browser, deviceProfile, ... }: +{ pkgs, config, lib, browser, + deviceProfile, wallpaperDir, ... }: let theme = config.colorScheme.colors; diff --git a/config/home/packages.nix b/config/home/packages.nix index 156e91e..522a422 100644 --- a/config/home/packages.nix +++ b/config/home/packages.nix @@ -1,4 +1,5 @@ -{ pkgs, config, browser, wallpaperDir, flakeDir, ... }: +{ pkgs, config, browser, wallpaperDir, flakeDir, + username, wallpaperGit, ... }: { # Install Packages For The User @@ -12,7 +13,8 @@ (import ./../scripts/emopicker9000.nix { inherit pkgs; }) (import ./../scripts/task-waybar.nix { inherit pkgs; }) (import ./../scripts/squirtle.nix { inherit pkgs; }) - (import ./../scripts/wallsetter.nix { inherit pkgs; inherit wallpaperDir; }) + (import ./../scripts/wallsetter.nix { inherit pkgs; inherit wallpaperDir; + inherit username; inherit wallpaperGit; }) (import ./../scripts/themechange.nix { inherit pkgs; inherit flakeDir; }) (import ./../scripts/theme-selector.nix { inherit pkgs; }) ]; diff --git a/config/scripts/theme-selector.nix b/config/scripts/theme-selector.nix index ca03039..757d044 100644 --- a/config/scripts/theme-selector.nix +++ b/config/scripts/theme-selector.nix @@ -11,6 +11,6 @@ pkgs.writeShellScriptBin "theme-selector" '' themechange "$chosen" else ${pkgs.libnotify}/bin/notify-send "$chosen is building please wait" & - kitty -e themechange "$chosen" + themechange "$chosen" fi '' diff --git a/config/scripts/themechange.nix b/config/scripts/themechange.nix index 93f7e8a..78a32e3 100644 --- a/config/scripts/themechange.nix +++ b/config/scripts/themechange.nix @@ -6,9 +6,8 @@ pkgs.writeShellScriptBin "themechange" '' else replacement="$1" sed -i "/^\s*theme[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$replacement\"/" ${flakeDir}/flake.nix - sudo nixos-rebuild switch --flake ${flakeDir} - sleep 1 - ${pkgs.swaynotificationcenter}/bin/swaync-client -R - ${pkgs.swaynotificationcenter}/bin/swaync-client -rs + pkexec nixos-rebuild switch --flake ${flakeDir} + ${pkgs.swaynotificationcenter}/bin/swaync-client -R & + ${pkgs.swaynotificationcenter}/bin/swaync-client -rs & fi '' diff --git a/config/scripts/wallsetter.nix b/config/scripts/wallsetter.nix index 0a5c5f1..1d4c667 100644 --- a/config/scripts/wallsetter.nix +++ b/config/scripts/wallsetter.nix @@ -1,42 +1,45 @@ -{ pkgs, wallpaperDir, }: +{ pkgs, username, wallpaperDir, wallpaperGit, ... }: pkgs.writeShellScriptBin "wallsetter" '' -TIMEOUT=720 -TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30" -TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30" -TRANSITION3="--transition-type center --transition-step 30" -TRANSITION4="--transition-type outer --transition-pos 0.3,0.8 --transition-step 30" -TRANSITION5="--transition-type wipe --transition-angle 270 --transition-step 30" -WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) -PREVIOUS=$WALLPAPER - -while true; -do + TIMEOUT=720 + TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30" + TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30" + TRANSITION3="--transition-type center --transition-step 30" + TRANSITION4="--transition-type outer --transition-pos 0.3,0.8 --transition-step 30" + TRANSITION5="--transition-type wipe --transition-angle 270 --transition-step 30" + WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) + PREVIOUS=$WALLPAPER + rm -rf ${wallpaperDir} + ${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir} + sleep 1 + chown -R ${username}:users ${wallpaperDir} + while true; + do if [ $WALLPAPER == $PREVIOUS ] then - WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) + WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) else - PREVIOUS=$WALLPAPER - NUM=$(shuf -i 1-5 -n 1) - case $NUM in - 1) - TRANSITION=$TRANSITION1 - ;; - 2) - TRANSITION=$TRANSITION2 - ;; - 3) - TRANSITION=$TRANSITION3 - ;; - 4) - TRANSITION=$TRANSITION4 - ;; - 5) - TRANSITION=$TRANSITION5 - ;; - esac - ${pkgs.swww}/bin/swww img $WALLPAPER $TRANSITION - sleep $TIMEOUT + PREVIOUS=$WALLPAPER + NUM=$(shuf -i 1-5 -n 1) + case $NUM in + 1) + TRANSITION=$TRANSITION1 + ;; + 2) + TRANSITION=$TRANSITION2 + ;; + 3) + TRANSITION=$TRANSITION3 + ;; + 4) + TRANSITION=$TRANSITION4 + ;; + 5) + TRANSITION=$TRANSITION5 + ;; + esac + ${pkgs.swww}/bin/swww img $WALLPAPER $TRANSITION + sleep $TIMEOUT fi -done + done '' diff --git a/config/system/autorun.nix b/config/system/autorun.nix index ded2b85..393b0fc 100644 --- a/config/system/autorun.nix +++ b/config/system/autorun.nix @@ -2,15 +2,8 @@ wallpaperGit, username, ... }: { - system.activationScripts = { - gitwallpapers.text = '' - if [ -d ${wallpaperDir} ]; then - cd ${wallpaperDir} - ${pkgs.git}/bin/git pull - else - ${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir} - chown -R ${username}:users ${wallpaperDir} - fi - ''; - }; + # system.userActivationScripts = { + # gitwallpapers.text = '' + # ''; + # }; } diff --git a/default.nix b/default.nix index 9a3495e..38929b0 100644 --- a/default.nix +++ b/default.nix @@ -48,7 +48,7 @@ # List System Programs environment.systemPackages = with pkgs; [ - wget curl cmatrix lolcat neofetch htop btop libvirt + wget curl git cmatrix lolcat neofetch htop btop libvirt polkit_gnome lm_sensors unzip unrar libnotify v4l-utils ydotool wl-clipboard socat cowsay lsd pkg-config meson hugo gnumake ninja go nodejs symbola @@ -66,7 +66,7 @@ enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; }; - + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. programs.mtr.enable = true; diff --git a/flake.nix b/flake.nix index 3f11288..fad1020 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ gitEmail = "tylerzanekelley@gmail.com"; theLocale = "en_US.UTF-8"; theTimezone = "America/Chicago"; - theme = "catppuccin-mocha"; + theme = "catppuccin-frappe"; browser = "firefox"; wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git"; wallpaperDir = "/home/${username}/Pictures/Wallpapers";