Archives For November 30, 1999

 

This simple tutorial shows how to edit .desktop files, the config files for your apps shown in start menu (app launcher), in Linux via single command.

In most Linux, the app icons (and their names) you see in dock & launcher are handled by .desktop files. If need, user can edit them by using either text editor or even third-party apps.

For software developing, scripting, or editing multiple .desktop files at the same time, there’s a command line tool that can help!

What you can do by editing .desktop file for your app:

The .desktop files are usually stored in following locations:

  • /usr/share/applications – for system wide.
  • $HOME/.local/share/applications – for current user only.
  • /var/lib/flatpak/exports/share/applications – for Flatpak apps (system wide).
  • $HOME/.local/share/flatpak/exports/share/applications – for Flatpak apps (current user).
  • /var/lib/snapd/desktop/applications/ – for Snap apps.

By editing a .desktop file that is associated with your app can do following things:

  • Change app icon
  • Change the app name in start menu.
  • Hide app
  • Group app icon in different categories.
  • Associate with different file types.
  • And more.

Find out the .desktop file for your app

If you don’t know where is the .desktop file, then try following steps to find it out.

First, open terminal (Ctrl+Alt+T) and run command to install plocate (or mlocate for old Ubuntu):

sudo apt install plocate

Then, update the database by running command:

sudo updatedb

Finally, try searching the desktop file for your apps (Firefox for example):

locate "*firefox*desktop"

In last command replace firefox with the keyword for yours (case sensitive). And, copy the path-to-file for the one in the location mentioned above.

Single command to edit the .desktop file

As far as I know, Debian, Ubuntu, Fedora, Manjaro, and their based systems have desktop-file-edit tool out-of-the-box for edit .desktop entries.

Option 1: To change app name, use command:

desktop-file-edit --set-name=NEW_NAME /path/to/file.desktop

In command, sudo is required for .desktop file in system directories.

For example, change the pre-installed Firefox (Snap version) in Ubuntu to “My Web Browser”:

sudo desktop-file-edit --set-name="My Web Browser" /var/lib/snapd/desktop/applications/firefox_firefox.desktop

Option 2: To change app icon, use command:

desktop-file-edit --set-icon=/path/to/icon /path/to/file.desktop

For icon file under /usr/share/icons, or .local/share/icons, just replace /path/to/icon-file with file-name without extension (e.g., .png, .svg).

For example, change the icon for my Firefox browser:

sudo desktop-file-edit --set-icon='/home/ji/Pictures/icons/myfirefoxicon.png' /var/lib/snapd/desktop/applications/firefox_firefox.desktop

Option 3: To add/remove category or mime type, use command:

desktop-file-edit --add-category=VALUE_HERE /path/to/file.desktop

Replace --add-category with one of the options below depends on which action you want to do:

  • --remove-category
  • --add-mime-type
  • --remove-mime-type

See list of well known categories.. And, right-click on a file and go to its ‘Properties’ to check “Type”.

Option 4: To add/edit other keys.

Use “–set-key=KEY_NAME –set-value=KEY_VALUE” option. You can add more than one pair of the options in single command.

For example, hide Firefox from app launcher by setting “NoDisplay=true“. It will add the key ‘NoDisplay’, if not exist.

sudo desktop-file-edit --set-key=NoDisplay --set-value=true /var/lib/snapd/desktop/applications/firefox_firefox.desktop

Option 5: To remove a key, use “–remove-key=KEY_NAME” option.

For example, un-hide Firefox by deleting “NoDisplay=true” from the .desktop file:

sudo desktop-file-edit --remove-key=NoDisplay /var/lib/snapd/desktop/applications/firefox_firefox.desktop

Option 6: Edit multiple desktop files

You can edit more than one files using for loop.

For example, hide all the Waydroid Android app icons associated with the .desktop files under .local/share/applications directory.

for file in $Home/.local/share/applications/waydroid.*.desktop; do desktop-file-edit --set-key=NoDisplay --set-value=true $file; done

In addition, the desktop-file-edit command will automatically validate the .desktop file after done editing it. It will output errors if validation not passed. For more, see its man page.

Prefer macOS spotlight or Alfred style search system? You can now get similar feature in Ubuntu via an extension.

It’s ‘Search Light‘, an extension so far supports for Gnome 42 ~ 46, meaning for Ubuntu 22.04, Ubuntu 24.04, Fedora 38~40, Debian 12, Arch and Manjaro Linux.

With it, you may press a custom shortcut key on keyboard to open the search box. Then, type to search and launch applications, settings, and/or app content.

It uses system’s built in search function, with settings to show search box in preferred monitor, change background, opacity, and search window size.

Search Light with custom background color & opacity

How to Install ‘Search Light’ extension:

For Ubuntu 22.04+ and Arch Linux, first search for and install ‘Extension Manager‘ from Ubuntu Software (App Center) or system software app.

Install Extension Manager in Ubuntu Software/App Center

Then, search for and launch the tool from ‘Activities’ overview screen.

You can finally go to ‘Browse’ tab in Extension Manager to search & install the extension.

And, go back to ‘Installed’ tab in Extension Manager to open the configuration dialog. Finally, set your favorite shortcut key, choose monitor (if more than one available), and change the layout appearance.

Fedora user can simply go to extension web-page, and install it by using the ON/OFF switch. And, install ‘Gnome Extensions’ app from Gnome Software for configuring the extension.

Looking for an alternative app launching tool for your Linux? Findex is one with highly customizable interface and fast performance.

The app runs silently in the background. Once you hit the shortcut key, a search box pop-up in screen center allows to quickly search and open desired applications.

Findex search apps

The tool is super fast as it focuses on performance. It supports fuzzy searching and allows to configure the following things:

  • Search window width.
  • Minimize and maximize window height.
  • Highlight color for match content.
  • Icon size, result size, and shortcut key

How to Get Findex:

The current 0.6.0 release does not work on Wayland session, though it’s said to bring it back in later version. Which means so far, Ubuntu and Fedora need to switch to ‘Ubuntu on Xorg‘ or ‘Gnome on Xorg‘ from the login screen to be able to use the tool.

1. Firstly, download the tarball from the github release page:

2. Then extract it in file manager. Right-click on generated folder and select ‘Open in Terminal’ to open that folder as working directory in terminal.

3. Finally, run command in terminal to start it:

./findex

Run it first time to verify if it works!

To verify if it works, just press Shift + Space on keyboard. The search box should prompt up allows to type searching your applications.

4. To make Findex runs automatically at startup, run the commands below one by one in the same terminal window:

  • Move the executable file to system path via command:
    sudo mv findex /usr/bin
  • Move the services file into systemd folder:
    sudo mv findex*.path findex*.service /etc/systemd/user/
  • Finally, enable the services:
    systemctl --user enable findex.service
    systemctl --user enable findex-restarter.path

Copy to PATH, and make it auto-start

5. To configure the keyboard shortcut and search appearance, open terminal and run command:

gedit ~/.config/findex/settings.toml

Replace gedit with your system text editor. After saving changes, you need to restart the service by running command: systemctl --user restart findex.service.

Uninstall:

To disable the service, use command:

systemctl --user disable findex.service
systemctl --user disable findex-restarter.path

Then remove the executable file as well as service files:

sudo rm /usr/bin/findex /etc/systemd/user/findex*

Paper GTK3 and Icon themes

This is a beginner’s guide shows how to remove the ‘Show Applications’ app menu icon from the dock in Ubuntu 20.04, Ubuntu 22.04

Why to remove the icon:

The default ‘Show Applications’ app launcher is always a bit slow when I clicking on the 9 dots icon on left dock to show the app menu, even after disabled animation and changed privacy settings.

And I only use it to search for and open applications, which can be done alternatively via the top-left Activities button.

In brief, it’s slow and I use Activities button to search for and open applications.

How to Remove it:

If you’re familiar with Linux command, press Ctrl+Alt+T on keyboard to open terminal and run command:

gsettings set org.gnome.shell.extensions.dash-to-dock show-show-apps-button false

That’s it.

You can alternatively open Dconf Editor (install via Ubuntu Software if you don’t have it) and navigate to “org/gnome/shell/extensions/dash-to-dock”.

Then turn off the toggle for the key ‘show-show-apps-button’.

(Optional) To restore the change, either use Dconf Editor or run command:

gsettings reset org.gnome.shell.extensions.dash-to-dock show-show-apps-button

Gnome Pie app launcher

This tutorial shows how to install the latest Gnome-Pie, a circular application launcher for Ubuntu 14.04, Ubuntu 13.10 via PPA repository.

With Gnome-Pie you can quickly access your favorite apps, bookmarks, main menu, window controls via shortcut keys:

Gnome-Pie Favorite apps

 

Gnome-Pie Main Menu

Gnome-Pie is available in Ubuntu Software Center, but the default version is a little old. To install the latest, press Ctrl+Alt+T on keyboard to open terminal. When it opens:

1. Copy and paste command below and run to add the PPA. Enter user password when prompt:

sudo add-apt-repository ppa:simonschneegans/testing

2. Update package lists:

sudo apt-get update

3. Finally install Gnome-Pie from Ubuntu Software Center or via the command:

sudo apt-get install gnome-pie

Once installed, open it from Unity Dash or Menu. You’ll see the indicator applet on panel, click and go to the Preferences window for editing shortcuts and menu items.