OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: zs_ftp on January 08, 2007, 02:12:59 am

Title: Change Wallpaper If Rotate Screen
Post by: zs_ftp on January 08, 2007, 02:12:59 am
How to make change of wallpapers, at turn of the screen?
example: in landscape mode - wall_l.jpg, in portrait mode - wall_p.jpg.

I Use IceWM and pdaXrom r121.
Title: Change Wallpaper If Rotate Screen
Post by: daniel3000 on January 08, 2007, 08:21:35 am
I don't think there is a way, besides patching and recompiling the matchbox or openbox desktop.

However, there may be a workaround which I'll try in the next days:
I observed that if the screen is rotated, the right side of a 640x480 wallpaper is cropped and the lower part shows the repitition of the upper part (tiled wallpaper).

So it may be possible to create a 640x640 wallpaper image where simply the right OR bottom part is cropped, depending on the screen orientation.
This at least avoids the ugly tiling.

And if you create a graphically sophisticated image, this method may be good to generate "two" very well looking wallpapers.

Will report when I have tested this.

daniel
Title: Change Wallpaper If Rotate Screen
Post by: newkirk on January 08, 2007, 11:02:41 am
I've dug into this before, to the point of studying the matchbox source.  /etc/sysconfig/clamshell  is home to scripts that are called when clamshell state changes -  closed, portrait, landscape.  So, for example, you could put a script in /etc/sysconfig/clamshell/portrait.d/  and it would be executed when the screen is spun to portrait orientation.  It's more efficient however to put the script in scripts.d and symlink to portrait.d and landscape.d, since the script receives 'landscape', 'portrait', or 'closed' as first parameter.

The problem I ran into is that, as Daniel mentioned, matchbox-desktop doesn't reload the config file unless it's restarted, which is not what we want.  If there's some way to tell it to reload config files and repaint ('kill -HUP `pidof -x matchbox-desktop`' should work but doesn't) then the scripts would just need to change to the appropriate wallpaper (either modify config file or swap 2 config files), then trigger the reload.

Now, with all that said, I DID find a way to do it.  As it turns out, matchbox-desktop doesn't reload its config, but it DOES reload the wallpaper image itself.  SO I was successful insofar as I can configure it to use something like /mnt/card/wallpaper/paper.png, which is a symlink to the actual wallpaper to be used, then if that symlink points to a DIFFERENT image when the screen is swapped between portrait and landscape, it will load the new wallpaper.

caveats:  
1 - Loading the images takes a noticeable amount of time, so the smaller the image the smoother the transition.
2 - Images MUST be the same format - IE, both png or both jpg.
3 - you cannot change centered vs tiled vs stretched - that involves reloading the config.
4 - you can only select wallpapers by editing the swapper script, NOT via Look'n'Feel tool.

So here's my patch-up solution: Create the file /etc/sysconfig/clamshell/scripts.d/swappaper, make it executable, and put this in it, modified to reflect your chosen wallpapers and appropriate paths:

Code: [Select]
#!/bin/bash

case "$1" in
portrait)
    ln -fs /mnt/card/wallpaper/DeanRock.jpg /mnt/card/wallpaper/paper.jpg
 ;;
landscape)
    ln -fs /mnt/card/wallpaper/CloudColumn.jpg /mnt/card/wallpaper/paper.jpg
 ;;
esac

Then symlink it:  
Code: [Select]
ln -s /etc/sysconfig/clamshell/scripts.d/swappaper /etc/sysconfig/clamshell/portrait.d/0swapper
ln -s /etc/sysconfig/clamshell/scripts.d/swappaper /etc/sysconfig/clamshell/portrait.d/0swapper
Note that the preceding zero is vital - 0swapper will come first in order, ensuring that it changes the picture BEFORE it actually reloads it...

Final prep, you'll need to execute the landscape 'ln' command from the script manually, then select the paper.jpg or whatever in lookandfeel. (until the symlink has been created you can't select it as wallpaper)

j
Title: Change Wallpaper If Rotate Screen
Post by: daniel3000 on January 09, 2007, 03:22:00 am
This is a great workaround, thank you!
Title: Change Wallpaper If Rotate Screen
Post by: zs_ftp on January 09, 2007, 09:34:36 am
my solve:

1. installed feh
2. create 2 wallpaper (640x480 and 480x640)
3. edit /etc/sysconfig/clamshell/scripts/x11src

after "if pidor xvkdb..." add
/usr/local/bin/feh --bg-scale ~/wp/lng.jpg
and for portrait mode
/usr/local/bin/feh --bg-scale ~/wp/prt.jpg

Title: Change Wallpaper If Rotate Screen
Post by: kkazakov13 on January 12, 2007, 01:11:14 pm
Quote
my solve:

1. installed feh
2. create 2 wallpaper (640x480 and 480x640)
3. edit /etc/sysconfig/clamshell/scripts/x11src

after "if pidor xvkdb..." add
/usr/local/bin/feh --bg-scale ~/wp/lng.jpg
and for portrait mode
/usr/local/bin/feh --bg-scale ~/wp/prt.jpg


[div align=\"right\"][a href=\"index.php?act=findpost&pid=150546\"][{POST_SNAPBACK}][/a][/div]


I tried it, but for example

/usr/local/bin/feh --bg-scale /storage/images/wallpapers/linux1.png

doesnt' change the wallpaper, it just simply gives no output, but wallpaper isn't changed.
Title: Change Wallpaper If Rotate Screen
Post by: daniel3000 on January 15, 2007, 10:03:55 am
Quote
I tried it, but for example

/usr/local/bin/feh --bg-scale /storage/images/wallpapers/linux1.png

doesnt' change the wallpaper, it just simply gives no output, but wallpaper isn't changed.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=150980\"][{POST_SNAPBACK}][/a][/div]

Maybe it depends on the desktop you are running.
The feh feature may work in Matchbox-desktop, but not in Rox, for example, because Rox has its own background "drop" feature.
Just a guess.

daniel
Title: Change Wallpaper If Rotate Screen
Post by: Ling on January 15, 2007, 10:05:28 am
Is it not possible to compile plasterer for pdaXrom?
Title: Change Wallpaper If Rotate Screen
Post by: kkazakov13 on January 15, 2007, 10:05:42 am
Quote
Quote
I tried it, but for example

/usr/local/bin/feh --bg-scale /storage/images/wallpapers/linux1.png

doesnt' change the wallpaper, it just simply gives no output, but wallpaper isn't changed.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=150980\"][{POST_SNAPBACK}][/a][/div]

Maybe it depends on the desktop you are running.
The feh feature may work in Matchbox-desktop, but not in Rox, for example, because Rox has its own background "drop" feature.
Just a guess.

daniel
[div align=\"right\"][a href=\"index.php?act=findpost&pid=151246\"][{POST_SNAPBACK}][/a][/div]

Yes, it was ROX. I don't use matchbox-desktop at all, don't like it. Would be good if can change background somehow via script with Rox
Title: Change Wallpaper If Rotate Screen
Post by: daniel3000 on January 15, 2007, 10:07:28 am
Quote
However, there may be a workaround which I'll try in the next days:
I observed that if the screen is rotated, the right side of a 640x480 wallpaper is cropped and the lower part shows the repitition of the upper part (tiled wallpaper).

So it may be possible to create a 640x640 wallpaper image where simply the right OR bottom part is cropped, depending on the screen orientation.
This at least avoids the ugly tiling.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=150432\"][{POST_SNAPBACK}][/a][/div]

I can now report that this method works nicely.

Simply use an image of size 640x640 as "tiled" wallpaper.
Just take care that it contains good looking areas of 640x480 and 480x640 from the upper left corner.

Since the background image is rotated together with the screen and desktop, the wallpaper contents will always be oriented correctly with the desktop.

daniel
Title: Change Wallpaper If Rotate Screen
Post by: Meanie on January 17, 2007, 12:40:24 am
In theory, this could be achieved easily with the wallpaper package. You will also need to install python-shell and python-pickle
Title: Change Wallpaper If Rotate Screen
Post by: Meanie on January 17, 2007, 02:47:57 am
ok, rox takes a soap message which tells it where the info for the backdrop (wallpaper) comes from.

i have created a little package which can control the background image displayed by rox from the command line so it can be called from the rotate script. look for rox-backdrop in the new packages announcement