jake-phy / WindowIconList

GNU General Public License v2.0
75 stars 26 forks source link

JavaEmbeddedFrame visible in window list #168

Open Fornax96 opened 7 years ago

Fornax96 commented 7 years ago

When a Java desktop application creates a system tray icon it also opens a window called JavaEmbeddedFrame, usually this window is hidden by default, but Window list with app grouping doesn't.

More details here: https://github.com/linuxmint/Cinnamon/issues/728 and here https://github.com/linuxmint/Cinnamon/issues/3476

rasmarc commented 7 years ago

The following code change works for me (i.e. it hides the "JavaEmbeddedFrame" button when using "tvbrowser"):

In /home/USERNAME/.local/share/cinnamon/applets/WindowListGroup@.../applet.js:

from line 392, change

    get_window_app: function (metaWindow) {
        let app = this.tracker.get_window_app(metaWindow);
        // If we found a valid app, we should add it to our hash,
        // otherwise, try to look it up in our hash
        if (app == null) {
            app = this.hash.get(metaWindow);
        } else {
            this.hash.set(metaWindow, app);
        }

        if (!app) throw {
            name: 'AppTrackerError',
            message: 'get_window_app returned null and there was no record of metaWindow in internal database'
        };

        return app;
    },

to

    get_window_app: function (metaWindow) {
        if (metaWindow.get_title() == "JavaEmbeddedFrame")
            return false;
        else {
            let app = this.tracker.get_window_app(metaWindow);
            // If we found a valid app, we should add it to our hash,
            // otherwise, try to look it up in our hash
            if (app == null) {
                app = this.hash.get(metaWindow);
            } else {
                this.hash.set(metaWindow, app);
            }

            if (!app) throw {
                name: 'AppTrackerError',
                message: 'get_window_app returned null and there was no record of metaWindow in internal database'
            };

            return app;
        }
    },

I used information from https://github.com/linuxmint/Cinnamon/commit/d001c1555062ab1e72ea49c6957929b8d5582826

When testing close your concerning software before restarting cinnamon because the system tray icon may not respond otherwise.

tkhyn commented 5 years ago

@rasmac thanks a lot, I just had the issue with windows-grouped-list. The workaround is quite similar:

in /usr/share/cinnamon/applets/grouped-windows-list@cinnamon.org/appList.js, replace:

    shouldWindowBeAdded(metaWindow) {
        return (this.state.settings.showAllWorkspaces
            || metaWindow.is_on_all_workspaces()
            || metaWindow.get_workspace() === this.metaWorkspace)
        && !metaWindow.is_skip_taskbar()
        && (!this.state.settings.listMonitorWindows
            || this.state.monitorWatchList.indexOf(metaWindow.get_monitor()) > -1);
    }

by

    shouldWindowBeAdded(metaWindow) {
        return (this.state.settings.showAllWorkspaces
            || metaWindow.is_on_all_workspaces()
            || metaWindow.get_workspace() === this.metaWorkspace)
        && !metaWindow.is_skip_taskbar()
        && metaWindow.get_title() !== "JavaEmbeddedFrame"
        && (!this.state.settings.listMonitorWindows
            || this.state.monitorWatchList.indexOf(metaWindow.get_monitor()) > -1);
    }