When Windows 8 came out years back and was panned by critics for taking away the start menu and thus making it too hard to launch apps, all I could think was “there are power users out there not using a keyboard based app launcher?”
For years, I'd been using Launchy, a cross-platform app launcher that lets me open up apps by hitting “Alt+Space” and typing the name of the app you want to open. It's very similar to OSX's SpotLight feature. This is far more efficient than searching the labyrinth that is the start menu or any other GUI based catalog (especially on Windows XP).
It seems in recent years my friend Launchy has lost a step. On Windows I often have better luck finding apps using Microsoft's built in keystroke launcher (which is similar to Launchy but takes longer to appear and vanish).
In Lubuntu the situation was worse. The built-in calculator stopped working a long time ago, but more importantly the majority of my installed apps simply didn't appear in Launchy.
I'm ashamed to admit that for a few years now I've simply dealt with this subpar experience by using a mouse and clicking through the various menus to find stuff (don't judge me. I already hate myself for it!).
It hit me recently that this had become a big problem and was probably altering my behavior by making me avoid opening apps I was less familiar with, so I spent some time today figuring out a fix. To my surprise Googling was almost useless; not many people seem to talk about Launchy much anymore, let alone the intersection of its issues and Lubuntu. Anyway I've written my fix below in hopes it will help some future googler.
Fixing Launchy
Launchy keeps a catalog of apps, which it creates by searching well known directories for .desktop files. These simple text files are what Lubuntu uses to display shortcuts in various places.
Turns out Launchy will silently ignores many of these files if they get too complicated.
Thankfully it's easy to create simplified .desktop files Launchy can deal with.
Create a dedicated directory for Launchy
First, create a dedicated directory for all of the Launchy desktop files you're about to create. For example, I have a simple directory for all the scripts I use from my terminal which I back up to source control. In that directory, I've create a new directory named after each machine which is dedicated to Launchy. This allows me to view all the apps I think I should be able to open with Launchy at a glance.
Open up Launchy, and click on the gear icon to bring up the settings window.
Next, click on the tab labeled “Catalog”.
Here you'll see a long list of directories. Take note of these.
Now click the minus sign to delete all of them. Then click the plus sign to add the one directory you've created just for Launchy.
Next, under “File Types”, make sure “desktop” Add *.desktop to the “File Types” list if it isn't there already by using the plus and minus buttons.
Copy in any .desktop files you may need
Next, you'll want to copy (not symlink) any .desktop files you'd like Launchy to use into the empty directory you created above. It may have already worked with a few of these in the past, while others will need to be modified.
You can figure out where these desktop files live by right clicking their icons in the Lubuntu start menu thing, then clicking “Properties”. This will bring up a window titled “File Properties” which will show the location of the desktop file in “Target file”. These will live in places like /usr/share/applications, /var/lib/snapd/desktop/applications, etc.
Modify the .desktop files to be as simple as possible
Now that you have a directory full of .desktop files you can start testing Launchy to see which ones already work.
For each desktop file, open Launchy, right click on it and select “Rebuild catalog”. Then type the name of the app and see if it starts up.
If it does, great.
If not, edit the file to be simpler.
For an example of what a “simple” desktop file looks like, here is what my desktop entry for Sublime Text looked like originally when it didn't work:
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;
I had to remove the sections entitled “Desktop Action Window” and “Desktop Action Document”. That left me with:
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
which Launchy detected easily.
As another example, Chrome's .desktop file lived in /var/lib/snapd/desktop/applications/chromium_chromium.desktop and was 293 lines long. Many of these lines where text entries defining strings in alternate languages, such as:
Name=Chromium Web Browser
Name[ast]=Restolador web Chromium
Name[bg]=Уеб четец Chromium
Name[bn]=ক্রোমিয়াম ওয়েব ব্
... etc ...
I deleted all of those alternate strings as well as the extra sections that defined other desktop actions.
That made Launchy actually show “Chromium Web Browser” as an option when I typed it in, but it wouldn't start the app (again, a silent failure).
It turned out the culprit was a complicated Exec entry that looked like this:
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/chromium_chromium.desktop /snap/bin/chromium %U
I simplified this to Exec=/snap/bin/chromium %U and it worked.
The final result was this:
[Desktop Entry]
Version=1.0
Name=Chromium Web Browser
GenericName=Web Browser
Comment=Access the Internet
Exec=/snap/bin/chromium %U
Terminal=false
Type=Application
Icon=/snap/chromium/562/chromium.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
Now I can pretty much avoid using any of Lubuntu's awful, Windows 98 era menus and just focus on the shortcuts to apps I care about, which I can also manage in a simplified form in the same local git repo I use for everything else. This frees me up to enjoy the unrivaled performance and lack of nonsense (no animation when switching workspaces!) that has made Lubuntu my daily driver over the past two years.