.
This commit is contained in:
1 parent
75e52b850b
commit
754ea81164
23 files changed
+760
-883
No files matched your search
@@ -105,6 +105,7 @@ random_wall() {
|
||||
RANDOMPICS=${PICS[RANDOM % ${#PICS[@]}]} # Select a random image
|
||||
swww img "${RANDOMPICS}" ${SWWW_PARAMS} # Set the randomly selected wallpaper
|
||||
$linker
|
||||
$RunCMD reload_all
|
||||
else
|
||||
echo "No images found in ${wallDIR}"
|
||||
fi
|
||||
@@ -122,7 +123,7 @@ auto_wall() {
|
||||
while true; do
|
||||
find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \
|
||||
| shuf -z -n 1 \
|
||||
| xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker
|
||||
| xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker && $RunCMD reload_all
|
||||
sleep $INTERVAL
|
||||
done
|
||||
}
|
||||
@@ -145,13 +146,13 @@ select_wall() {
|
||||
exit 1
|
||||
fi
|
||||
images=$(find "$wallDIR" -maxdepth 1 -type f -printf "%f\x00icon\x1f$wallDIR/%f\n" | sort -n)
|
||||
choice=$(echo -en "$images\nRandom Choice" | rofi -dmenu -i -show-icons -theme-str "$(build_theme 3 5 6)" -config ~/.config/rofi/config-wallpaper.rasi)
|
||||
choice=$(echo -en "$images\nRandom Choice" | rofi -dmenu -i -show-icons -theme-str "$(build_theme 3 5 6)" -config ~/dotfiles/rofi/config-wallpaper.rasi)
|
||||
if [ -n "$choice" ]; then
|
||||
if [ "$choice" = "Random Choice" ]; then
|
||||
choice=$(find "$wallDIR" -type f -maxdepth 1 -printf "%f\n" | shuf -n1)
|
||||
fi
|
||||
wallpaper="$wallDIR/${choice#*icon\x1f}"
|
||||
swww img $SWWW_PARAMS1 "$wallpaper" && $linker
|
||||
swww img $SWWW_PARAMS1 "$wallpaper" && $linker && $RunCMD reload_all
|
||||
else
|
||||
echo "No wallpaper selected. Exiting."
|
||||
exit 0
|
||||
@@ -207,7 +208,7 @@ gamemode() {
|
||||
else
|
||||
notify-send -e -u normal -i "$notif" "All animations normal"
|
||||
hyprctl keyword animations:enabled 1
|
||||
swww init && swww img "$HOME/.config/rofi/.current_wallpaper"
|
||||
swww init && swww img "$HOME/dotfiles/rofi/.current_wallpaper"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -265,23 +266,43 @@ notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout"
|
||||
######################################
|
||||
|
||||
linker() {
|
||||
cache_dir="$HOME/.cache/swww/" # Define the path to the swww cache directory
|
||||
monitor_outputs=("$cache_dir"/*) # Get a list of monitor outputs
|
||||
ln_success=false # Initialize a flag to determine if the ln command was executed
|
||||
for cache_file in "${monitor_outputs[@]}"; do # Loop through monitor outputs
|
||||
if [ -f "$cache_file" ]; then # Check if the cache file exists for the current monitor output
|
||||
wallpaper_path=$(<"$cache_file") # Get the wallpaper path from the cache file
|
||||
if ln -sf "$wallpaper_path" "$HOME/dotfiles/rofi/.current_wallpaper"; then # Copy the wallpaper to the location Rofi can access
|
||||
ln_success=true # Set the flag to true upon successful execution
|
||||
break # Exit the loop after processing the first found monitor output
|
||||
fi
|
||||
# Define the path to the swww cache directory
|
||||
cache_dir="$HOME/.cache/swww/"
|
||||
|
||||
# Get a list of monitor outputs
|
||||
monitor_outputs=($(ls "$cache_dir"))
|
||||
|
||||
# Initialize a flag to determine if the ln command was executed
|
||||
ln_success=false
|
||||
|
||||
# Get first valid monitor
|
||||
current_monitor=$(hyprctl -j monitors | jq -r '.[0].name')
|
||||
echo $current_monitor
|
||||
# Construct the full path to the cache file
|
||||
cache_file="$cache_dir$current_monitor"
|
||||
echo $cache_file
|
||||
# Check if the cache file exists for the current monitor output
|
||||
if [ -f "$cache_file" ]; then
|
||||
# Get the wallpaper path from the cache file
|
||||
wallpaper_path=$(cat "$cache_file")
|
||||
echo $wallpaper_path
|
||||
# Copy the wallpaper to the location Rofi can access
|
||||
if ln -sf "$wallpaper_path" "$HOME/dotfiles/rofi/.current_wallpaper"; then
|
||||
ln_success=true # Set the flag to true upon successful execution
|
||||
fi
|
||||
done
|
||||
if $ln_success; then # Add a message indicating whether the ln command was successful
|
||||
echo "Wallpaper linked successfully."
|
||||
else
|
||||
echo "Failed to link wallpaper."
|
||||
fi
|
||||
|
||||
# Check the flag before executing further commands
|
||||
if [ "$ln_success" = true ]; then
|
||||
# execute pywal
|
||||
# wal -i "$wallpaper_path"
|
||||
echo 'about to execute wal'
|
||||
# execute pywal skipping tty and terminal changes
|
||||
wal -i "$wallpaper_path" -s -t &
|
||||
fi
|
||||
|
||||
# for cava-pywal (note, need to manually restart cava once wallpaper changes)
|
||||
ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/dotfiles/cava/config" || true
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user