Cinnamon menu search ordering

Please post suggestions for improvement of Cinnamon here
https://github.com/linuxmint/Cinnamon

Cinnamon menu search ordering

Postby kparrish on Fri Jun 29, 2012 8:37 pm

Probably my favorite way of opening a program is simply pressing the super key, start typing the first few letters of the program, and pressing enter. However, I have found the ordering to be quite peculiar in cinnamon as it is not alphabetical. It would seem that it uses other cues to find relevant programs, but imo alphabetical ordering should take precedent to limit the amount of typing it takes to reach a specific program for execution.

For example, if I want to open 'System Settings' if I just type 'System' the actual item I am looking for is at the bottom of the list. Before it are five other programs, three of which don't even have 'System' in their name. Even if I type 'System S', 'System Monitor' still appears before 'System Settings'.

Another example is 'Update Manager' where I have to type start typing 'Update M' before 'Software Sources' gets out of the way.

This probably isn't the most pertinent thing but seems like a simple problem.
kparrish
Level 1
Level 1
 
Posts: 3
Joined: Thu Jun 28, 2012 11:56 pm

Linux Mint is funded by ads and donations.
 

Re: Cinnamon menu search ordering

Postby Garvan on Fri Jun 29, 2012 9:48 pm

It is searching the program names , descriptions and id (whatever the id is)

The code is here.
/usr/share/cinnamon/applets/menu@cinnamon.org

Look for this;
Code: Select all
if (app.get_name().toLowerCase().indexOf(pattern)!=-1 || (app.get_description() && app.get_description().toLowerCase().indexOf(pattern)!=-1) || (app.get_id() && app.get_id().slice(0, -8).toLowerCase().indexOf(pattern)!=-1)) res.push(app);


It is easy for a programmer to change so only the name is searched.

Garvan
Desktop: Dell, Intel Core 2 Duo E7500 @ 2.93Ghz, 2GiB RAM, Linux Mint 13 Maya.
Net-book: SAMSUNG N148-Plus, 2x Intel Atom CPU N450 @1.66Ghz, 1GB RAM, lubuntu 12.04.
User avatar
Garvan
Level 4
Level 4
 
Posts: 274
Joined: Sun May 29, 2011 3:26 am
Location: Cambodia

Re: Cinnamon menu search ordering

Postby bimsebasse on Fri Jun 29, 2012 11:01 pm

That's inherited from Gnome Shell, and Unity does the same - it means that search by keywords also work (e.g. type "torrent" to find "Transmission", type "web" to find browser etc.) and so the search box becomes more than a mere application name filter (type "n" and show nothing but application names beginning with the letter "n"). Sometimes if you're after a specific application the results list is a bit odd, but most of the time I think it works best this way.
Thank you for this thread. That’s all I can say. You most definitely have made this forum into something special. You clearly know what you are doing, you’ve covered so many bases. Thanks!
User avatar
bimsebasse
Level 7
Level 7
 
Posts: 1709
Joined: Fri Nov 11, 2011 10:21 am
Location: Scandinavia

Re: Cinnamon menu search ordering

Postby kparrish on Sat Jun 30, 2012 10:43 am

Well I rewrote it to search first by name-word, then name-fragments, then descriptions + id's. I think this works well since it puts priority on name but still does list apps related by secondary information. So it returns all of the same results as before but in a different order.

e.g.
Search: 'la'
Keyboard Layout %name-word
Language support %name-word
Calculator %name-fragment
Displays %name-fragment
...
APTon CD %description/id
...

This was my first time w/ js so might not be optimal but it works. The code is up on my github at kparrish if interested. I also pull requested it to the project.
https://github.com/linuxmint/Cinnamon/pull/848

Thanks for pointing me in the right direction Garvan.
kparrish
Level 1
Level 1
 
Posts: 3
Joined: Thu Jun 28, 2012 11:56 pm


Return to Cinnamon

Who is online

Users browsing this forum: frucade and 7 guests