When I was on 19.10 with GNOME 3.34 I could spawn command with GLib so many times without causing any lag to the GNOME shell or any app. But on 20.04 with GNOME 3.36.1 even a simple spawn command can create some lags for entire GNOME shell and even apps.
To show you how I do it, I've created this simple GNOME shell extension:
const Mainloop = imports.mainloop;
const GLib = imports.gi.GLib;
let timeout;
function init(){
}
function enable(){
timeout = Mainloop.timeout_add_seconds(1.0,() => {
var [ok, out, err, exit] = GLib.spawn_command_line_sync('pgrep Discord');
log('Discord is running');
return true;
});
}
function disable(){
Mainloop.source_remove(timeout);
}
Why is that lag happening? how can I fix the lag issue on this code?