Skip to content

Instantly share code, notes, and snippets.

@zgfif
Last active February 26, 2026 12:00
Show Gist options
  • Select an option

  • Save zgfif/008734750ee384ad867aff27fc99533f to your computer and use it in GitHub Desktop.

Select an option

Save zgfif/008734750ee384ad867aff27fc99533f to your computer and use it in GitHub Desktop.
changewallpaper.sh make callable "changewallpaper"
#!/usr/bin/bash
# default monitor
MONITOR="eDP-1"
# changewallpaper first_argument
WALLPAPER="$1"
if [ ! -f "$WALLPAPER" ]; then
echo "File not found: $WALLPAPER"
exit 1
fi
# path to wallpaper configuration.
CONFIG_PATH="$HOME/.config/hypr/hyprpaper.conf"
# absolute path to wallpaper
ABS_WALLPAPER_PATH=$(realpath "$WALLPAPER")
# change wallpaper for current session.
hyprctl hyprpaper wallpaper $MONITOR,$ABS_WALLPAPER_PATH
# persist changing.
cat > "$CONFIG_PATH" <<EOF
wallpaper {
monitor = $MONITOR
path = $ABS_WALLPAPER_PATH
}
EOF

chmod +x changewallpaper.sh

Перемести его в папку, которая есть в переменной $PATH, например /usr/local/bin:

sudo mv changewallpaper.sh /usr/local/bin/changewallpaper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment