diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-12 18:00:54 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-12 18:00:54 +1100 |
| commit | b4aca729ddae0526b66822698db7066cb09e1682 (patch) | |
| tree | 2a406cca4cfc616dd22ce7c1be61cc20d5db85bc /utils/mpris.ts | |
| parent | Initial commit (diff) | |
| download | caelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.tar.gz caelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.tar.bz2 caelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.zip | |
bar
Diffstat (limited to 'utils/mpris.ts')
| -rw-r--r-- | utils/mpris.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/mpris.ts b/utils/mpris.ts new file mode 100644 index 0000000..8f6923a --- /dev/null +++ b/utils/mpris.ts @@ -0,0 +1,16 @@ +import AstalMpris from "gi://AstalMpris"; +import { inPath } from "./system"; + +const hasPlasmaIntegration = inPath("plasma-browser-integration-host"); + +export const isRealPlayer = (player?: AstalMpris.Player) => + player !== undefined && + // Player closed + player.identity !== null && + // Remove unecessary native buses from browsers if there's plasma integration + !(hasPlasmaIntegration && player.busName.startsWith("org.mpris.MediaPlayer2.firefox")) && + !(hasPlasmaIntegration && player.busName.startsWith("org.mpris.MediaPlayer2.chromium")) && + // playerctld just copies other buses and we don't need duplicates + !player.busName.startsWith("org.mpris.MediaPlayer2.playerctld") && + // Non-instance mpd bus + !(player.busName.endsWith(".mpd") && !player.busName.endsWith("MediaPlayer2.mpd")); |