This commit is contained in:
Benjamin Schaaf
2021-02-14 21:50:49 +11:00
parent e511d471fc
commit bef07bcdf1

View File

@@ -647,6 +647,8 @@ class SublimeMusicApp(Gtk.Application):
"playlist": self.on_go_to_playlist,
}[action](None, GLib.Variant("s", value))
_inhibit_cookie = None
@dbus_propagate()
def on_play_pause(self, *args):
if self.app_config.state.current_song_index < 0:
@@ -663,6 +665,14 @@ class SublimeMusicApp(Gtk.Application):
# This is from a restart, start playing the file.
self.play_song(self.app_config.state.current_song_index)
# Inhibit suspend when playing
if self._inhibit_cookie:
self.uninhibit(self._inhibit_cookie)
self._inhibit_cookie = None
if self.app_config.state.playing:
self._inhibit_cookie = self.inhibit(None, Gtk.ApplicationInhibitFlags.SUSPEND, "Playing music")
self.update_window()
def on_next_track(self, *args):