swww icon indicating copy to clipboard operation
swww copied to clipboard

Wallpaper not updating on the second monitor

Open AlexAuragan opened this issue 1 year ago • 4 comments

Bug description

Swww works fine on my primary monitor, but not on the second one. When I call swww on the second monitor I get no error. In fact, when I do swww query I even get the correct wallpaper, but the image is not updated untill I restart my laptop

setup

ubuntu 24 lts, hyprland installed with the help of JaKooLit's repo

AlexAuragan avatar Aug 08 '24 09:08 AlexAuragan

Are you on the latest git version?

And, are your monitors at different resolutions?

LGFae avatar Aug 12 '24 22:08 LGFae

I also have this issue. Switching to -git made it not work at all.

Edit - After swithing to -git and using waypaper it works. I think it may have something to do with JaKooLit's wallpaper changer script because i also utilize that but not his full dotfiles.

Edit 2 - After changing the wallpaper with waypaper, and then trying the wallpaper script again, it works. Strange work around lol.

Upon relogging, waypaper had to be loaded to make the wallpaper change script work again. Wallpaper select script posted below.


scriptsDir="$HOME/.config/hypr/scripts"

# WALLPAPERS PATH
wallDIR="$HOME/.config/wallpapers"

# Transition config
FPS=60
TYPE="wipe"
DURATION=2
BEZIER=".43,1.19,1,.4"
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"

# Check if swaybg is running
if pidof swaybg > /dev/null; then
  pkill swaybg
fi

# Retrieve image files
PICS=($(ls "${wallDIR}" | grep -E ".jpg$|.jpeg$|.png$|.gif$"))
RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}"
RANDOM_PIC_NAME="${#PICS[@]}. random"

# Rofi command
rofi_command="rofi -show -dmenu -theme $HOME/.config/rofi/themes/wallpaper-select.rasi"

menu() {
  for i in "${!PICS[@]}"; do
    # Displaying .gif to indicate animated images
    if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then
      printf "$(echo "${PICS[$i]}" | cut -d. -f1)\x00icon\x1f${wallDIR}/${PICS[$i]}\n"
    else
      printf "${PICS[$i]}\n"
    fi
  done

  printf "$RANDOM_PIC_NAME\n"
}

swww query || swww init

main() {
  choice=$(menu | ${rofi_command})

  # No choice case
  if [[ -z $choice ]]; then
    exit 0
  fi

  # Random choice case
  if [ "$choice" = "$RANDOM_PIC_NAME" ]; then
    swww img "${wallDIR}/${RANDOM_PIC}" $SWWW_PARAMS
    exit 0
  fi

  # Find the index of the selected file
  pic_index=-1
  for i in "${!PICS[@]}"; do
    filename=$(basename "${PICS[$i]}")
    if [[ "$filename" == "$choice"* ]]; then
      pic_index=$i
      break
    fi
  done

  if [[ $pic_index -ne -1 ]]; then
    swww img "${wallDIR}/${PICS[$pic_index]}" $SWWW_PARAMS
  else
    echo "Image not found."
    exit 1
  fi
}

# Check if rofi is already running
if pidof rofi > /dev/null; then
  pkill rofi
  exit 0
fi

main

wal -i ~/.config/rofi/.current_wallpaper

~/.config/hypr/scripts/swww.sh

_ps=(waybar)
for _prs in "${_ps[@]}"; do
    if pidof "${_prs}" >/dev/null; then
        pkill "${_prs}"
    fi
done

sleep 1
# Relaunch waybar
waybar &

~/.config/hypr/scripts/refresh.sh

pywal-discord```

xsghetti avatar Aug 15 '24 14:08 xsghetti

Sorry I was on vacation. Yes I just rebuilt from git and I still have the same issue, also yes the two monitors are different sizes

If that helps:

xrandr --query


Screen 0: minimum 16 x 16, current 3520 x 1080, maximum 32767 x 32767
eDP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 380mm x 220mm
   1920x1080     59.96*+
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.97  
   960x600       59.96  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77  
HDMI-A-1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 440mm x 250mm
   1600x900      59.95*+
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.97  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77  

edit: I just tried @xsghetti's solution and it worked like once for me, then it's not working again, it's not a reliable workaround on my setup.

AlexAuragan avatar Aug 21 '24 14:08 AlexAuragan

This error is occurring again with the vertical monitor

xsghetti avatar Dec 05 '24 02:12 xsghetti