Advertisement
uriid1

Ubuntu Touch Random Wallpaper

Apr 9th, 2024 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.98 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. WALLPAPER_NAME="curWallpaper.jpg"
  4. WALLPAPER_PATH="${PWD}/${WALLPAPER_NAME}"
  5.  
  6. if [[ -f "$WALLPAPER_PATH" ]]; then
  7.   rm -f "$WALLPAPER_PATH"
  8. fi
  9.  
  10. # Размеры дисплея
  11. width=$(cat /sys/class/graphics/fb0/virtual_size | awk '{print $1}')
  12. height=$(cat /sys/class/graphics/fb0/virtual_size | awk '{print $2}')
  13.  
  14. # Качаем рандомное обоину
  15. wget -O "$WALLPAPER_PATH" https://source.unsplash.com/random
  16.  
  17. # Подгоняем под дисплей
  18. convert "$WALLPAPER_NAME" -resize "$height"x"$height"^ -gravity center -extent "$height"x"$height" "$WALLPAPER_NAME"
  19.  
  20. dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User32011 org.freedesktop.Accounts.User.SetBackgroundFile string:$(find /usr/share/backgrounds/ -type f | head -n 1)
  21. dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User32011 org.freedesktop.Accounts.User.SetBackgroundFile string:"$WALLPAPER_PATH"
  22.  
Tags: Ubuntu Touch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement