Sponsored Content
Full Discussion: Wallpaper script
Top Forums Shell Programming and Scripting Wallpaper script Post 302548615 by jtsmith90 on Thursday 18th of August 2011 11:27:30 PM
Old 08-19-2011
Bug Wallpaper script

Have trouble picking a wallpaper. Let your computer pick for you.

Code:
 
#!/bin/bash

# (Change to your path to photos)   
 
Pictures='/home/josh/Pictures'       

## Pick new image function
pick_new_bg () {
    backgrounds=( $( < ~/.background_temp) )
    num_backgrounds=${#backgrounds[*]}
    New=$(echo -n "${backgrounds[$((RANDOM%num_backgrounds))]}")    
}

## Get and export the DBUS_SESSION_BUS_ADDRESS for crontab compatibility
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS

## Find image titles in specified directory
ls $Pictures | egrep -i ".jpg|.png" > ~/.background_temp

## Pick new background image
pick_new_bg

## Get file name of current background and ensure the new background is different
Current=$(/usr/bin/gconftool-2 --get /desktop/gnome/background/picture_filename | xargs basename)

while [ $New == $Current ]
do
    pick_new_bg
done
## Set the new background and remove the temp file
/usr/bin/gconftool-2 --type string --set /desktop/gnome/background/picture_filename $Pictures/$New

rm ~/.background_temp

Josh
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

wallpaper anyone?

we have a UNIX workstation using 'CDE' desktop manager, i'ts kind of dull seeing the same wallpaper all over again and again and again everyday. is it possible put my own wallpaper? how? i'm sure it is not similar with windows wherein you just put your bitmap file in the windows folder or is it... (2 Replies)
Discussion started by: inquirer
2 Replies

2. UNIX for Dummies Questions & Answers

Putting Wallpaper on the Desktop

How do I put wallpaper from the internet on the Unix desktop? For example, I want to know how to perform the same operation as "right click-> Set as Wallpaper" on a graphics on a web page, in Windows. Thanks! :rolleyes: (3 Replies)
Discussion started by: pireifej
3 Replies

3. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

4. Solaris

change wallpaper in CDE

I'm running Solaris 9, using the CDE gui on a SunBlade 100. I want to substitute the generic wallpapers that CDE has, with my own, i.e. my kids, dog, etc. Suggestions? Directions?? Thanks in advance. (19 Replies)
Discussion started by: antalexi
19 Replies

5. Shell Programming and Scripting

Shell Script Xml file wallpaper

Hello, I have a custom background in my Fedora 14 OS. which changes every 10 mins, I was able to edit an Xml file for this purpose. The structure of the Xml file looks as follows : <!-- This animation will start at time shown above. --> <static> <duration>600.0</duration> ... (3 Replies)
Discussion started by: ajayram
3 Replies

6. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

7. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

8. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
bup-margin(1)						      General Commands Manual						     bup-margin(1)

NAME
bup-margin - figure out your deduplication safety margin SYNOPSIS
bup margin [options...] DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids. For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by its first 46 bits. The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits, that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits with far fewer objects. If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if you're getting dangerously close to 160 bits. OPTIONS
--predict Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer from the guess. This is potentially useful for tuning an interpolation search algorithm. --ignore-midx don't use .midx files, use only .idx files. This is only really useful when used with --predict. EXAMPLE
$ bup margin Reading indexes: 100.00% (1612581/1612581), done. 40 40 matching prefix bits 1.94 bits per doubling 120 bits (61.86 doublings) remaining 4.19338e+18 times larger is possible Everyone on earth could have 625878182 data sets like yours, all in one repository, and we would expect 1 object collision. $ bup margin --predict PackIdxList: using 1 index. Reading indexes: 100.00% (1612581/1612581), done. 915 of 1612581 (0.057%) SEE ALSO
bup-midx(1), bup-save(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-margin(1)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy