12

Is there a way on LXDE toolbar to change what applications are on the quick launch part via the terminal so that it can be put in a batch file to change on multiple clients?

  • I can confirm Stranger's answer, with Jessie on Pi3, desktop files are inside /usr/share/raspi-ui-overrides/applications/ The moment I copied eclipse.desktop over from /usr/share/applications/ it's icon appeared in the Appliaction Launch Bar preferences, and I was able to add it to the Launch Bar. – István Arany Nov 10 '16 at 15:03
16

This can be done easily by creating a .desktop file for each application you would like to add to the menu. This is all explained clearly in the LXDE wiki for the main menu1.

*.desktop Locations

If you want the application to appear in menus for all users on a system, add the file to the directory /usr/share/applications/. For example, you may have /usr/share/applications/gimp.desktop for the gimp application. This is where packages normally create their .desktop files and is recommended.

If you want to add the application to a the menu of a specific user, create the file in the directory $HOME/.local/share/applications/.

*.desktop Settings

Read some of your existing .desktop files in /usr/share/applications/ to get an understanding of how they work. They are fairly straightforward, but the wiki provides a brief explanation of commonly used settings.

Here is a slightly modified explanation from the wiki for the warsow.desktop file. The actual settings are in bold font.

  • [Desktop Entry] - indicates that this file is a *.desktop file
  • Encoding=UTF-8 - UTF-8 encoding is used
  • Exec=warsow - path of a binary or script used to start the programm
  • Icon=/home/USER/my/icons/wsw-icon_80x80.png - path to the icon for the entry
  • Type=Application - desktop file is starting an application
  • Terminal=false - the program will not run in a terminal
  • Name=Warsow - displayed name in the menu
  • GenericName=warsow - description of the entry
  • StartupNotify=false - Startup notification is turned off
  • Categories=Game - specifies the categories in which the entry will be placed in the menu (several categories are specified with a semicolon between them, e.g. 'Game;Education')

Adding An Application to an Application Launch Bar

If you have created a .desktop file or one was created when the application is installed, you can add the application to a launch bar inside a lxpanel. The configurations for panels are located in the profile directory. For example, one of your panels may be at $HOME/.config/lxpanel/LXDE/panels/panel.

Editing the file with vim ~/.config/lxpanel/LXDE/panels/panel, I can see where the launchbar plugin and config is added. If the plugin is not already added to the panel, you will need to add this for each user. Notice that launchbar plugins will appear in the panel in the same order that they appear in this file.

Additionally, you will need to add the Button config with an id path to the .desktop file for each application that you wish to appear within the launchbar. Here is an example of what it looks like.

Plugin {
    type = launchbar
    Config {
        Button {
            id=pcmanfm.desktop
        }
        Button {
            id=/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Applications-Network-File-Transfer-transmission_bittorrent_client_(gtk).desktop
        }
        Button {
            id=/usr/share/applications/gimp.desktop
        }
        Button {
            id=/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Applications-Terminal-Emulators-gnome_terminal.desktop
        }
        Button {
            id=/usr/share/applications/gedit.desktop
        }
        Button {
            id=/usr/share/applications/gcalctool.desktop
        }
        Button {
            id=/usr/share/applications/keepassx.desktop
        }
    }
}

Refreshing the Panel

The wiki even provides a handy script to restart lxpanel to ensure that it will update your changes.

#!/bin/bash

# lxpanel processes must be killed before it can reload an lxpanel profile.
killall lxpanel
# Finds and deletes cached menu items to ensure updates will appear.
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
# Starts lxpanel with the `--profile` option and runs as a background process.
# In this example the profile is LXDE. Profiles are the directories located 
# in $HOME/.config/lxpanel/. In this case, $HOME/.config/lxpanel/LXDE.
lxpanel -p LXDE &

If you are running the lxpanel command in your terminal, I recommend using nohup so it won't kill the lxpanel process when the terminal is closed. nohup lxpanel -p LXDE &

  • 1
    The question was about how to add things the the application launcher via the terminal I already no how to add things to the start menu – Jhondoe Jan 7 '15 at 6:45
  • 1
    The answer has been edited. You will still need the .desktop files and don't forget to refresh the panel for the changes to appear. – iyrin Jan 7 '15 at 12:57
  • Please select this as the answer. – iyrin Mar 8 '15 at 23:02
  • 2
    With Jessie on a Pi 3, the .desktop files are found in /usr/share/applications/ and or /usr/share/raspi-ui-overrides/applications/ The Panel file needs to reflect the actual location. Either will work, but I suspect the latter is the new way of doing things. sudo mv of a copy of the .desktop file will get you a version in both locations. – Wayfaring Stranger Aug 30 '16 at 18:46
  • 1
    To restart the panel on Raspbian the command is lxpanel -p LXDE-pi &. – Frank Breitling Apr 2 '17 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.