summaryrefslogtreecommitdiff
path: root/src/utils/mpris.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-16 16:35:37 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-16 16:35:37 +1100
commit02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38 (patch)
tree5e2a56becf6ba6961995e541ce9688224f704773 /src/utils/mpris.ts
parentpopupwindow: switch to class (diff)
downloadcaelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.tar.gz
caelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.tar.bz2
caelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.zip
refactor: move ts to src
Also move popupwindow to own file
Diffstat (limited to 'src/utils/mpris.ts')
-rw-r--r--src/utils/mpris.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/mpris.ts b/src/utils/mpris.ts
new file mode 100644
index 0000000..e0cc111
--- /dev/null
+++ b/src/utils/mpris.ts
@@ -0,0 +1,16 @@
+import { GLib } from "astal";
+import AstalMpris from "gi://AstalMpris";
+
+const hasPlasmaIntegration = GLib.find_program_in_path("plasma-browser-integration-host") !== null;
+
+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"));