swaybg only ever renders one frame, so an animated GIF (detected by its magic bytes, not the .gif extension - the active wallpaper file is always literally named wallpaper.png regardless of real format) now goes through awww instead, which was already installed. Found that awww img's --transition-type none - the obvious flag for an instant switch - silently kills the render loop that also drives GIF frame advancement; --transition-step 255 gives the same instant switch without that side effect. New `wallpaper.py start` picks the right backend for whatever's currently active and replaces the hardcoded swaybg autostart line in hyprland.lua, so a GIF wallpaper survives a restart correctly too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
95 lines
3.8 KiB
Bash
Executable File
95 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Clones this rice onto a fresh machine and drops its files into ~/.config.
|
|
#
|
|
# ./install.sh clone/update and install
|
|
# ./install.sh --dry-run show what would happen, change nothing
|
|
# ./install.sh --deps also install dependencies (Arch/pacman only)
|
|
#
|
|
# ~/.config almost always already has *other* apps' configs in it, so this
|
|
# never does a plain `git clone` into it (git refuses a non-empty target
|
|
# anyway). Instead it clones into a temp dir, then moves only the paths this
|
|
# repo actually tracks into ~/.config one by one - anything already there
|
|
# under the same name gets backed up first, never overwritten silently. If
|
|
# ~/.config is already a clone of this repo (re-running this script, or a
|
|
# machine that already has the rice), it just pulls instead.
|
|
set -euo pipefail
|
|
|
|
REPO_URL="${RICING_REPO_URL:-https://github.com/nomminommi23/ricing.git}"
|
|
TARGET="$HOME/.config"
|
|
BACKUP="$HOME/.config-backup-$(date +%Y%m%d-%H%M%S)"
|
|
DRY_RUN=0
|
|
INSTALL_DEPS=0
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--dry-run) DRY_RUN=1 ;;
|
|
--deps) INSTALL_DEPS=1 ;;
|
|
--repo=*) REPO_URL="${arg#--repo=}" ;;
|
|
-h|--help) sed -n '2,10p' "$0"; exit 0 ;;
|
|
*) echo "install.sh: unknown option '$arg'" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
run() {
|
|
if [ "$DRY_RUN" = 1 ]; then
|
|
echo "+ $*"
|
|
else
|
|
"$@"
|
|
fi
|
|
}
|
|
|
|
command -v git >/dev/null || { echo "install.sh: git is required" >&2; exit 1; }
|
|
|
|
# Already a checkout of this repo (fresh install run twice, or a machine that
|
|
# already has the rice) - just update it in place.
|
|
if [ -d "$TARGET/.git" ] && git -C "$TARGET" remote get-url origin 2>/dev/null | grep -qF "$(basename "$REPO_URL" .git)"; then
|
|
echo "~/.config is already a checkout of this repo - pulling instead of cloning."
|
|
run git -C "$TARGET" pull --ff-only
|
|
echo "Done. See the README's Requirements section for dependencies (or re-run with --deps on Arch)."
|
|
exit 0
|
|
fi
|
|
|
|
TMP="$(mktemp -d)"
|
|
trap 'rm -rf "$TMP"' EXIT
|
|
|
|
echo "Cloning $REPO_URL ..."
|
|
run git clone "$REPO_URL" "$TMP/repo"
|
|
[ "$DRY_RUN" = 1 ] && { echo "(dry run: nothing was actually cloned, stopping here)"; exit 0; }
|
|
|
|
mkdir -p "$TARGET"
|
|
moved_any=0
|
|
for entry in "$TMP/repo"/.[!.]* "$TMP/repo"/*; do
|
|
name="$(basename "$entry")"
|
|
[ "$name" = ".git" ] && continue
|
|
[ -e "$entry" ] || continue # unmatched glob
|
|
|
|
dest="$TARGET/$name"
|
|
if [ -e "$dest" ] || [ -L "$dest" ]; then
|
|
mkdir -p "$BACKUP"
|
|
echo " $name already exists in ~/.config - backing it up to $BACKUP/$name"
|
|
mv "$dest" "$BACKUP/$name"
|
|
fi
|
|
mv "$entry" "$dest"
|
|
moved_any=1
|
|
done
|
|
|
|
mv "$TMP/repo/.git" "$TARGET/.git"
|
|
echo "Installed $([ "$moved_any" = 1 ] && echo "the rice" || echo "nothing (repo was empty?)") into $TARGET."
|
|
[ -d "$BACKUP" ] && echo "Anything that was already there got backed up to $BACKUP - safe to delete once you've checked it."
|
|
|
|
if [ "$INSTALL_DEPS" = 1 ]; then
|
|
if command -v pacman >/dev/null; then
|
|
echo "Installing dependencies via pacman (see README.md for apt/dnf equivalents)..."
|
|
sudo pacman -S --needed hyprland sddm xdg-desktop-portal-hyprland quickshell kitty rofi \
|
|
mako thunar thunar-volman thunar-archive-plugin tumbler gvfs gvfs-mtp gvfs-smb \
|
|
xarchiver swaybg awww hyprcursor librsvg grim slurp wl-clipboard cliphist zenity \
|
|
networkmanager network-manager-applet wireplumber pavucontrol blueman brightnessctl \
|
|
playerctl lm_sensors nvidia-utils curl python qt5ct qt6ct nwg-look materia-gtk-theme \
|
|
papirus-icon-theme ttf-jetbrains-mono-nerd
|
|
else
|
|
echo "--deps only knows pacman (Arch). See the Requirements section in README.md for apt/dnf." >&2
|
|
fi
|
|
fi
|
|
|
|
echo "Done. Log out and back into a Hyprland/SDDM session (or reboot) to pick everything up."
|