Override the "unmanaged" signal, Javascript extension
In the code below I am actually able to log when the window is closed, but I cannot disable the default closing mechanism. Does anybody know how to do that?
const { gio, glib, meta, shell } = imports.gi;
const main = imports.ui.main;
function init() {
}
function enable() {
global.display.connect("window-created", (display, metawindow) => {
let app = metawindow.get_wm_class();
if (app == "spotify") {
let appid;
function onclose(){
// i need to disable the default closing behavior
// metawindow.disconnect(appid);
console.log("[minimize-spotify] spotify closed");
console.log("[minimize-spotify] " + metawindow);
console.log("[minimize-spotify] appid: " + appid);
return true;
}
appid = metawindow.connect("unmanaged", onclose.bind(this));
}
});
}
function disable() {
}