Author Topic: Change Wallpaper If Rotate Screen  (Read 4460 times)

zs_ftp

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« 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.
« Last Edit: January 08, 2007, 02:23:06 am by zs_ftp »
I apologize, but my English very bad.

Zaurus C3100/SD 2Gb Transcend/Dlink DCF-600WK/CF Bluetake/CF BC-337 GPS
Toshiba U200/T5600/1.5Gb/80Gb/Compex WL54G
SonyEricsson P910i/MS Duo Pro 512Mb
FS Loox 720/SD 2Gb

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #1 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
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

newkirk

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://myzaur.us
Change Wallpaper If Rotate Screen
« Reply #2 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
« Last Edit: January 08, 2007, 11:05:52 am by newkirk »
newkirk @ myzaur.us
pdaxrom @ newkirk.us
SL-5600, SL-C860
Socket & Ambicom WiFis
Billionton bluetooth
Lexar 256mb CF & SD

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #3 on: January 09, 2007, 03:22:00 am »
This is a great workaround, thank you!
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

zs_ftp

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #4 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

I apologize, but my English very bad.

Zaurus C3100/SD 2Gb Transcend/Dlink DCF-600WK/CF Bluetake/CF BC-337 GPS
Toshiba U200/T5600/1.5Gb/80Gb/Compex WL54G
SonyEricsson P910i/MS Duo Pro 512Mb
FS Loox 720/SD 2Gb

kkazakov13

  • Sr. Member
  • ****
  • Posts: 408
    • View Profile
Change Wallpaper If Rotate Screen
« Reply #5 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.
« Last Edit: January 12, 2007, 01:11:54 pm by kkazakov13 »
SL-C3200 ** FOR SALE :( **
https://www.oesf.org/forum/index.php?showtopic=25969

Canon K30225 CF wireless card
Taxan iTax-LAN10 wired card
My packages for customized pdaXrom beta 3

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #6 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
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

Ling

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #7 on: January 15, 2007, 10:05:28 am »
Is it not possible to compile plasterer for pdaXrom?
SL-C3200 w/ pdaXii13 5.3
SL-C860 w/ OZ GPE 3.4.1
Accessories: 4GB Microdrive, 4GB Transcend SD, Linksys WFC12 CF 802.11b, Ambicom CF Modem, Socket Bluetooth

kkazakov13

  • Sr. Member
  • ****
  • Posts: 408
    • View Profile
Change Wallpaper If Rotate Screen
« Reply #8 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
SL-C3200 ** FOR SALE :( **
https://www.oesf.org/forum/index.php?showtopic=25969

Canon K30225 CF wireless card
Taxan iTax-LAN10 wired card
My packages for customized pdaXrom beta 3

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change Wallpaper If Rotate Screen
« Reply #9 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
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Change Wallpaper If Rotate Screen
« Reply #10 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
« Last Edit: January 17, 2007, 01:50:55 am by Meanie »
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Change Wallpaper If Rotate Screen
« Reply #11 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
« Last Edit: January 17, 2007, 09:03:42 pm by Meanie »
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K