Skip to content

Commit

Permalink
chore: 修改默认greeter壁纸 (linuxdeepin#645)
Browse files Browse the repository at this point in the history
修改默认greeter壁纸
Issue: linuxdeepin/developer-center#10264

Co-authored-by: fuleyi <[email protected]>
  • Loading branch information
fly602 and fly602 authored Aug 9, 2024
1 parent e16a0b5 commit 3e68a35
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions accounts1/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,42 @@ const (
defaultWorkspace = 1
)

func getDefaultUserBackground() string {
filename := filepath.Join(defaultUserBackgroundDir, "desktop.bmp")
_, err := os.Stat(filename)
if err == nil {
return "file://" + filename
const (
deepinThemePath = "/usr/share/deepin-themes/"
defaultTheme = "bloom"
themeFile = "index.theme"
themeGroupDefault = "DefaultTheme"
themeGroupDark = "DarkTheme"
configKeyLockBackground = "LockBackground"
)

func getThemeLockBackground(theme string) string {
kf, err := dutils.NewKeyFileFromFile(
path.Join(deepinThemePath, theme, themeFile))
if err != nil {
logger.Warning("load theme failed", err)
return ""
}
defer kf.Free()
bg, err := kf.GetString(themeGroupDefault, configKeyLockBackground)
if err != nil {
logger.Warning("get lock background failed", err)
return ""
}
if !dutils.IsFileExist(bg) {
return ""
}
return bg
}

return "file://" + filepath.Join(defaultUserBackgroundDir, "desktop.jpg")
// 通过默认主题去获取壁纸
func getDefaultUserBackground() string {
bg := "file://" + filepath.Join(defaultUserBackgroundDir, "deepin-default.jpg")
value := getThemeLockBackground(defaultTheme)
if value != "" {
bg = value
}
return bg
}

type User struct {
Expand Down

0 comments on commit 3e68a35

Please sign in to comment.