Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Greetings,

I'm running a guest Linux OS on top of Windows XP, which rotates its wallpapers using the PowerToy Wallpaper Changer. I'm hoping for a way for my guest OS to somehow detect which wallpaper the host is using, and automatically switch to it.

Why? Because if I run my guest OS in seamless mode and have transparent windows, I want the transparent background to match the host OS. It looks nice that way :).

A couple tidbits of relevant information:

  • Guest OS is Peppermint Ice (Ubuntu based)
  • Host OS is Windows XP
  • VirtualBox as virtualization software

I realize this is somewhat breaking borders between the host and the guest, but I want my pretty rotating wallpaper! I'm guessing there is a way using scripts and shared folders or something similar, if not by means of just querying the host OS.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

This question will end needing programming. You can start listening to Desktop Settings changes, when a new setting is applied grab the current path to wallpaper from registry and "signal" to some app.

Thats a example I made and tested against Microsft Windows 7 64bits was compiled using mingw32 (linux devel here) Wallpaper Monitor. You can easily change/expand line 62.

share|improve this answer
    
Thanks, I'm guessing the same registry setting also works for Windows 7? –  Jeff Jun 7 '11 at 21:02
1  
Yes same @Jeff . Here is a small code of mine for setting random wp rejeane.c project in C. –  dvd Jun 7 '11 at 22:13
    
Looks like you've given enough info here for me to get something working on my Windows 7 machine as well! Thanks! –  Jeff Jun 8 '11 at 21:21
add comment

If you're using Windows PowerToys, the current active wallpaper will be at C:\WINDOWS\system32\toyhide.bmp.

You can set up the virtual machine to mount the system32 folder and add a cron job to set the wallpaper to the toyhide.bmp file every minute. It might be a good idea to mount this folder as read only just in case something tries to muck with it.

Edit: My cron solution annoyed me by always refreshing my wallpaper even when it hadn't changed, so instead I wrote a python script to run at startup. This script basically looks at the mounted toyhide.bmp and only refreshes the wallpaper if it has been modified, checking every second to reduce lag time.

#!/usr/bin/python
import os
import time

# Update to wherever you mounted toyhide.bmp
fname = "/<mnt_location>/toyhide.bmp"

# Peppermint uses pcmanfm for setting the wallpaper. YMMV
wallpaper_cmd = "/usr/bin/pcmanfm  --set-wallpaper=%s" % fname

# Update the wallpaper on startup and save the mod time
os.system(wallpaper_cmd)
mod_time = os.path.getmtime(fname)

while True:
    try:
        # If mod time changes, set wallpaper again and get new mod time
        if os.path.getmtime(fname) != mod_time:
            mod_time = os.path.getmtime(fname)
            os.system(wallpaper_cmd)
    except OSError:
        # Sometimes the mount seems to fail if my computer is sleeping.
        # Just catch the error and try again
        pass 
    time.sleep(1)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.