sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

wallpaper (770B)


      1 #!/usr/bin/env sh
      2 
      3 # Description: Set the selected image as wallpaper using nitrogen or pywal.
      4 #
      5 # Usage: Hover on an image and run the script to set it as wallpaper.
      6 #
      7 # Shell: POSIX compliant
      8 # Author: juacq97
      9 
     10 if [ -n "$1" ]; then
     11 	if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
     12         if type nitrogen >/dev/null 2>&1; then
     13 	        nitrogen --set-zoom-fill --save "$1"
     14         elif type wal >/dev/null 2>&1; then
     15 	        wal -i "$1"
     16         else
     17             printf "nitrogen or pywal missing"
     18             read -r _
     19         fi
     20 
     21     # If you want a system notification, uncomment the next 3 lines.
     22     # notify-send -a "nnn" "Wallpaper changed!"
     23     #   else
     24     # notify-send -a "nnn" "No image selected"
     25     fi
     26 fi