sistema_progs

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

wallpaper (1084B)


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