Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # percorso completo del file .xml per impostare
- # la rotazione delle immagini sul desktop
- XML_WALLPAPER="$HOME/Immagini/wallpapers/mywallpaper.xml"
- # folder da cui prendere le immagini .jpg .png
- IMG_FOLDER="/usr/share/backgrounds/"
- # durata in secondi della visualizzazione dell'immagine
- IMG_DURATION="10,0"
- # durata in secondi dell'effetto di transizione
- # da un'immagine a quella successiva
- IMG_TRANSITION="2,5"
- ############################################################
- # #
- # da qui in giù non dovrestri modificare niente #
- # #
- ############################################################
- if [ ! -d $IMG_FOLDER ]; then
- echo -e "\t\t--------------------
- la variabile \"\$IMG_FOLDER\" non ha
- il valore corretto
- \t\t--------------------"
- exit 1
- fi
- # lista con ordine casuale delle immagini .jpg .png
- # IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '\(.*\.png$\|.*\.jpg$\)' | sort -R | shuf | head -n10`"
- IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '.*\.png$\|.*\.jpg$' | sort -R | shuf`"
- # IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '.*\.xml$' | sort -R | shuf`"
- # numero totale delle righe ed inizializzazione del contatore
- TOT_LINE=`echo "$IMG_LIST" | wc -l`
- COUNT=0
- XML_HEADER(){
- HEADER="<!--
- lista creata dallo script bash $0
- $TOT_LINE immagini dal folder $IMG_FOLDER
- -->
- <background>
- <static>
- <duration>$IMG_DURATION</duration>
- <file>$1</file>
- </static>
- <transition>
- <duration>$IMG_TRANSITION</duration>
- <from>$1</from>"
- echo "$HEADER"
- }
- XML_BODY(){
- BODY=" <to>$1</to>
- </transition>
- <static>
- <duration>$IMG_DURATION</duration>
- <file>$1</file>
- </static>
- <transition>
- <duration>$IMG_TRANSITION</duration>
- <from>$1</from>"
- echo "$BODY"
- }
- XML_FOOTER(){
- FOOTER=" <to>$1</to>
- </transition>
- </background>"
- echo "$FOOTER"
- }
- for imgX in $IMG_LIST ; do
- let "COUNT=$COUNT+1"
- if [ $COUNT -eq 1 ] ; then
- XML_HEADER "$imgX" > $XML_WALLPAPER
- fi
- if [ $COUNT -lt $TOT_LINE -a $COUNT -gt 1 ] ; then
- XML_BODY "$imgX" >> $XML_WALLPAPER
- fi#!/bin/bash
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE DA FINIRE
- # percorso completo del file .xml per impostare
- # la rotazione delle immagini sul desktop
- XML_WALLPAPER="$HOME/Immagini/wallpapers/mywallpaper.xml"
- # folder da cui prendere le immagini .jpg .png
- IMG_FOLDER="/usr/share/backgrounds/"
- # durata in secondi della visualizzazione dell'immagine
- IMG_DURATION="10,0"
- # durata in secondi dell'effetto di transizione
- # da un'immagine a quella successiva
- IMG_TRANSITION="2,5"
- ############################################################
- # #
- # da qui in giù non dovrestri modificare niente #
- # #
- ############################################################
- if [ ! -d $IMG_FOLDER ]; then
- echo -e "\t\t--------------------
- la variabile \"\$IMG_FOLDER\" non ha
- il valore corretto
- \t\t--------------------"
- exit 1
- fi
- # lista con ordine casuale delle immagini .jpg .png
- # IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '\(.*\.png$\|.*\.jpg$\)' | sort -R | shuf | head -n10`"
- IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '.*\.png$\|.*\.jpg$' | sort -R | shuf`"
- # IMG_LIST="`find $IMG_FOLDER \! -executable -readable -type f -iregex '.*\.xml$' | sort -R | shuf`"
- # numero totale delle righe ed inizializzazione del contatore
- TOT_LINE=`echo "$IMG_LIST" | wc -l`
- COUNT=0
- XML_HEADER(){
- HEADER="<!--
- lista creata dallo script bash $0
- $TOT_LINE immagini dal folder $IMG_FOLDER
- -->
- <background>
- <static>
- <duration>$IMG_DURATION</duration>
- <file>$1</file>
- </static>
- <transition>
- <duration>$IMG_TRANSITION</duration>
- <from>$1</from>"
- echo "$HEADER"
- }
- XML_BODY(){
- BODY=" <to>$1</to>
- </transition>
- <static>
- <duration>$IMG_DURATION</duration>
- <file>$1</file>
- </static>
- <transition>
- <duration>$IMG_TRANSITION</duration>
- <from>$1</from>"
- echo "$BODY"
- }
- XML_FOOTER(){
- FOOTER=" <to>$1</to>
- </transition>
- </background>"
- echo "$FOOTER"
- }
- for imgX in $IMG_LIST ; do
- let "COUNT=$COUNT+1"
- if [ $COUNT -eq 1 ] ; then
- XML_HEADER "$imgX" > $XML_WALLPAPER
- fi
- if [ $COUNT -lt $TOT_LINE -a $COUNT -gt 1 ] ; then
- XML_BODY "$imgX" >> $XML_WALLPAPER
- fi
- if [ $COUNT -eq $TOT_LINE ] ; then
- XML_FOOTER "$imgX" >> $XML_WALLPAPER
- fi
- done
- DW="dconf write"
- custom_keybindings(){
- # Inserisco una combinazione di tasti per cambiare l'immagine del desktop
- # "$HOME/bin/changeImgDesktop" $HOME/bin/ è in $PATH e qui scrivo siolo il nome del file
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/']"
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/command "'changeImgDesktop'"
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/name "\"Cambia immagine di sfondo del Desktop\""
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/binding \"\<Alt\>b\"
- echo -e "\tALT+b cambia immagine desktop"
- }
- $DW /org/gnome/desktop/background/color-shading-type \'solid\'
- $DW /org/gnome/desktop/background/picture-options \'zoom\'
- $DW /org/gnome/desktop/background/picture-uri \'file://$XML_WALLPAPER\'
- # echo $(readlink -m $(type -a $0 |awk '{print $3}'))
- echo `readlink -m $(type -a $0 | awk '{print $3}')`
- if [ $COUNT -eq $TOT_LINE ] ; then
- XML_FOOTER "$imgX" >> $XML_WALLPAPER
- fi
- done
- DW="dconf write"
- custom_keybindings(){
- # Inserisco una combinazione di tasti per cambiare l'immagine del desktop
- # "$HOME/bin/changeImgDesktop" $HOME/bin/ è in $PATH e qui scrivo siolo il nome del file
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/']"
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/command "'changeImgDesktop'"
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/name "\"Cambia immagine di sfondo del Desktop\""
- $DW /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/my_custom/binding \"\<Alt\>b\"
- echo -e "\tALT+b cambia immagine desktop"
- }
- $DW /org/gnome/desktop/background/color-shading-type \'solid\'
- $DW /org/gnome/desktop/background/picture-options \'zoom\'
- $DW /org/gnome/desktop/background/picture-uri \'file://$XML_WALLPAPER\'
- # echo $(readlink -m $(type -a $0 |awk '{print $3}'))
- echo `readlink -m $(type -a $0 | awk '{print $3}')`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement