Custom Desktop Wallpaper Generator with NodeJS and PhantomJS
Custom desktop wallpaper generator with NodeJS and PhantomJS
Based on
base-desckdesck
For Windows, please place the
phantomsjs.exeon your
PATH.
Clone and run the application on your local computer
$ git clone git://github.com/weisjohn/desckit.git $ cd desckit $ npm install $ node .
Once ready, navigate your browser to
http://localhost:1280/descks/base-desck/displayto preview the
base-desckdesck and it's output.
To generate a desktop wallpaper append
renderto the url (like so:
http://localhost:1280/descks/base-desck/renderwhich will create a new file (or overwrite existing one) in
/desckit/public/cache/base-desck/directory.
asd To display your wallpaper in Windows 7/8 use the built in wallpaper rotation tool.
Personalize(the lower-most item)
Desktop Backgroundin the bottom area of the window
Browse...next to
Picture location:dropdown
/desckit/public/cache/[DESCK_NAME]directory where
[DESCK_NAME]is the style you want to use
Shuffleis not marked
Save changes
If you configured the application correctly you will now see the generated wallpaper showing on your desktop.
You might run into some issues running phantomjs on windows properly (make sure you follow all the recommended installations steps as seen on node-gyp repo), in which case installing phantom with the following flags might be helpful:
$ npm install phantom -msvs_version=2012
To display your wallpaper in Mac OSX use the built in wallpaper rotation tool.
System Preferences
Desktop & Screen Save(in the top-left area)
+button to choose a folder
/desckit/public/cache/[DESCK_NAME]directory where
[DESCK_NAME]is the style you want to use
Change picture:interval make sure
Random orderis not selected
If you configured the application correctly you will now see the generated wallpaper showing on your desktop.
The application supports custom scripts to be created.
See
/public/descks/base-desck/to get started with creating your own descks. The best way to get started with Desckit is by hacking away at that desck.
To create a desck you will need to create a new directory in
/desckit/public/desckswith your name of choise, and put a
desck.jsonin it (a good starting point would be to copy
base-desckdesck).
There are currently 2 mandatory script files:
script.ejs- This is the HTML template for the layout of the desktop wallpaper.
script.js- This is the Server-side(!!) script to be run when the script is requested. This runs in your NodeJS instance so you can configure it to do whatever you want that is supported by NodeJS.
Optionally, you can include more files in scripts:
script.styl- This is the Stylus CSS source file that will generate a
script.cssfile when needed.
Change those files to create your own customized descktop backgrounds.
You can run desckit from the command line as well. This will be the prefered option to run the project in the future.
$ npm install -g desckit
To render the
base-desckscript only one time (think cron)
$ desckit -S base-desck
To re-render every two minutes, specify an interval of 120 seocnds:
$ desckit -S base-desck -I 120
To automatically set the generated file as wallpaper (currently supports only windows)
$ desckit -W
There is one provided example at the moment named
base-desckthat you can use to play around with the application.
Since this is basically a web-page being rendered into a desktop background, there are a lot of things that can be done with it; just to give you some direction:
Since this is being rendered on a WebKit based browser, basically anything that you can think of creating with HTML5 can be rendered onto your desktop.
To see the internals of desckit as it operates, set an environment variable for
DEBUGequal to
desckit, such as:
$ DEBUG=desckit* node-dev app.js desckit Express server listening on port 1280 +0ms
We do this to help the command-line tool version output clean.
At this point the application is in preview/alpha version designed to show the capabilities of this technique. Most of the configuration is hard-coded (like the screen-resolution), you are welcome to change it to fit your needs. Some of the modules used are outdated (like datejs), and in general this is a work in progress aimed at hackers rather than the end-user at this point.
The goals for this project are:
Created by Eli Sklar
Email: [email protected]
Twitter: @EliSklar