wok-current annotate xpenguins/stuff/xpenguins.sh @ rev 22911

filezilla: added build dependency libunistring-dev
author Hans-G?nter Theisgen
date Mon Feb 24 09:59:25 2020 +0100 (2020-02-24)
parents cc044c37d3ba
children
rev   line source
llevrel@18814 1 #!/bin/sh
llevrel@18814 2 icon=--window-icon=/usr/share/pixmaps/xpenguins.png
llevrel@18814 3 toons=$(xpenguins -l | yad --list --title="xpenguins settings (1/2)" $icon \
llevrel@18814 4 --text="Select all the toons you want to display" --height=330 \
llevrel@18814 5 --column="Theme name" --multiple --separator='')
llevrel@18814 6 [ $? -eq 0 ] || exit 1
llevrel@18814 7 [ -z $toons ] && toons=$(xpenguins -l)
llevrel@18814 8 themes=''
llevrel@18814 9 # double-quote theme names (some have spaces) then use xargs
llevrel@18814 10 while read theme ; do themes=$themes' -t "'$theme'"' ; done <<EOT
llevrel@18814 11 $toons
llevrel@18814 12 EOT
llevrel@18814 13 settings=$(LC_NUMERIC=C yad --form --title="xpenguins settings (2/2)" $icon \
llevrel@18814 14 --field="Animation update delay (ms) (0 = default)":NUM \
llevrel@18814 15 --field="Number of toons (-1 = default)":NUM \
llevrel@18814 16 --field="Ignore popup windows":CHK --field="Don't show any blood":CHK \
llevrel@18814 17 --field="Don't show any angel":CHK \
llevrel@18814 18 --field="Destroy toons with mouseclick":CHK \
llevrel@18814 19 --field="Duration (min) (0 = unlimited)":NUM \
llevrel@18814 20 -- '0' '-1!-1..256' false false false true 0)
llevrel@18814 21 [ $? -eq 0 ] || exit 2
llevrel@18814 22 pid1=$(pgrep -fl 'spacefm --desktop'|cut -f1 -d' ')
llevrel@18814 23 pid2=$(pgrep -fl 'pcmanfm --desktop'|cut -f1 -d' ')
llevrel@18814 24 [ -n "$pid1" -o -n "$pid2" ] && yad --title=Warning $icon \
llevrel@18814 25 --text="Your file manager windows will be closed, and your desktop icons \
llevrel@18814 26 temporarily removed. Continue?"
llevrel@18814 27 [ $? -eq 0 ] || exit 3
llevrel@18814 28 [ -n "$pid1" ] && kill $pid1
llevrel@18814 29 [ -n "$pid2" ] && kill $pid2
llevrel@18814 30 #add dummy var to gobble last |
llevrel@18814 31 IFS='|' read delay number nopopup noblood noangel squish duration dummy<<EOT
llevrel@18814 32 $settings
llevrel@18814 33 EOT
llevrel@18814 34 flags=''
pascal@20892 35 [ $nopopup = TRUE ] && flags=$flags" -p"
pascal@20892 36 [ $noblood = TRUE ] && flags=$flags" -b"
pascal@20892 37 [ $noangel = TRUE ] && flags=$flags" -a"
pascal@20892 38 [ $squish = TRUE ] && flags=$flags" -s"
llevrel@18814 39 printf '%s' "$themes" | xargs xpenguins -m ${delay%.*} -n ${number%.*} $flags \
llevrel@18814 40 >/dev/null 2>&1 &
llevrel@18814 41 yad --button=gtk-stop --title='Stop xpenguins' $icon \
llevrel@18814 42 --timeout=$((60*${duration%.*}))
llevrel@18814 43 pkill -x xpenguins
llevrel@18814 44 alias pcmanfm='pcmanfm --desktop 2>/dev/null &'
llevrel@18814 45 alias spacefm='spacefm --desktop 2>/dev/null &'
llevrel@18814 46 # restart filemanager(s)
llevrel@18814 47 if [ -n "$pid1" ]; then
llevrel@18814 48 if [ -n "$pid2" ]; then
llevrel@18814 49 # in case both were running
llevrel@18814 50 if [ $pid1 -lt $pid2 ]; then
llevrel@18814 51 spacefm
llevrel@18814 52 pcmanfm
llevrel@18814 53 else
llevrel@18814 54 pcmanfm
llevrel@18814 55 spacefm
llevrel@18814 56 fi
llevrel@18814 57 else
llevrel@18814 58 spacefm
llevrel@18814 59 fi
llevrel@18814 60 elif [ -n "$pid2" ]; then
llevrel@18814 61 pcmanfm
llevrel@18814 62 fi