Skip to content

Commit

Permalink
Package rename
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Feb 16, 2019
1 parent 8ce12d4 commit 6fba1f7
Show file tree
Hide file tree
Showing 39 changed files with 82 additions and 361 deletions.
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Monitor [![Build Status](https://travis-ci.org/xyproto/monitor.svg?branch=master)](https://travis-ci.org/xyproto/monitor) [![GoDoc](https://godoc.org/github.com/xyproto/monitor?status.svg)](http://godoc.org/github.com/xyproto/monitor) [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/xyproto/monitor/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/xyproto/monitor)](https://goreportcard.com/report/github.com/xyproto/monitor)
# Wallutils [![Build Status](https://travis-ci.org/xyproto/wallutils.svg?branch=master)](https://travis-ci.org/xyproto/wallutils) [![GoDoc](https://godoc.org/github.com/xyproto/wallutils?status.svg)](http://godoc.org/github.com/xyproto/wallutils) [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/xyproto/wallutils/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/xyproto/wallutils)](https://goreportcard.com/report/github.com/xyproto/wallutils)

* Detect monitor resolutions and set the desktop wallpaper, for any window manager (please file an issue if your window manager is not supported yet).
* Supports GNOME timed wallpapers, and includes a utility that can run an event loop for changing them (also supports cross fading).
Expand All @@ -21,9 +21,9 @@ The [Mojave timed wallpaper](https://github.com/japamax/gnome-mojave-timed-wallp
* `setcollection`, for setting a suitable (in terms of resolution) wallpaper from a wallpaper collection.
* `setrandom`, for setting a random wallpaper.
* `settimed`, for setting GNOME timed wallpapers (will continue to run, to handle time events).
* `setwallpaper` can be used for setting a wallpaper (works both for X11 and Wayland).
* `setwallpaper` can be used for setting a wallpaper (works both over X and the Wayland protocol).
* `wayinfo` shows detailed information about the connected monitors, via Wayland.
* `xinfo` shows detailed information about the connected monitors, via X11.
* `xinfo` shows detailed information about the connected monitors, via X.
* `xml2stw` for converting GNOME timed wallpapers to the Simple Timed Wallpaper format.

## Example use of the `lsmon` utility
Expand All @@ -44,41 +44,39 @@ Using make, for building and installing all included utilities:

Using Go 1.11 or later, for a single utility:

go get -u github.com/xyproto/monitor/cmd/setwallpaper
go get -u github.com/xyproto/wallutils/cmd/settimed

On Arch Linux:

Install `monitor` from AUR, or:
Install `wallutils` from AUR, or:

sudo pacman -Syu git go libxcursor libxmu wayland xbitmaps xorgproto
go get -u github.com/xyproto/monitor/cmd/setwallpaper
cd ~/go/src/github.com/xyproto/monitor
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make install

On Ubuntu:

sudo apt get update
sudo apt get install libxcursor-dev libxmu-dev libx11-dev git golang-go
go get -u github.com/xyproto/monitor/cmd/setwallpaper
cd ~/go/src/github.com/xyproto/monitor
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make install

Manually:
## Example use of `settimed`

# clone the repository
git clone https://github.com/xyproto/monitor

# build and install the setwallpaper command
cd monitor/cmd/setwallpaper
go build
install -Dm755 setwallpaper /usr/bin/setwallpaper
settimed mojave-timed

## Example use of `setwallpaper`

setwallpaper /path/to/background/image.png

## Example use of `setrandom`

setrandom /usr/share/pixmaps

## Example use of the Go package

### Retrieve monitor resolution(s)
Expand All @@ -90,12 +88,12 @@ import (
"fmt"
"os"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

func main() {
// Retrieve a slice of Monitor structs, or exit with an error
monitors, err := monitor.Detect()
monitors, err := wallutils.Monitors()
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
Expand All @@ -111,7 +109,7 @@ func main() {

```go
fmt.Println("Setting background image to: " + imageFilename)
if err := monitor.SetWallpaper(imageFilename); err != nil {
if err := wallutils.SetWallpaper(imageFilename); err != nil {
return err
}
```
Expand Down
2 changes: 1 addition & 1 deletion cinnamon.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package monitor
package wallutils

// Cinnamon windowmanager detector
type Cinnamon struct {
Expand Down
2 changes: 1 addition & 1 deletion closest.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package monitor
package wallutils

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion closest_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package monitor
package wallutils

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions cmd/getdpi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"os"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

func main() {
// Retrieve a slice of Monitor structs, or exit with an error
monitors, err := monitor.Detect()
monitors, err := wallutils.Monitors()
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
Expand All @@ -28,7 +28,7 @@ func main() {
fmt.Printf("%dx%d\n", DPIw, DPIh)
return
} else if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Println(monitor.VersionString)
fmt.Println(wallutils.VersionString)
os.Exit(0)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/lscollection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
"os"
"path/filepath"
"text/tabwriter"
Expand All @@ -22,7 +22,7 @@ func main() {
alsoPrintPath := len(os.Args) > 1 && os.Args[1] == "-l"

// Find all wallpapers
searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
6 changes: 3 additions & 3 deletions cmd/lsmon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"os"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

func main() {
// Retrieve a slice of Monitor structs, or exit with an error
monitors, err := monitor.Detect()
monitors, err := wallutils.Monitors()
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
Expand All @@ -19,7 +19,7 @@ func main() {
if len(os.Args) > 1 && (os.Args[1] == "-dpi" || os.Args[1] == "-l") {
fmt.Printf("%d: %dx%d (DPI: %dx%d)\n", mon.ID, mon.Width, mon.Height, mon.DPIw, mon.DPIh)
} else if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Println(monitor.VersionString)
fmt.Println(wallutils.VersionString)
os.Exit(0)
} else {
fmt.Printf("%d: %dx%d\n", mon.ID, mon.Width, mon.Height)
Expand Down
4 changes: 2 additions & 2 deletions cmd/lstimed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
"os"
"text/tabwriter"
)
Expand All @@ -13,7 +13,7 @@ func main() {
// Prepare to write text in columns
w := tabwriter.NewWriter(os.Stdout, 0, 0, 10, ' ', tabwriter.AlignRight)

searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
6 changes: 3 additions & 3 deletions cmd/lswallpaper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package main

import (
"fmt"
"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
"os"
)

func main() {
if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Println(monitor.VersionString)
fmt.Println(wallutils.VersionString)
os.Exit(0)
}
searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
10 changes: 5 additions & 5 deletions cmd/setcollection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import (
"os"
"path/filepath"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

// Select the wallpaper that is closest to the current monitor resolution and set that as the wallpaper
func SelectAndSetWallpaper(wallpapers []*monitor.Wallpaper) error {
func SelectAndSetWallpaper(wallpapers []*wallutils.Wallpaper) error {
// Gather a slice of filenames
var filenames []string
for _, wp := range wallpapers {
filenames = append(filenames, wp.Path)
}

// Select the image that is closest to the monitor resolution
imageFilename, err := monitor.Closest(filenames)
imageFilename, err := wallutils.Closest(filenames)
if err != nil {
return err
}
Expand All @@ -34,7 +34,7 @@ func SelectAndSetWallpaper(wallpapers []*monitor.Wallpaper) error {
}

// Set the desktop wallpaper
if err := monitor.SetWallpaper(imageFilename); err != nil {
if err := wallutils.SetWallpaper(imageFilename); err != nil {
return fmt.Errorf("Could not set wallpaper: %s\n", err)
}

Expand All @@ -51,7 +51,7 @@ func main() {
fmt.Printf("Setting wallpaper collection \"%s\"\n", collectionName)

fmt.Print("Searching for wallpapers...")
searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
6 changes: 3 additions & 3 deletions cmd/setrandom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"time"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

func init() {
Expand All @@ -16,7 +16,7 @@ func init() {

func main() {
if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Println(monitor.VersionString)
fmt.Println(wallutils.VersionString)
os.Exit(0)
}

Expand Down Expand Up @@ -55,7 +55,7 @@ func main() {
os.Exit(1)
}
fmt.Println("Setting background image to: " + imageFilename)
if err := monitor.SetWallpaper(imageFilename); err != nil {
if err := wallutils.SetWallpaper(imageFilename); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/settimed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"

"github.com/xyproto/gnometimed"
"github.com/xyproto/monitor"
"github.com/xyproto/simpletimed"
"github.com/xyproto/wallutils"
)

func exists(path string) bool {
Expand Down Expand Up @@ -40,7 +40,7 @@ func main() {
fmt.Printf("Using: %s\n", stw.Path)
}
// Start endless event loop
if err := stw.EventLoop(verbose, func(path string) error { return monitor.SetWallpaperVerbose(path, verbose) }); err != nil {
if err := stw.EventLoop(verbose, func(path string) error { return wallutils.SetWallpaperVerbose(path, verbose) }); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
Expand All @@ -54,7 +54,7 @@ func main() {
fmt.Printf("Using: %s\n", gtw.Path)
}
// Start endless event loop
if err := gtw.EventLoop(verbose, func(path string) error { return monitor.SetWallpaperVerbose(path, verbose) }); err != nil {
if err := gtw.EventLoop(verbose, func(path string) error { return wallutils.SetWallpaperVerbose(path, verbose) }); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
Expand All @@ -68,7 +68,7 @@ func main() {
fmt.Printf("Setting wallpaper collection: %s\n", collectionName)
fmt.Println("Searching for wallpapers...")
}
searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -101,7 +101,7 @@ func main() {
fmt.Printf("Using: %s\n", stw.Path)
}
// Start endless event loop
if err := stw.EventLoop(verbose, func(path string) error { return monitor.SetWallpaperVerbose(path, verbose) }); err != nil {
if err := stw.EventLoop(verbose, func(path string) error { return wallutils.SetWallpaperVerbose(path, verbose) }); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
Expand All @@ -111,7 +111,7 @@ func main() {
fmt.Printf("Using: %s\n", gtw.Path)
}
// Start endless event loop
if err := gtw.EventLoop(verbose, func(path string) error { return monitor.SetWallpaperVerbose(path, verbose) }); err != nil {
if err := gtw.EventLoop(verbose, func(path string) error { return wallutils.SetWallpaperVerbose(path, verbose) }); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/setwallpaper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"os"
"path/filepath"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

const versionString = "setwallpaper"

func main() {
if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Println(monitor.VersionString)
fmt.Println(wallutils.VersionString)
os.Exit(0)
}

Expand All @@ -36,7 +36,7 @@ func main() {
}

// Set the desktop wallpaper
if err := monitor.SetWallpaper(imageFilename); err != nil {
if err := wallutils.SetWallpaper(imageFilename); err != nil {
fmt.Fprintf(os.Stderr, "Could not set wallpaper: %s\n", err)
os.Exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/timedinfo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/fatih/color"
"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
"strings"

"os"
Expand All @@ -16,7 +16,7 @@ func Indent(s string, prefix string) string {
}

func main() {
searchResults, err := monitor.FindWallpapers()
searchResults, err := wallutils.FindWallpapers()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions cmd/wayinfo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"os"

"github.com/xyproto/monitor"
"github.com/xyproto/wallutils"
)

func main() {
// Fetch the info string
info, err := monitor.WaylandInfo()
info, err := wallutils.WaylandInfo()
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
Expand Down
Loading

0 comments on commit 6fba1f7

Please sign in to comment.