From ac8f29c97f90546b1611f24889710e01fd756584 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval Date: Sat, 2 Mar 2024 14:21:40 +0100 Subject: [PATCH] mpris: Set app id as identity Flatpak automatically exposes org.mpris.MediaPlayer2.APP_ID as a owned dbus name. Fixes: https://github.com/vixalien/decibels/issues/65 --- build-aux/flatpak/com.vixalien.decibels.json | 3 +-- src/mpris.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build-aux/flatpak/com.vixalien.decibels.json b/build-aux/flatpak/com.vixalien.decibels.json index 16ff54a..4115cdb 100644 --- a/build-aux/flatpak/com.vixalien.decibels.json +++ b/build-aux/flatpak/com.vixalien.decibels.json @@ -22,8 +22,7 @@ "--socket=fallback-x11", "--socket=wayland", "--socket=pulseaudio", - "--env=GJS_DISABLE_JIT=1", - "--own-name=org.mpris.MediaPlayer2.Decibels" + "--env=GJS_DISABLE_JIT=1" ], "cleanup": [ "/include", diff --git a/src/mpris.ts b/src/mpris.ts index 4ce86ef..42c5e6b 100644 --- a/src/mpris.ts +++ b/src/mpris.ts @@ -238,7 +238,7 @@ export class MPRIS extends DBusInterface { private app = Gtk.Application.get_default()!; constructor(public stream: APMediaStream) { - super("org.mpris.MediaPlayer2.Decibels", "/org/mpris/MediaPlayer2"); + super(`org.mpris.MediaPlayer2.${pkg.name}`, "/org/mpris/MediaPlayer2"); this.stream.connect( "notify::title", @@ -487,7 +487,7 @@ export class MPRIS extends DBusInterface { CanSetFullscreen: GLib.Variant.new_boolean(false), CanRaise: GLib.Variant.new_boolean(true), HasTrackList: GLib.Variant.new_boolean(false), - Identity: GLib.Variant.new_string("Decibels"), + Identity: GLib.Variant.new_string(application_id), DesktopEntry: GLib.Variant.new_string(application_id), SupportedUriSchemes: GLib.Variant.new_strv([]), SupportedMimeTypes: GLib.Variant.new_strv([]),