cboxdoerfer / ddb_musical_spectrum

Musical spectrum for the DeaDBeeF audio player
GNU General Public License v2.0
58 stars 6 forks source link

[Feature request] option to auto pause the sample while invisible #18

Closed rtgiskard closed 2 years ago

rtgiskard commented 2 years ago

if possible, it would be greate to have an option to auto pause the sample while the window is invisible, as for most of the time, the music player is run in backgound

here on my laptop(i5-6300HQ CPU @2.30GHz), without the ddb_musical_spectrum and ddb_spectrogram, the CPU usage could be 2-3%, but with the two plugin on, it's 12-13%

cboxdoerfer commented 2 years ago

I think I already tried to do that, but as far as I remember there was no way to know whether the window is visible on screen. But I'll have a look at it again.

rtgiskard commented 2 years ago

I see deadbeaf use gtk for the ui, if deadbeaf or the plugin can query or just record the related state on operations, this might be done.

Here I find some api that maybe related, hope it may do some help: Gtk.Window.iconify Gtk.Widget.is_visible Gtk.Widget.signals.window_state_event

Thanks a lot for your work!

rtgiskard commented 2 years ago

find that with mprisv2 plugin, after close the window(it play background), the CPU usage drop down, which is well enough!