Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no logout sound #119

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dde-api (6.0.12) unstable; urgency=medium

* fix: no logout sound (linuxdeepin/developer-center#9370)

-- zsien <[email protected]> Thu, 20 Jun 2024 17:01:04 +0800

dde-api (6.0.11) unstable; urgency=medium

* feat: support trash and computer scheme(Issue: https://github.com/linuxdeepin/developer-center/issues/8266)
Expand Down
16 changes: 12 additions & 4 deletions sound-theme-player/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func (m *Manager) Play(theme, event, device string) *dbus.Error {

go func() {
m.player.Volume = cfg.Volume
if device == "" {
device = generateDevice(cfg.Card, cfg.Device)
}
logger.Info("volume: ", m.player.Volume)
m.doPlaySound(theme, event, device)
os.Exit(0)
Expand All @@ -151,10 +154,7 @@ func (m *Manager) PrepareShutdownSound(uid int) *dbus.Error {
return dbusutil.ToError(err)
}

device := "default"
if cfg.Card != "" && cfg.Device != "" {
device = fmt.Sprintf("plughw:CARD=%s,DEV=%s", cfg.Card, cfg.Device)
}
device := generateDevice(cfg.Card, cfg.Device)
shutdownCfg.CanPlay = true
shutdownCfg.Theme = cfg.Theme
shutdownCfg.Event = soundutils.EventSystemShutdown
Expand All @@ -166,6 +166,14 @@ func (m *Manager) PrepareShutdownSound(uid int) *dbus.Error {
return dbusutil.ToError(err)
}

func generateDevice(card, device string) string {
if card != "" && device != "" {
return fmt.Sprintf("plughw:CARD=%s,DEV=%s", card, device)
}

return "default"
}

func (*Manager) GetInterfaceName() string {
return dbusInterface
}
Expand Down
Loading