LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 01-05-2007, 05:11 AM   #1
sadarax
Member
 
Registered: Sep 2005
Distribution: Ubuntu
Posts: 249

Rep: Reputation: 30
Desktop Wallpaper program


I am thinking of trying to write my own Desktop Wallpaper program. How is the desktop wallpaper controlled within KDE? Is there an API for setting the wallpaper on the desktop(s)? Also, is there a more general method for setting the background, something that is control my the X-Session (I am using Xorg)?

I am thinking of trying to write my own Desktop Wallpaper program. I have several features in mind for it. Currently I have not found a good wallpaper program that does most of them. I hope this is the right forum.

One other thing, is there a way to know when a screen saver is active on a desktop? I am sure I could perform some hack using the 'ps' command and grepping the output, but I am looking for a better solution. Thanks in advance.

Last edited by sadarax; 01-05-2007 at 06:34 PM.
 
Old 01-05-2007, 05:56 AM   #2
FnordPerfect
Member
 
Registered: Dec 2006
Location: Germany
Distribution: Kubuntu (Feisty Fawn), Debian (SID)
Posts: 127

Rep: Reputation: 15
What you see in the background behind all application windows is called the 'root window' in X11 terminology.

Without KDE (or similar), any program could draw on that "window". Before I switched to KDE, I used the 'xv' image viewer to set an image in the root window, but there are countless alternatives.
Even screensavers or video players could run within the root window, behind your applications! I was pretty impressed by that when I made my first steps with Linux.

However, with KDE running, KDE's kdesktop component "overpaints" this area.

Have a look at KDE's DCOP (Desktop COmmunication Protocol). This is KDE's powerful and easy-to-use Inter-Process-Communication subsystem.
Most KDE applications expose parts of their functionality through this interface.
I am not a programmer at all, but with this, even I can hack together some very nifty things to make KDE do what I want.

I don't know which language you want to implement your program, but there are DCOP-hooks available for pretty much all languages...

If you want to put together a simple shell script, there is a command line utility named 'dcop'.
Without arguments, it shows all registered DCOP services. Use that or use kdcop to browse them graphically, and play around with it. It is pretty self-explanatory.

Type
Code:
 dcop kdesktop KBackgroundIface
at a terminal to see all functions that control background drawing.
I guess, setWallpaper is the function you are looking for.

Alas, I cannot help you with your second question...

cheers
 
Old 05-30-2007, 01:35 PM   #3
javaunixsolaris
Member
 
Registered: Jan 2007
Location: Colorado
Distribution: Kubuntu
Posts: 47

Rep: Reputation: 15
how to change KDE desktop wallpaper from cmd line

FnordPerfect, you rock! I can't find the dcop API and there's no man page! but guessing based off of the method names is probably good enough. Here's how to change your wallpaper from the command line:

Code:
dcop kdesktop KBackgroundIface setWallpaper /tmp/whateverpicyouwant.jpg 5
The code tag above looked like sh*t in my firefox so here it is unadulterated:dcop kdesktop KBackgroundIface setWallpaper /tmp/whateverpicyouwant.jpg 5
mode 5? who knows no API, it looks best I'm guessing "tiled not scaled".

I'm planning on writing a script to download a new pic and change my background everyday, I'll keep you guys posted.

Last edited by javaunixsolaris; 05-30-2007 at 01:36 PM.
 
Old 09-25-2007, 07:28 PM   #4
javaunixsolaris
Member
 
Registered: Jan 2007
Location: Colorado
Distribution: Kubuntu
Posts: 47

Rep: Reputation: 15
I know it's been ages but I got back to this program, running the dcop command from a cron will give you "ERROR: Couldn't attach to DCOP server!" I checked whoami and it is me and I can run the command just fine.
 
Old 09-25-2007, 07:35 PM   #5
sadarax
Member
 
Registered: Sep 2005
Distribution: Ubuntu
Posts: 249

Original Poster
Rep: Reputation: 30
I wish I could help you, but I'm not sure about the problem. Is KDE/KDM running? Are you running the command from a shell window?
 
Old 09-26-2007, 11:22 AM   #6
javaunixsolaris
Member
 
Registered: Jan 2007
Location: Colorado
Distribution: Kubuntu
Posts: 47

Rep: Reputation: 15
Here's everything:

Code:
$ dcop kdesktop KBackgroundIface setWallpaper /tmp/astronomyPicOfDay/070925/zodiacal_beletsky.jpg 5
Works great from the command line (make sure to use a full path of a real picture) now make a JOB file (a.job):
Code:
#This is a crontab file to download astronomy pic of the day everynight.
#CRON: minute hour day_of_month month day_of_week COMMAND

#The cron output itself
MAILTO=USE_YOUR_EMAIL_TO_SEE_OUTPUT@email.com
SHELL=/bin/bash

#Get astronomy pic of the day
20 9 * * *     dcop kdesktop KBackgroundIface setWallpaper /tmp/astronomyPicOfDay/070925/zodiacal_beletsky.jpg 5
To install a cron just type "crontab a.job", to see it was installed type "crontab -l". Also you'll want to change the time to something pretty soon in this example I used 9:20AM. Now this is what comes to my e-mail: "ERROR: Couldn't attach to DCOP server!"
 
Old 09-28-2007, 05:40 PM   #7
javaunixsolaris
Member
 
Registered: Jan 2007
Location: Colorado
Distribution: Kubuntu
Posts: 47

Rep: Reputation: 15
So I guess I can't fully automate this program with CRON (yet...). Here is a cool script that will go to the website and change your background to the "Astronomy Picture of the Day".

Download: http://www.badgerpile.com/getAstronomyPicOfDay.sh
You may have to make sure it's executable,
Code:
$ chmod 777 getAstronomyPicOfDay.sh
then
Code:
$ ./getAstronomyPicOfDay.sh
should work.

THANKS NASA this web page rocks: http://antwrp.gsfc.nasa.gov/apod/archivepix.html
 
Old 11-29-2007, 06:30 PM   #8
DavidisLin
LQ Newbie
 
Registered: Nov 2006
Posts: 6

Rep: Reputation: 0
crontab problem

the solution is to use the --user option in the cron tab because
cron assumes that there is no one logged in at the time or at least not you. so here is a version that will work:

Code:
dcop --user auser kdesktop KBackgroundIface setWallpaper /tmp/astronomyPicOfDay/070925/zodiacal_beletsky.jpg 5
replace auser with the user anem and it will work. ive tested it.
 
Old 12-01-2007, 06:41 PM   #9
javaunixsolaris
Member
 
Registered: Jan 2007
Location: Colorado
Distribution: Kubuntu
Posts: 47

Rep: Reputation: 15
Quote:
Originally Posted by DavidisLin View Post
the solution is to use the --user option...
Yeah I found that out, and that's how the script works today. Go ahead and check it out (two posts up). Thanks.
 
  


Reply

Tags
automatic, desktop, kde, program, wallpaper


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Knoppix desktop wallpaper newbiesforever Debian 4 04-30-2006 01:23 PM
video4linux as desktop wallpaper aerogate Mandriva 4 10-28-2005 05:47 AM
Is there a wallpaper/desktop program for Debian? SonoranFun Linux - Software 1 07-09-2005 05:09 AM
The New Gl Matrix Desktop Wallpaper?? memo007 General 10 02-26-2005 03:22 AM
Were Do I Find The Best Desktop Wallpaper? micxz General 14 09-30-2003 05:45 AM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration