Personal Application Launchers
Revision for “Personal Application Launchers” created on February 11, 2017 @ 04:06:56
Personal Application Launchers
<em>Application launchers</em> are central to the Moksha window management system. The control, among other things, which menu (if any) lists an application, and how that application is to be run. Application launchers are also called 'desktop configuration files', and they have the extension <em>.desktop</em>. You can see these files at <em>/usr/share/applications</em>. <em>Personal application launchers</em> are .desktop files that you create yourself. These are not stored in the above folder but in your Home directory at <em>.local/share/applications.</em> (Folders beginning with a '.' are hidden folders; to see them, open your file manager and press Ctrl+H.) <strong>Example 1: Disabling the touchpad at startup</strong> Suppose you normally use your laptop computer with a mouse, and you wish to disable the touchpad. One way is to create a personal application launcher which runs the TouchPadOff command, and then to add that launcher to your list of startup applications. Here are the steps in detail: 1. Open the Personal Application Launcher dialog box <em>(Main menu > Settings > Apps > Personal Application Launchers)</em>. 2. Click Add, and the Desktop Entry Editor opens. Make the entries shown in the screenshot below, i.e. enter a suitable name (e.g. <em>Touchpad Off</em>), and, in the Application field, the command which turns off the touchpad: <em>synclient TouchPadOff=1 </em>(Type in the command exactly as shown, or copy-and-paste it.) <p style="text-align: center"> <a href="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Desktop-Entry-Editor.jpg"><img class="alignnone size-full wp-image-1297" src="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Desktop-Entry-Editor.jpg" alt="Desktop Entry Editor" width="362" height="309" /></a></p> <p style="text-align: left">3. Click on the General tab and in the Categories field enter <em>Settings</em>. (This will add your launcher to <em>Applications > Preferences</em>.)</p> <p style="text-align: left">4. There is no need to change anything in the Options section (i.e. leave the first time items unticked but <em>Show in Menus</em> ticked).</p> <p style="text-align: left">5. Click Apply, and your personal application launcher will be saved in the .<em>local/share/applications</em> folder.</p> <p style="text-align: left">6. Now check that your application works: go to <em>Main menu > Applications > Preferences</em>, click on its entry, and try the touchpad.</p> <p style="text-align: left">7. If this test is successful, you can close the dialog box, otherwise correct your entries as necessary.</p> <p style="text-align: left">8. To add this applcation to your Startup Applications, go to <em>Main menu > Settings > All > Apps > Startup Applications</em>. At the Startup Applications dialog box, click on the Applications tab, scroll down the list applications and highlight yours, click Add, then click OK.</p> <p style="text-align: left">(To turn the touchpad on again, press Alt+Esc to Run Everything, and enter the command <em>synclient TouchPadOff=0</em>)</p> <p style="text-align: left"><strong>Example 2: Launching a command-line application</strong></p> <p style="text-align: left">Remastersys is a program which will backup your computer to an ISO file which you can then write as a live system to a USB stick or DVD. It does not appear in the menu system, so you have to run it from the command line. To add it to the menu:</p> <p style="text-align: left">1. Open the Personal Application Launcher dialog box, and make the entries shown below in the Basic section. Note that Remastersys must be run as Root, i.e. via eSudo.</p> <p style="text-align: center"><a href="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/remastersys.jpg"><img class="alignnone size-full wp-image-1310" src="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/remastersys.jpg" alt="remastersys" width="362" height="309" /></a></p> <p style="text-align: left">2. Go to the Icon section of the dialog box and enter <em>computer</em>. An icon magically appears; it is from your icon set (i.e. the set selected at the Application Theme Settings dialog box, Icon section). If you click in the icon box you will go to a folder with more icons from that set, where you can select a more suitable icon, or navigate to a different folder of icons. (Other magic words to try here include <em>image</em> and <em>clock,</em> which will take you to other folders of icons. All these folders are at <em>/usr/share/icons</em>.)</p> <p style="text-align: center"> <a href="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/HardinfoIcon.jpg"><img class="alignnone size-full wp-image-1309" src="http://www.bodhilinux.com/trial/wp-content/uploads/2015/02/HardinfoIcon.jpg" alt="HardinfoIcon" width="362" height="309" /></a></p> <p style="text-align: left">3. Go to the General section, where you should enter <em>System</em> in the Categories field. This adds your launcher to the System Tools section of the menus.</p> <p style="text-align: left">4. You can leave the Options section at the default settings (i.e. <em>Show in Menus</em> is ticked, other options unticked).</p> <p style="text-align: left">5. Click Apply, and your launcher will be added to the menus. Go to <em>Main menu > Applications > System Tools</em> to run it. If it launches OK, you can close the Desktop Entry Editor dialog box.</p> <p style="text-align: left">Note that you can return to this dialog box at any time if you wish to amend these entries. To do so, simply launch the application, then right-click on the title bar and from the context menu choose the top option (the application name) then <em>Edit Icon</em>.</p> <strong>Application launcher arguments</strong> If you examine the application launchers at <em>/usr/share/applications </em>(by opening them in a text editor such as ePad), you will see that many applications are launched with an argument, often %U or %f. These two arguments control the number of files that can be passed to the application - one, in the case of %f, multiple files in the case of %U. Thus if you examine the Desktop Entry Editor for Leafpad (if you have installed that program), you will see that it is launched with the %f argument, whereas ePad, which has tabs and can therefore handle multiple files, is launched with the command <em>epad %U. </em> For more information on these and other arguments see <a href="http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html">http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html</a>.