forked from xyproto/wallutils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeepin.go
More file actions
28 lines (22 loc) · 779 Bytes
/
deepin.go
File metadata and controls
28 lines (22 loc) · 779 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
// Deepin windowmanager detector
type Deepin struct {
verbose bool
}
func (d *Deepin) Name() string {
return "Deepin"
}
func (d *Deepin) ExecutablesExists() bool {
return which("deepin-session") != "" && which("dconf") != ""
}
func (d *Deepin) Running() bool {
return containsE("GDMSESSION", "deepin") || containsE("XDG_SESSION_DESKTOP", "deepin") || containsE("XDG_CURRENT_DESKTOP", "deepin")
}
func (d *Deepin) SetVerbose(verbose bool) {
d.verbose = verbose
}
// SetWallpaper sets the desktop wallpaper, given an image filename.
// The image must exist and be readable.
func (d *Deepin) SetWallpaper(imageFilename string) error {
return run("dconf write /com/deepin/wrap/gnome/desktop/background/picture-uri \"'"+imageFilename+"'\"", d.verbose)
}