You are not logged in.

#1 2013-01-02 12:01:36

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,695
Website

lunifybg - add image of moon from live feed to your desktop background

I found a link to a live image of the moon and decided to incorporate it into my desktop background with a script: lunifybg

The script is the one that I use on my own system and I will change it to suit my background when necessary, so use it as a starting point for your own customized script rather than keeping it synchronized with mine.

The current script makes the following assumptions:
* you have feh, imagemagick and wget installed
* your desktop background is dark
* your desktop background is set using feh so ~/.fehbg exists
* the moon should be added to the top-right corner

The script will not modify the current background image. It will use it as a base to create a separate composite image. It won't even change ~/.fehbg because it uses ~/.fehbg to locate the base background image.

The script is very simple and thus easy to change (position of moon, compositing parameters, base image determination, etc.).


Usage:

# get the current image and add it to the bg
lunifybg refresh

# restore the old background
lunifybg clear

# switch back to last composite background
lunifybg show

# show help
lunifybg help
lunifybg --help
lunifybg -h
lunifybg wtf
lunifybg blah blah blah

The script will not automatically update the background, although it would be easy to modify it to do so (or you could cron it). If you do, do not refresh more than once every 15 minutes. The changes between images taken at shorter intervals are barely noticeable and it is just a waste of the server's bandwidth.

Offline

#2 2013-01-02 19:41:08

ShadowKyogre
Member
From: Hell! XP No... I'm not telling
Registered: 2008-12-19
Posts: 474
Website

Re: lunifybg - add image of moon from live feed to your desktop background

Had to modify the decrement counter to get it working. Otherwise, this is fantastic! I'll try working on a variant that works with wallpaperd.

--- lunifybg.orig	2013-01-02 19:35:20.757345700 +0000
+++ lunifybg	2013-01-02 19:37:38.117365760 +0000
@@ -38,14 +38,13 @@
 n=${#fehbg[@]}
 
 # The original background image.
-bg_img="${fehbg[--n]}"
-
+n=$(($n-1))
+bg_img="${fehbg[$n]}"
 # Update the command to use the composite image and avoid overwriting ~/.fehbg.
-fehbg[n++]="--no-fehbg"
-fehbg[n++]="$comp_img"
-
-
-
+fehbg[$n]="--no-fehbg"
+n=$(($n+1))
+fehbg[$n]="$comp_img"
+n=$(($n+1))
 
 # Create new bg image with current image of moon.
 function refresh()

For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page

Offline

#3 2013-01-02 20:19:03

Yannick_LM
Member
Registered: 2008-12-22
Posts: 142

Re: lunifybg - add image of moon from live feed to your desktop background

I'm loving it !

Thanks for the idea

Offline

#4 2013-01-02 22:43:50

ShadowKyogre
Member
From: Hell! XP No... I'm not telling
Registered: 2008-12-19
Posts: 474
Website

Re: lunifybg - add image of moon from live feed to your desktop background

Made a rough draft version for wallpaperd: https://gist.github.com/4438979


For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page

Offline

Board footer

Powered by FluxBB