From e62b5c1dfd9cc85d1e0766e6cd085fbf0b58405b Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 12 Mar 2020 00:35:29 +0530 Subject: Add image setting capability --- README.org | 11 ++++++++++- main.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index f24d0ab..53074d3 100644 --- a/README.org +++ b/README.org @@ -3,5 +3,14 @@ Cetus is a wallpaper setting tool written in Go. This is a work in-progress. * Features -** TODO Set given wallpaper +** Supports various Image of the Day services +There are several Image of the Day services on the web, cetus will pull the +latest image & set it as wallpaper. +*** TODO NASA Image of the Day +*** TODO Bing Image of the Day +** DONE Set given wallpaper Takes a path as input & sets it as wallpaper. + +* Dependency +** [[https://feh.finalrewind.org/][feh]] +Required to set the wallpaper. diff --git a/main.go b/main.go index a208c0e..aa1e639 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,41 @@ package main +import ( + "flag" + "fmt" + "log" + "os/exec" +) + func main() { + var ( + imgPath string + err error + ) + + // Parse flags passed to program + flag.StringVar(&imgPath, "img-path", "", "Image to set as wallpaper") + flag.Parse() + + if len(imgPath) > 0 { + err = setWall(imgPath) + if err != nil { + log.Fatal(err) + } + return + } +} + +func setWall(imgPath string) error { + var err error + + feh, err := exec.LookPath("feh") + if err != nil { + fmt.Println("Error: feh is not in $PATH") + return err + } + err = exec.Command(feh, "--bg-fill", imgPath).Run() + return err } -- cgit 1.4.1-2-gfad0 id=cab68a5cfce9857b650adc03364423204e27827b'>blame commit diff stats
path: root/editor/VSCode/.vscodeignore
blob: f369b5e55b684e5c99d8446581a52ab2d7fc0437 (plain) (tree)
1
2
3
4