WIP
This commit is contained in:
@@ -647,6 +647,8 @@ class SublimeMusicApp(Gtk.Application):
|
|||||||
"playlist": self.on_go_to_playlist,
|
"playlist": self.on_go_to_playlist,
|
||||||
}[action](None, GLib.Variant("s", value))
|
}[action](None, GLib.Variant("s", value))
|
||||||
|
|
||||||
|
_inhibit_cookie = None
|
||||||
|
|
||||||
@dbus_propagate()
|
@dbus_propagate()
|
||||||
def on_play_pause(self, *args):
|
def on_play_pause(self, *args):
|
||||||
if self.app_config.state.current_song_index < 0:
|
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.
|
# This is from a restart, start playing the file.
|
||||||
self.play_song(self.app_config.state.current_song_index)
|
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()
|
self.update_window()
|
||||||
|
|
||||||
def on_next_track(self, *args):
|
def on_next_track(self, *args):
|
||||||
|
Reference in New Issue
Block a user