Desktop-Slideshow

Window managers, icon programs, widgets, etc.
Post Reply
Message
Author
stemsee

Desktop-Slideshow

#1 Post by stemsee »

I was using Nathan's Wallpaper changer on a recent slacko and noticed that it didn't handle file names with spaces very well (not at all!). I then checked my app previously called ChangeOn (I wrote this before ever I heard of Nathan's Wallpaper changer), which had the same problem. I fixed it!!

Recently I read on github that Nathan's Wallpaper changer slideshow function must be stopped prior to shutting down or the puppyppin would become corrupt ... this isn't an issue with (ChangeOn) re-named to Desktop-Slideshow.

Desktop-Slideshow also remembers pic selections across reboots. wallpapers/pics can be added anytime, or removed or deleted from system. Intervals for change can be less than 1 second to infinity (might add a random time function in there and random selection too (why not?))!
Attachments
Desktop-Slideshow.pet
(2.73 KiB) Downloaded 317 times

stemsee

#2 Post by stemsee »

Here is an update to DesktopSlidesow (changeon and changeongui)

Now there is a checkbox to select 'Scale' image or 'Stretch' image, Scale is default. CLI 'changeon Centre' also allows 'Centre'.

Another checkbox shows path and name of image using conky, at top_middle of display.

Time interval now has drop down selector set at defaul 2 seconds and rnging from 0.1 to 900 seconds. User typed input also possible.

Code: Select all

#!/bin/sh
#desktopslideshow aka changeon changeongui by stemsee copyright (c) 2015 Marcos Contant
#

slpfn () {
	unset $slp
	slpm=$(yad --geometry=380x30+0+0 --title "Interval Show Mode" --item-separator="," --form --field="Interval:CBE" "2,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900" --field="Default Scaled\nCheck to Stretch:CHK" --field="Show names:CHK") 
	slp=`echo $slpm | cut -f1 -d'|'`
	m1=`echo $slpm | cut -f2 -d'|'`
	sn=`echo $slpm | cut -f3 -d'|'`
case $m1 in
TRUE) mode=Stretch;;
FALSE) mode=Scale;;
esac
}

addwpfn () {
cd /usr/share/backgrounds
wp=`yad --title "Select Wallpapers" --geometry=400x500+10+10 --file-selection --multiple --add-preview | tr ' ' '#' | tr '|' '\n'` 
ret=$?
[[ $ret -eq 1 ]] && exit 1
}

case $1 in
Stretch|stretch) mode=Stretch;;
Scale|scale) mode=Scale;;
Centre|centre) mode=Centre;;
*) mode=Scale;;
esac

changefn () {
for file in $wp
do
file=`echo $file | tr '#' ' '`
nice --19 rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <SetBackdrop>
   <Filename>$file</Filename>
   <Style>$mode</Style>
  </SetBackdrop>
 </env:Body>
</env:Envelope>
EOF
#wid=`xdotool getwindowid`
#export wid
#[[ /etc/hotbar/restart_bar ]] && restart_bar
fnm=`echo "$file" | rev | cut -f1 -d'\' | rev`
[[ "$sn" = TRUE ]] && conky2 -x 10 -y 10 -t "$fnm" -f sans:size=14 -a top_middle &
conkpid=$!
sleep "$slp"
kill $conkpid
done
changefn
}

if [ "$1" = step ]; then
	wp=`cat $HOME/.wp`
for file in $wp
do
file=`echo $file | tr '#' ' '`
nice --19 rox --RPC<< EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <SetBackdrop>
   <Filename>$file</Filename>
   <Style>Scale</Style>
  </SetBackdrop>
 </env:Body>
</env:Envelope>

EOF
fnm=`echo "$file" | rev | cut -f1 -d'\' | rev`
[[ "$sn" = TRUE ]] && conky2 -x 10 -y 10 -t "$fnm" -f sans:size=14 -a top_middle &
conkpid=$!
sleep "$slp"
kill $conkpid
read dummy
if [[ "$dummy" = d ]]; then
	linenum=`cat $HOME/.wp | grep -n "$file"`
	linenum=`echo $linenum | cut -f1 -d ':'`
for f in $linenum
do
	sed -i "$linenum"d $HOME/.wp
done
fi
done
exit
fi
if [ "$1" = reset ]; then
	rm -f $HOME/.wp
	rm -f $HOME/.sleep
fi
if [ "$1" = stop ]; then
	killall changeon
fi
if [ "$1" = add ]; then
	addwpfn
	echo "$wp" >> $HOME/.wp
	exit
fi
if [ "$1" = edit ]; then
	geany $HOME/.wp
fi

if [ ! -f $HOME/.wp ]; then
	addwpfn
	echo "$wp" > $HOME/.wp
else
	wp=`cat $HOME/.wp`
fi
killall slpfn
slpfn
if [ -z "$slp" ]; then
	slp=20
fi
changefn
if [[ "$1" = vbar ]]; then
[[ /etc/hotbar/restart_bar ]] && restart_bar
fi
gui

Code: Select all

#!/bin/bash
#

RET=$(export Changeongui='
<window title="  Desktop Slideshow">
<vbox>
<hbox>
    <button>
		<label>Start Slide Show</label>
		<action>changeon stop</action>
		<action>killall conky2</action>
		<action>changeon &</action>
		<action>exit 0</action>
		</button>
   <button>
      <label>Add Slide</label>
      <action>changeon add</action>
      <action>exit 0</action>
    </button>
      <button>
      <label>Stop Slide Show</label>
      <action>changeon stop</action>
      <action>killall conky2</action>
      <action>exit 0</action>
    </button>
 </hbox>
     <button>
      <label>Select Slides</label>
      <action>changeon stop</action>
      <action>changeon reset &</action>
      <action>exit 0</action>
    </button>
     <button>
    <label>Edit Slide list</label>
    <action>changeon edit &</action>
          <action>exit 0</action>
    </button>
    <button>
    <label>Preview Slides (Enter)|(d) permanent delete</label>
    <action>changeon stop</action>
    <action>urxvt -e changeon step</action>
    </button>
    <button>
    <label>Rename Background Images</label>
    <action>rox /usr/share/backgrounds/</action>
    </button>
  </vbox>
 </window>
 '

gtkdialog --program=Changeongui)


eval $RET

echo -e "\n$RET\n"

[ "$EXIT" != OK ]&& exit	

exit
Attachments
xscreenshot-20170319T140406.png
(41.31 KiB) Downloaded 203 times

Post Reply