Terminal focus

On Linux mint 22.3 the terminal does not get focus when opened via taskbar button due to an issue with underlying mutter.

Workaround as described here: https://github.com/linuxmint/cinnamon/issues/13382

settings → windows → behaviour → window focus mode = sloppy

sudo vi /usr/share/cinnamon/js/ui/windowAttentionHandler.js

Search for the initialization block. It looks like this:

Mainloop.timeout_add_seconds(4, () => {
    log("Enabling WindowAttentionHandler");
    global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
    global.display.connect('window-marked-urgent', Lang.bind(this, this._onWindowDemandsAttention));
 
    return GLib.SOURCE_REMOVE;
})

Add this line inside that block:

global.display.connect('window-created', Lang.bind(this, this._onWindowDemandsAttention));

The result should look like this:

Mainloop.timeout_add_seconds(4, () => {
    log("Enabling WindowAttentionHandler");
    global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
    global.display.connect('window-marked-urgent', Lang.bind(this, this._onWindowDemandsAttention));
    // START FIX
    global.display.connect('window-created', Lang.bind(this, this._onWindowDemandsAttention));
    // END FIX
 
    return GLib.SOURCE_REMOVE;
})

Save and Exit

Then add to whitelist:
Check settings:

settings get org.cinnamon demands-attention-passthru-wm-classes
['gnome-screenshot', 'lxterminal', 'xfce4-terminal', 'firefox', 'libreoffice', 'soffice']

Then add gnome terminal or other to the list. Check with xprop if unsure what the wm classes would be:

gsettings set org.cinnamon demands-attention-passthru-wm-classes "['gnome-screenshot', 'lxterminal', 'xfce4-terminal', 'firefox', 'libreoffice', 'soffice', 'gnome-terminal-server', 'Gnome-terminal']"

May need cinnamon restart.