GDesktopAppInfo Launched signal gives wrong PID
I am coming from gnome-shell#6708 (closed)
@skeller asked to make an issue here.
Affected version
- Zorin OS 16.2
- GNOME Shell 3.38.4
- XOrg
Bug summary
This is the same signal mentioned in gnome-shell#6705 (moved)
Please look at the following code.
const { Gio, GLib } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const connection = Gio.DBus.session;
var handlerId;
class Extension {
constructor() {
}
enable() {
handlerId = connection.signal_subscribe(null, "org.gtk.gio.DesktopAppInfo", "Launched", "/org/gtk/gio/DesktopAppInfo", null, 0, _parseSignal);
function _parseSignal(connection, sender, path, iface, signal, params) {
var apppid = params.get_child_value(2).get_int64();
log("params.get_child_value", apppid);
}
}
disable() {
connection.signal_unsubscribe(handlerId);
}
}
function init() {
log(`initializing ${Me.metadata.name}`);
return new Extension();
}
Here, the value of apppid
is wrong. I have cross checked it with xdotool. It also does not match with the meta_window.get_pid()
value (you can check it with https://github.com/blueray453/window-application-calls). Somehow, 2 is subtracted from the original pid.
Steps to reproduce
- Make an extension with the given code or just run
dbus-monitor --session
to checkorg.gtk.gio.DesktopAppInfo
interface value. Specially look forint64
which is supposed to be the pid. - Now cross check it with the pid via xdotool and/or https://github.com/blueray453/window-application-calls
- The pid given by
dbus-monitor --session
2 less than the original value. Something is probably subtracting 2 from the original value.
What happened
It gave wrong PID.
What did you expect to happen
I expect to get right PID.