It is currently Sun May 19, 2013 9:25 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: An alternative background changer for openbox and thunar
PostPosted: Tue Mar 08, 2011 7:19 am 
Zenwalker
Zenwalker

Joined: Mon Mar 07, 2011 11:33 pm
Posts: 5
I needed a background changer, since the one in thunar didnt seem to work and installing feh seemed to involve dependencies, so i cooked one up my self using the thunar send to function and a couple of lines of perl / shell.

Using this script you can click on a picture file and have a sendto option in thunar that will place it as your desktop background. If the picture is a smaller size than your desktop resolution it may not display correctly. Otherwise its ok.

First create the sendto entry in thunar:

Place a text file in /usr/share/Thunar/sendto/ containing this text:

[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Exec=/home/m0rl0ck/scripts/switcher %F
Icon=gnome-terminal.png
Name=Switcher

The file should be named "thunar-sendto-switcher.desktop" The Exec line above needs to be the absolute path to the file, and make sure that is followed by %F

This is the script that the Exec line above points to:

#!/usr/bin/perl
$pic=$ARGV[0];
$RES="1280x1024";
`display -dispose Background -window root -resize $RES $ARGV[0]`;


Change $RES to the size of your desktop (dont forget to put the desktop size inside quotes) and save the file as "switcher". Make sure the Exec line in the first file points to the "switcher" file we just saved. The switcher file we just created needs to be executable so in the directory where you saved it run "chmod +x switcher".

Exit and restart thunar. Right click on a picture file you would like as a background and choose Switcher.


 Profile Send private message  
 
 Post subject: Re: An alternative background changer for openbox and thunar
PostPosted: Tue Mar 08, 2011 8:35 am 
Master of the known universe
Master of the known universe
User avatar

Joined: Fri Oct 06, 2006 5:12 am
Posts: 2423
Location: India - Silicon City
Mya be this could be a patch for XFCE. Why not contact XFCE developers.

_________________
Happiness is REAL, when SHARED
Christopher mcCandles

Software is like sex: it's better when it's free.
Linus Torvalds


 Profile Send private message  
 
 Post subject: Re: An alternative background changer for openbox and thunar
PostPosted: Tue Mar 08, 2011 9:54 am 
Administrator
Administrator
User avatar

Joined: Tue Mar 06, 2007 12:34 pm
Posts: 2082
Location: Finland
I use similar approach to provide wallpaper plugin to zenwalk-openbox since the one in Thunar doesn't work with openbox.
I added this line in .config/Thunar/uca.xml
Code:
action><icon>insert-image</icon><name>Set as wallpaper</name><command>bash -x ~/.config/openbox/stillwall %f</command><description>Set as wallpaper</description><patterns>*.jpg;*.JPG;*.png;*.PNG;*.jpeg;*.JPEG</patterns><image-files/></action>


and made this 1liner that does the job.
Code:
FILE=${FILE:-~/.config/openbox/autostart.sh}
display -dispose Background -window root -resize "$(xdpyinfo | sed -n 's/^[ \t]*dimensions:[ \t]*\(.*\)[ \t]*pixels\(.*\)$/\1/p')"\! ${1} && \
sed -i "s#\(display[ \t]*-disp.*\\!\)[ \t]*\(.*\)#\1\ ${1}#" ${FILE}

now you just right click on image and select "Set as wallpaper" and it changes it according to your screen resolution and saves it so that it's used again in next login.
Notice that these both methods need imagemagick.

EDIT: I never knew that the new Thunar wallpaper plugin in xfce doesn't work,,anyone else can confirm this, it is a bug if confirmed.


 Profile Send private message  
 
 Post subject: Re: An alternative background changer for openbox and thunar
PostPosted: Tue Mar 08, 2011 8:05 pm 
Zenwalker
Zenwalker

Joined: Mon Mar 07, 2011 11:33 pm
Posts: 5
stillborn wrote:
I use similar approach to provide wallpaper plugin to zenwalk-openbox since the one in Thunar doesn't work with openbox.
I added this line in .config/Thunar/uca.xml
Code:
action><icon>insert-image</icon><name>Set as wallpaper</name><command>bash -x ~/.config/openbox/stillwall %f</command><description>Set as wallpaper</description><patterns>*.jpg;*.JPG;*.png;*.PNG;*.jpeg;*.JPEG</patterns><image-files/></action>


and made this 1liner that does the job.
Code:
FILE=${FILE:-~/.config/openbox/autostart.sh}
display -dispose Background -window root -resize "$(xdpyinfo | sed -n 's/^[ \t]*dimensions:[ \t]*\(.*\)[ \t]*pixels\(.*\)$/\1/p')"\! ${1} && \
sed -i "s#\(display[ \t]*-disp.*\\!\)[ \t]*\(.*\)#\1\ ${1}#" ${FILE}

now you just right click on image and select "Set as wallpaper" and it changes it according to your screen resolution and saves it so that it's used again in next login.
Notice that these both methods need imagemagick.

EDIT: I never knew that the new Thunar wallpaper plugin in xfce doesn't work,,anyone else can confirm this, it is a bug if confirmed.


Wow, great stuff. A much better solution than mine i think. Thanks :)


 Profile Send private message  
 
 Post subject: Re: An alternative background changer for openbox and thunar
PostPosted: Tue Oct 18, 2011 2:26 pm 
Regular Zenwalker
Regular Zenwalker

Joined: Sat Aug 06, 2011 12:08 pm
Posts: 17
Hi, I am using Z7.0 Openbox. I noticed one potential issue in the background changer script. I was trying to make an image lying on Win partition as my background. Since the path name had spaces it was not showing up image despite right-clicking and clicking on 'set as wallpaper', although the script was referring to the correct image file.

I copied the same image to my linux partition and it worked perfectly. Can this script be slightly modified to catch this potential problem?


 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
 
cron