jake-phy / WindowIconList

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

Pin not working for some applications #30

Open rfrancisco opened 11 years ago

rfrancisco commented 11 years ago

I tried to pin NetBeans and MySql Workbench but they dont stay pinned.

TSDAdam commented 11 years ago

I have the same thing. I've installed Sublime Text 2, it has a menu entry and shows in the list of apps, but if i choose to pin it it doesn't stay pinned. It disappears as soon as the application closes.

jake-phy commented 11 years ago

Ok i"ll see what I can do I have been developing very slowly because of my job but work is slow right now

jake-phy commented 10 years ago

Can you add these programs to the menus favorites?

jake-phy commented 10 years ago

sublime text seems to be working for me can anyone confirm?

aikeru commented 9 years ago

Sublime Text 2 still doesn't seem to pin right now with the latest commit that I have.

jake-phy commented 9 years ago

Awesome I wasn't able to duplicate the issue. Does it through an error?

-----Original Message----- From: "aikeru" notifications@github.com Sent: ‎9/‎22/‎2014 12:40 PM To: "jake-phy/WindowIconList" WindowIconList@noreply.github.com Cc: "jake-phy" jake.phy@gmail.com Subject: Re: [WindowIconList] Pin not working for some applications (#30)

Sublime Text 2 still doesn't seem to pin right now with the latest commit that I have. — Reply to this email directly or view it on GitHub.=

aikeru commented 9 years ago

No but I think I see the problem. In applet.js _addFavorite is called. Cinnamon.AppSystem.get_default().lookup_app(appId) and Cinnamon.AppSystem.get_default().lookup_settings_app(appId) return null.

When these fail, _addFavorite returns early (if(!app) return false;).

aikeru commented 9 years ago

Ok found some additional info. I can find the app by appId if I loop through AppSystem.get_default().get_running(); and check running.get_id(); (ie: window:6 or window:47) I then realized that maybe this applet's favorite system is probably expecting an installed app, and sublime isn't in that collection of apps.

I tried this with a standalone Java .jar and get the same behavior.

I am very new to all of this but I think you may need to find a different way to pin these sort of applications.

Here's what some of my test code looked like:

        _addFavorite: function (appId, pos) {
            if (appId in this._favorites)
                return false;
            let appSystem = Cinnamon.AppSystem.get_default();
            let app = appSystem.lookup_app(appId);
            if (!app) app = appSystem.lookup_settings_app(appId);

            if (!app) {
                //Search for it
                let running = appSystem.get_running();
                   global.log('apps ' + running.length);
                for(var i = 0; i < running.length; i++) {
                    var runningId = running[i].get_id();
                    global.log('running ' + runningId);
                    if(appId === runningId) {
                        app = running[i];
                            global.log('found app!');
                        break;
                    }
                }

                if(!app) return false;
            }

            let ids = this._getIds();
            if (pos == -1)
                ids.push(appId);
            else
                ids.splice(pos, 0, appId);
            this._applet.settings.setValue("pinned-apps", ids);
            this._favorites[appId] = app;
            return true;
        },

I found these helpful too: https://github.com/linuxmint/Cinnamon/blob/master/src/cinnamon-app.c https://github.com/linuxmint/Cinnamon/blob/master/src/cinnamon-app-system.c

jake-phy commented 9 years ago

Looks good I will see about adding that.

aikeru commented 9 years ago

Please know that while my sample code finds the app it isn't a complete solution. I'm not sure what else is needed.

jake-phy commented 9 years ago

Right but it is a great start.

choikwa commented 9 years ago

Seeing this as well. Problem present pinning not system installed, but custom executables (ie. eclipse). Closing said execs unpins the icon.

choikwa commented 9 years ago

aikeru you are on the right track but if we can find location, it would be nice. From below https://github.com/linuxmint/Cinnamon/blob/master/src/cinnamon-app-system.c cinnamon_app_system_lookup_app_for_path() may be a solution.

choikwa commented 9 years ago

Wondering if we can get path from appId.. Is there doc on Cinnamon = imports.gi.Cinnamon?

choikwa commented 9 years ago

cinnamon_app_system_lookup_app_for_path (CinnamonAppSystem system, const char desktop_path) ... app = cinnamon_app_system_lookup_app (system, basename); if (!app) return NULL;

app_path = gmenu_tree_entry_get_desktop_file_path (cinnamon_app_get_tree_entry (app)); if (strcmp (desktop_path, app_path) != 0) return NULL; ...

It looks like aikeru's solution is the only(?) possible one as you need app to get desktop file path.

Edit: However, I still cannot get the favourite app to persist after I close it.

jake-phy commented 9 years ago

I'm going to have to completely rewrite this system, to allow for apps that are not installed. I want to get the appmenu stable and released so hopefully on the next release after the appmenu i'll implement this.

samogot commented 8 years ago

for fixing invalid grouping, you may do folowing steaps:

this helps if

for me, changes haven't applied even after reboot, but it have applied after unknown conditions in few hours