Browse Source

use valid monitor to set wallpaper

pull/145/head
xdonu2x 2 years ago
parent
commit
f7fd59389c
  1. 34
      config/hypr/scripts/PywalSwww.sh

34
config/hypr/scripts/PywalSwww.sh

@ -11,30 +11,28 @@ monitor_outputs=($(ls "$cache_dir"))
# Initialize a flag to determine if the ln command was executed # Initialize a flag to determine if the ln command was executed
ln_success=false ln_success=false
# Loop through monitor outputs # Get first valid monitor
for output in "${monitor_outputs[@]}"; do current_monitor=$(hyprctl -j monitors | jq -r '.[0].name')
# Construct the full path to the cache file echo $current_monitor
cache_file="$cache_dir$output" # Construct the full path to the cache file
cache_file="$cache_dir$current_monitor"
# Check if the cache file exists for the current monitor output echo $cache_file
if [ -f "$cache_file" ]; then # Check if the cache file exists for the current monitor output
# Get the wallpaper path from the cache file if [ -f "$cache_file" ]; then
wallpaper_path=$(cat "$cache_file") # Get the wallpaper path from the cache file
wallpaper_path=$(cat "$cache_file")
# Copy the wallpaper to the location Rofi can access echo $wallpaper_path
if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then # Copy the wallpaper to the location Rofi can access
ln_success=true # Set the flag to true upon successful execution if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
fi ln_success=true # Set the flag to true upon successful execution
break # Exit the loop after processing the first found monitor output
fi fi
done fi
# Check the flag before executing further commands # Check the flag before executing further commands
if [ "$ln_success" = true ]; then if [ "$ln_success" = true ]; then
# execute pywal # execute pywal
# wal -i "$wallpaper_path" # wal -i "$wallpaper_path"
echo 'about to execute wal'
# execute pywal skipping tty and terminal changes # execute pywal skipping tty and terminal changes
wal -i "$wallpaper_path" -s -t & wal -i "$wallpaper_path" -s -t &
fi fi

Loading…
Cancel
Save