Git Product home page Git Product logo

photo-screen-saver's Introduction

photo-screen-saver

icon.png

Windows screen saver that displays a photo slideshow, based on the Electron framework.

Why?

Since modern LCD displays aren't subject to burn-in, screen savers are a thing of the past... right?

Not if you have your HTPC hooked up to a plasma TV -- plasma still has a big problem with burn-in. Finding myself in that situation, I needed a screen saver that would protect the screen while a movie is paused. I also wanted it to look great -- it's in my living room, after all -- but every screen saver I tried looked like it was written decades ago. (Most of them were.)

Modern web technologies make it incredibly easy to create engaging animations. All I needed was a way to marry the web tools we know and love to the Windows screen saver framework. That's where Electron comes in.

Please note: This is currently a Windows-specific project. You can run the code in Electron on other platforms, but you won't get the screen saver integration with the OS.

Before You Build

This screen saver displays a photo slideshow with a simple "Ken Burns" effect. It supports three photo sources:

  • 500px: Photos from "Popular"
  • Flickr: Photos from "Explore"
  • A local folder on your computer

Since I didn't feel like implementing a Settings window, you'll need to make some simple code changes to set up a source. If you take a look at the top of src/index.ts, you'll find the following snippet of code. Do what it says and uncomment only the source you want to use:

// Uncomment ONE of the following photo sources:
import { getPhotos } from "./500px";
// import { getPhotos } from "./flickr";
// import { getPhotos } from "./local-images";

Then do one of the following:

  • 500px: Get a 500px consumer key and put it in src/api-keys.ts:

      export const _500PX_API_KEY = "<your consumer key goes here>";
    
  • Flickr: Get a Flickr API key and put it in src/api-keys.ts:

      export const FLICKR_API_KEY = "<your API key goes here>";
    
  • Local: Edit src/local-images.ts and set the FOLDER_PATH to point to your image folder:

      const FOLDER_PATH = "<your path goes here>";
    

A quick warning: When you display random photos from the web, there's always a chance you'll get something you wouldn't want your kids, your grandma, or your boss to see. These 500px and Flickr API calls are supposed to avoid anything NSFW, but photos do end up in the wrong category from time to time -- don't say I didn't warn you. If you want to stay on the safe side, you can always use your own local folder of photos.

How to Build

Prerequisites: This project requires Node.js -- if you've read this far, you probably already have it. The build uses Grunt, so if you've never installed grunt-cli, run:

npm install -g grunt-cli

Build: To build, go to the project folder and run the following commands:

npm install
grunt

Run: Once the build is complete, you have a couple of options. If you want to quickly fire it up and see what it does, run:

npm start

Install: If you want to install it as a screen saver, look in the package\photo-screen-saver-win32-x64 subfolder and find the file photo-screen-saver.scr. Right-click the file and choose Install. When you go to the Windows screen saver settings, you'll see that photo-screen-saver is now your selected screen saver.

Behind the Scenes

It's a lot easier than I thought to create a screen saver for Windows -- it's just a normal executable with a .scr extension. The program just needs to display a topmost full-screen window and exit on mouse or keyboard activity. These requirements are really easy to meet in Electron!

Note: This project is the bare minimum and won't give you the mini-preview or Settings features. The mini-preview is a pain to implement and to my mind, unnecessary. To support Settings you just need to handle the /S command line argument and display an appropriate UI. (I was too lazy to implement a Settings UI, but you might feel differently!)

Possibilities

This project is a good (if minimal) framework for any screen saver you might want to create. For starters, you could change the 500px or Flickr API calls to get different types of photos. Or you could get photos from another source entirely. If photos aren't your cup of tea, try Googling WebGL demo or three.js demo, pick the coolest animation you can find, and incorporate it into index.ts and index.css. CodePen is another great source of inspiration. Whatever you use, make sure to comply with the license terms!

License

The MIT License

Copyright (c) 2016 Rand Scullard

photo-screen-saver's People

Contributors

randscullard avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.