-
Notifications
You must be signed in to change notification settings - Fork 40
/
lxde.go
49 lines (42 loc) · 786 Bytes
/
lxde.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package wallpaper
import (
"os/user"
"path/filepath"
ini "gopkg.in/ini.v1"
)
func getLXDE() (string, error) {
usr, err := user.Current()
if err != nil {
return "", err
}
if DesktopSession == "" {
DesktopSession = "LXDE"
}
cfg, err := ini.Load(filepath.Join(usr.HomeDir, ".config/pcmanfm/"+DesktopSession+"/desktop-items-0.conf"))
if err != nil {
return "", err
}
key, err := cfg.Section("*").GetKey("wallpaper")
if err != nil {
return "", err
}
return key.String(), err
}
func (mode Mode) getLXDEString() string {
switch mode {
case Center:
return "center"
case Crop:
return "crop"
case Fit:
return "fit"
case Span:
return "screen"
case Stretch:
return "stretch"
case Tile:
return "tile"
default:
panic("invalid wallpaper mode")
}
}