Fixed the auto-hide functionality for the media bar module. (#588)

This commit is contained in:
Jas Singh
2024-12-21 21:12:12 -08:00
committed by GitHub
parent 440d7ae9db
commit 48faf52e59
9 changed files with 73 additions and 125 deletions

View File

@@ -14,15 +14,15 @@ import { activePlayer, mediaAlbum, mediaArtist, mediaTitle } from 'src/globals/m
const { truncation, truncation_size, show_label, show_active_only, rightClick, middleClick, format } =
options.bar.media;
const isVis = Variable(!show_active_only.get());
Variable.derive([bind(show_active_only), bind(mprisService, 'players')], (showActive, players) => {
isVis.set(!showActive || players?.length > 0);
});
const Media = (): BarBoxChild => {
activePlayer.set(mprisService.get_players()[0]);
const isVis = Variable(!show_active_only.get());
show_active_only.subscribe(() => {
isVis.set(!show_active_only.get() || mprisService.get_players().length > 0);
});
const songIcon = Variable('');
const mediaLabel = Variable.derive(
@@ -55,7 +55,6 @@ const Media = (): BarBoxChild => {
<box
className={componentClassName()}
onDestroy={() => {
isVis.drop();
songIcon.drop();
mediaLabel.drop();
componentClassName.drop();