minor fix
This commit is contained in:
1 parent
7286c99e90
commit
a5b23da5bf
11 files changed
+108
-65
No files matched your search
@@ -1,11 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Wallpaper directory
|
||||
DIR="$HOME/Pictures/wallpapers"
|
||||
|
||||
# Find wallpapers
|
||||
PICS=($(find "${DIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
|
||||
|
||||
PICS=($(find ${DIR} -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
|
||||
RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]}
|
||||
# Check if there are wallpapers in the specified directory
|
||||
if [ ${#PICS[@]} -eq 0 ]; then
|
||||
echo "No wallpapers found in ${DIR}. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Randomly select a wallpaper
|
||||
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
|
||||
|
||||
# Transition config
|
||||
FPS=60
|
||||
@@ -14,8 +22,14 @@ DURATION=1
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER"
|
||||
|
||||
# Check if swww is initialized, and initialize if not
|
||||
swww query || swww init
|
||||
|
||||
swww query || swww init && swww img ${RANDOMPICS} $SWWW_PARAMS
|
||||
# Set the wallpaper with transition parameters
|
||||
swww img "${RANDOMPICS}" $SWWW_PARAMS
|
||||
|
||||
ln -sf "$RANDOMPICS" "$HOME/.config/hypr/.current_wallpaper"
|
||||
# Notify that the wallpaper has changed
|
||||
notify-send "Wallpaper Changed" -i "${RANDOMPICS}"
|
||||
|
||||
# Create a symbolic link to the current wallpaper
|
||||
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
@@ -2,34 +2,34 @@
|
||||
|
||||
DIR="$HOME/Pictures/wallpapers/"
|
||||
PICS=($(find "${DIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
|
||||
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
|
||||
|
||||
# Create symbolic link to the selected wallpaper
|
||||
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
# Check if swww is initialized
|
||||
swww query || swww init
|
||||
|
||||
# Set the wallpaper
|
||||
swww img "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
|
||||
# Check if there are wallpapers in the specified directory
|
||||
if [ ${#PICS[@]} -eq 0 ]; then
|
||||
echo "No wallpapers found in ${DIR}. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if swww is initialized, and initialize if not
|
||||
swww query || swww init
|
||||
|
||||
# Set the transition type to random
|
||||
export SWWW_TRANSITION_TYPE=random
|
||||
|
||||
# This controls (in seconds) when to switch to the next image
|
||||
INTERVAL=1800
|
||||
|
||||
while true; do
|
||||
find "$1" -type f \
|
||||
| shuf \
|
||||
| while read -r img; do
|
||||
# Update the symbolic link to the new wallpaper
|
||||
ln -sf "$img" "$HOME/.config/hypr/.current_wallpaper"
|
||||
# Set the new wallpaper
|
||||
swww img "$HOME/.config/hypr/.current_wallpaper"
|
||||
sleep $INTERVAL
|
||||
done
|
||||
# Select a random wallpaper
|
||||
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
|
||||
|
||||
# Create symbolic link to the selected wallpaper
|
||||
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
# Set the new wallpaper
|
||||
swww img "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
# Notify that wallpaper has changed
|
||||
notify-send "Wallpaper Changed" -i "$RANDOMPICS"
|
||||
|
||||
sleep $INTERVAL
|
||||
done
|
||||
@@ -24,20 +24,24 @@ wallpaper="$WALLPAPERS_DIR/$choice"
|
||||
set_wallpaper_kde() {
|
||||
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \
|
||||
"var allDesktops = desktops(); for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = \"org.kde.image\";d.currentConfigGroup = Array(\"Wallpaper\", \"org.kde.image\", \"General\");d.writeConfig(\"Image\", \"file:$1\")}"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_gnome() {
|
||||
gsettings set org.gnome.desktop.background picture-uri "file://$1"
|
||||
gsettings set org.gnome.desktop.background picture-uri-dark "file://$1"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_sway() {
|
||||
swaymsg output "*" bg "$1" "stretch"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_default() {
|
||||
swww img -t any --transition-bezier 0,.53,1,.48 --transition-duration 1 --transition-fps 60 "$1" &&
|
||||
ln -sf "$1" "$HOME/.config/hypr/.current_wallpaper"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
if [ -n "$choice" ]; then
|
||||
@@ -51,5 +55,3 @@ if [ -n "$choice" ]; then
|
||||
fi
|
||||
|
||||
exit 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user