-
Yep, dcop is the answer to changing the background instantly.
Here's the command (if the syntax looks weird just run kdcop and it will make more sense):
dcop kdesktop KBackgroundIface setWallpaper /home/luser/pics/hotbabe.jpg 1
Replace picture path appropriately and change the last number to the way you want to have the background displayed:
1: Centered
2: Tiled
3: Center Tiled
4: Centered Maxpect
5: Tiled Maxpect
6: Scaled
7: Centered Auto Fit
This will actually update the file:
~/.kde/share/config/kdesktoprc
so that the lines Wallpaper=, and WallpaperMode= will be changed by dcop instantly. So using this command is arguably cleaner than using the sed and perl scripts posted above.
Here's a quick and dirty shell script to get the job done.
It picks a random picture from a specified directory (that must contain only pictures, all in the same folder) and changes the background immediately.
Code:
!/bin/bash
# ---Replace with appropriate path to wallpaper pics [use /path/* notation]---
wallpaperPath="/home/luser/wallpaper/*"
# ---Replace number with preferred tiling method---
# 1: Centered
# 2: Tiled
# 3: Center Tiled
# 4: Centered Maxpect
# 5: Tiled Maxpect
# 6: Scaled
# 7: Centered Auto Fit
tilingMethod=4
# Count total number of pictures in directory
totalCnt=0
for picture in $wallpaperPath
do
totalCnt=`expr $totalCnt + 1`
done
# Seed random generator with date in seconds and choose random picture
RANDOM=`date '+%s'`
randomPic=$[($RANDOM % $totalCnt)+1]
# Find chosen picture in directory
picCnt=1
for picture in $wallpaperPath
do
if [ $picCnt = $randomPic ]
then
break
fi
picCnt=`expr $picCnt + 1`
done
echo New random background: $picture
# Set wallpaper immediately
dcop kdesktop KBackgroundIface setWallpaper "$picture" $tilingMethod
I've tested this only on SuSE 9.1, but I'm pretty sure it will work in most KDE environments.
I'm tempted to write a cleaner, more flexible C version... maybe if I feel bored enough.
Hope this helps, cheers.
Similar Threads
-
By kooladi in forum Customising & Remastering
Replies: 1
Last Post: 09-02-2005, 02:32 PM
-
By zxc in forum General Support
Replies: 4
Last Post: 01-19-2005, 01:02 AM
-
By reecegeorge in forum Customising & Remastering
Replies: 0
Last Post: 11-03-2003, 01:24 PM
-
By neomarkprice48 in forum Customising & Remastering
Replies: 3
Last Post: 05-22-2003, 12:36 PM
-
By Nomad in forum Hdd Install / Debian / Apt
Replies: 0
Last Post: 02-10-2003, 07:08 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

HGST HUA723030ALA640 3TB SATA 7200 RPM 3.5 in Enterprise HDD | 0F14044 (100%)
$45.00

Western Digital HUS726T4TAL5204 4TB 7.2K SAS 12Gb/s 3.5" 512e HDD NetApp X375A
$64.00

Dell ST6000NM0034 1HT27Z-150 NWCCG 6TB SAS 3.5 7.2K ENTERPRISE SERVER DRIVE
$68.99

HDD 3.5" SATA Hard Drive with Windows 10/Win 11 64x Installed Legacy
$35.00

Seagate ST6000NM0115 6TB 256MB 7200RPM 3.5" SATA 6.0Gb/s Enterprise Hard Drive
$159.99

Hitachi / HGST Travelstar HTS541010B7E610 1TB 2.5" SATA III HDD
$29.99

HGST HUS724040ALA640 4TB 7200 RPM SATA 3.5" Internal Desktop Drive 100% Health
$78.00

Seagate ST2000NM0045 2TB 3.5" 12Gb/s 128MB 7.2K RPM SAS HDD P/N: 1V4204-002
$24.99

Toshiba 1TB 2.5" SATA HDD MQ01ABD100V 5400RPM 9.5mm Laptop Internal Hard Drive
$51.99

HUS726060ALA640 HGST Ultrastar 6TB SATA 6Gbps 7.2K 3.5" Hard Drive OF21860
$129.99