wallpapr

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

wallpapr

Gets random photos from Unsplash and sets them as the desktop background. Works on Debian operating systems select operating systems (e.g. Ubuntu, Linux Mint), at least for now.

Requirements

In addition to having go installed to your system, you'll also need an Unsplash Developers Account for you to get an unsplash access key to be used for API calls under the hood. Proceed to Unsplash Developers and create an account. After creating an account, create an app. You'll get the app's access key towards the bottom of the created app's page.

Installation

$ go get -u github.com/eddogola/wallpapr/...
go: finding github.com/eddogola/wallpapr latest
...
go: finding github.com/eddogola/unsplash-go latest
go: finding golang.org/x/oauth2 latest
go: finding golang.org/x/net latest

Usage

wallpapr is mostly used as a command line application, but can also be used as a package.

set random wallpaper
gets a random wallpaper from unsplash and sets it as the desktop background

Usage:
  Wallpapr set-random [flags]

Flags:
  -d, --destination string   the directory where downloaded photos will be saved (default "<HOME>/wallpapers/")
  -h, --help                 help for set-random
  

Example

$ wallpapr set-random
Downloading https://unsplash.com/photos/-4Px6AOOPkI/download...
Progress 412809 / 872782 bytes (47%)
Download saved to .//home/ogola/wallpapers/Tommy-Nguyen--4Px6AOOPkI-unsplash.jpg 
2021/04/15 /home/ogola/wallpapers/Tommy-Nguyen--4Px6AOOPkI-unsplash.jpg set as wallpaper

Dependencies

Contributing

Please feel free to PR, point issues out, and implement more features(like adding support for more platforms)

Way forward

This CLI app is not yet mature. It can benefit from a lot of refactoring and test writing. Still learning 🌴

Documentation

Overview

Package wallpapr sets a random photo from unsplash.com as the desktop background for (at least right now) computers using the Debian distros.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetWallpaper

func SetWallpaper(filePath string) error

SetWallpaper uses gsettings to set background pic

Types

type Wallpapr

type Wallpapr struct {
	// contains filtered or unexported fields
}

Wallpapr contains the unsplash API client wrapper

func NewWallpapr

func NewWallpapr(dst, clientID string) *Wallpapr

NewWallpapr initializes a Wallpapr with a basic stdout logger and a basic Unsplash object, unauthorized for private unsplash actions.

func (*Wallpapr) Get

func (w *Wallpapr) Get(pic *client.Photo) (string, error)

Get saves the `Photo` provided in `Wallpapr.dst`

func (*Wallpapr) SetRandom

func (w *Wallpapr) SetRandom() error

SetRandom gets a random photo from `Wallpapr.unsplash.Photos.Random` downloads and saves the photo to `Wallpapr.dst` and sets the photo aas the desktop background.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL