diff --git a/.config/quickshell/ii/scripts/colors/flake.nix b/.config/quickshell/ii/scripts/colors/flake.nix new file mode 100644 index 000000000..4029adf1e --- /dev/null +++ b/.config/quickshell/ii/scripts/colors/flake.nix @@ -0,0 +1,50 @@ +{ + description = "Development shell for switchwall.sh"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github.com/numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + + pythonWithPackages = pkgs.python3.withPackages (ps: + with ps; [ + materialyoucolor + pillow + ]); + in { + devShells.default = pkgs.mkShell { + packages = [ + pkgs.bash + pkgs.jq + pkgs.imagemagick # Provides the 'identify' command + pkgs.ffmpeg + pkgs.mpvpaper + pkgs.kitty # The terminal used in the script + pkgs.kdialog + pkgs.libnotify # Provides notify-send + pkgs.hyprpicker + pkgs.matugen + pythonWithPackages + ]; + + shellHook = '' + export XDG_CONFIG_HOME=$HOME/.config + export XDG_CACHE_HOME=$HOME/.cache + export XDG_STATE_HOME=$HOME/.local/state + export ILLOGICAL_IMPULSE_VIRTUAL_ENV=$XDG_STATE_HOME/quickshell/.venv + export PATH=$PATH:${pkgs.matugen}/bin + export SCRIPT_DIR=$(pwd) + ''; + }; + } + ); +} diff --git a/.config/quickshell/ii/scripts/colors/nix_switchwall.sh b/.config/quickshell/ii/scripts/colors/nix_switchwall.sh new file mode 100644 index 000000000..555d59063 --- /dev/null +++ b/.config/quickshell/ii/scripts/colors/nix_switchwall.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")" + +# Execute the switchwall.sh script within the Nix environment. +nix develop --command ./switchwall.sh "$@" diff --git a/.config/quickshell/ii/scripts/colors/switchwall.sh b/.config/quickshell/ii/scripts/colors/switchwall.sh index 31db37b40..6edb97e5b 100755 --- a/.config/quickshell/ii/scripts/colors/switchwall.sh +++ b/.config/quickshell/ii/scripts/colors/switchwall.sh @@ -63,9 +63,9 @@ post_process() { # echo "Error: least_busy_region.py script not found in $MATUGEN_DIR/scripts/" # else # "$MATUGEN_DIR/scripts/least_busy_region.py" \ - # --screen-width "$screen_width" --screen-height "$screen_height" \ - # --width 300 --height 200 \ - # "$wallpaper_path" > "$STATE_DIR"/user/generated/wallpaper/least_busy_region.json + # --screen-width "$screen_width" --screen-height "$screen_height" \ + # --width 300 --height 200 \ + # "$wallpaper_path" > "$STATE_DIR"/user/generated/wallpaper/least_busy_region.json # fi } @@ -85,18 +85,18 @@ check_and_prompt_upscale() { fi if [[ "$img_width" -lt "$min_width_desired" || "$img_height" -lt "$min_height_desired" ]]; then action=$(notify-send "Upscale?" \ - "Image resolution (${img_width}x${img_height}) is lower than screen resolution (${min_width_desired}x${min_height_desired})" \ - -A "open_upscayl=Open Upscayl"\ + "Image resolution (${img_width}x${img_height}) is lower than screen resolution (${min_width_desired}x${min_height_desired})" \ + -A "open_upscayl=Open Upscayl"\ -a "Wallpaper switcher") if [[ "$action" == "open_upscayl" ]]; then if command -v upscayl &>/dev/null; then nohup upscayl > /dev/null 2>&1 & else action2=$(notify-send \ - -a "Wallpaper switcher" \ - -c "im.error" \ - -A "install_upscayl=Install Upscayl (Arch)" \ - "Install Upscayl?" \ + -a "Wallpaper switcher" \ + -c "im.error" \ + -A "install_upscayl=Install Upscayl (Arch)" \ + "Install Upscayl?" \ "yay -S upscayl-bin") if [[ "$action2" == "install_upscayl" ]]; then kitty -1 yay -S upscayl-bin @@ -204,10 +204,10 @@ switch() { echo "Missing deps: ${missing_deps[*]}" echo "Arch: sudo pacman -S ${missing_deps[*]}" action=$(notify-send \ - -a "Wallpaper switcher" \ - -c "im.error" \ - -A "install_arch=Install (Arch)" \ - "Can't switch to video wallpaper" \ + -a "Wallpaper switcher" \ + -c "im.error" \ + -A "install_arch=Install (Arch)" \ + "Can't switch to video wallpaper" \ "Missing dependencies: ${missing_deps[*]}") if [[ "$action" == "install_arch" ]]; then kitty -1 sudo pacman -S "${missing_deps[*]}"