forked from xyproto/wallutils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgnome3.go
More file actions
28 lines (22 loc) · 795 Bytes
/
gnome3.go
File metadata and controls
28 lines (22 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package wallutils
// Gnome3 windowmanager detector
type Gnome3 struct {
verbose bool
}
func (g3 *Gnome3) Name() string {
return "Gnome3"
}
func (g3 *Gnome3) ExecutablesExists() bool {
return which("gsettings") != ""
}
func (g3 *Gnome3) Running() bool {
return (containsE("GDMSESSION", "gnome") || containsE("XDG_SESSION_DESKTOP", "gnome") || containsE("XDG_CURRENT_DESKTOP", "gnome") || containsE("XDG_CURRENT_DESKTOP", "GNOME"))
}
func (g3 *Gnome3) SetVerbose(verbose bool) {
g3.verbose = verbose
}
// SetWallpaper sets the desktop wallpaper, given an image filename.
// The image must exist and be readable.
func (g3 *Gnome3) SetWallpaper(imageFilename string) error {
return run("gsettings set org.gnome.desktop.background picture-uri \"file://"+imageFilename+"\"", g3.verbose)
}