File: clapper_debian_single_instance_break_dbus_mpris.patch

package info (click to toggle)
clapper 0.5.2-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,568 kB
  • sloc: ansic: 10,713; javascript: 4,880; xml: 402; python: 14; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Author: Johannes Schauer Marin Rodrigues <josch@debian.org>
Description: add CLAPPER_DEBIAN_SINGLE_INSTANCE_BREAK_DBUS_MPRIS=1
 This forces each clapper invocation to run in its own instance.
 This will break D-Bus as well as MPRIS and is only a temporary hack until
 clapper supports multiple instances.
 https://github.com/Rafostar/clapper/issues/76

--- a/src/app.js
+++ b/src/app.js
@@ -1,11 +1,11 @@
-const { Gio, GObject, Gtk } = imports.gi;
+const { Gio, GObject, Gtk, GLib } = imports.gi;
 const { Widget } = imports.src.widget;
 const Debug = imports.src.debug;
 const FileOps = imports.src.fileOps;
 const Misc = imports.src.misc;
 const Actions = imports.src.actions;
 
-const { debug } = Debug;
+const { debug, warn } = Debug;
 const { settings } = Misc;
 
 var App = GObject.registerClass({
@@ -15,9 +15,18 @@ class ClapperApp extends Gtk.Application
 {
     _init()
     {
+        let flags = Gio.ApplicationFlags.HANDLES_OPEN;
+        const debian_single_instance = GLib.getenv('CLAPPER_DEBIAN_SINGLE_INSTANCE_BREAK_DBUS_MPRIS');
+        if(debian_single_instance == '1') {
+            warn("Setting CLAPPER_DEBIAN_SINGLE_INSTANCE_BREAK_DBUS_MPRIS=1 is a Debian-specific change.");
+            warn("D-Bus and MPRIS will not work correctly with this environment variable set.");
+            warn("Do NOT report bugs related to D-Bus and MPRIS to https://github.com/Rafostar/clapper with this variable set to '1'.");
+            warn("Do not rely on this variable being supported as it will get dropped once Clapper adds support for multiple instances.");
+            flags |= Gio.ApplicationFlags.NON_UNIQUE;
+        }
         super._init({
             application_id: Misc.appId,
-            flags: Gio.ApplicationFlags.HANDLES_OPEN,
+            flags: flags,
         });
 
         this.doneFirstActivate = false;