This commit is contained in:
kenji
2025-08-11 22:23:51 -05:00
parent ae331f28cf
commit 1902d47c1e
3 changed files with 69 additions and 13 deletions
@@ -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)
'';
};
}
);
}
@@ -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 "$@"
@@ -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[*]}"