How to use mklauncher


"mklauncher"
is a command line tool, which allows you to create application launchers, with a single line. To create a launcher, you must open a terminal and start a session as administrator :

$ su

Documentation

To know all the available options run :

# mklauncher -help

Examples of use

Create launcher without custom image :

# mklauncher -n "Wine config" -e "winecfg"


Create launcher with standard image :

# mklauncher -n "Wine config" -e "winecfg" -i "mk-wine.png"


Create launcher with custom image :

# mklauncher -n "Wine config" -e "winecfg" -i "/opt/icons/wine.png"


Create launcher with executable in a non-standard location :

# mklauncher -n "Firefox web browser" -e "/opt/firefox/firefox" -i "/opt/icons/firefox.png"

Create launcher with executable in a non-standard location, for the current user only :

# mklauncher -u -n "Firefox web browser" -e "/opt/firefox/firefox" -i "/opt/icons/firefox.png"

Games

Launch an emulator through "wine" :

# mklauncher -n "Crude Buster" -e "wine MameUI32.exe roms/cbuster.zip" -i "/opt/icons/rb-Crudeb.png" -p "/opt/mame32" -cat "Game" -k "wine;mame;Game;"


Launch a "Linux" emulator :

# mklauncher -n "Circle of the moon" -e "mednafen 'Circle of The Moon.gba.zip'" -i "/opt/icons/circlemoon.png" -p "/opt/GameBoy" -cat "Game" -k "mednafen;GameBoy;Game;"

Java

Launch a "Java" application :

# mklauncher -n "JEditor" -e "java -jar JEditor.jar" -i "/opt/icons/JEditor.png" -p "/opt/JavaApps" -cat "Development" -k "Editor;Java;Development;"

Automatic launcher

Create a "Java" automatic launcher, see option "-mime" :

# mklauncher -n "Java launcher" -e "java -jar %f" -i "mk-java.png" -p "/opt/JavaApps" -cat "Development" -k "Java;Launcher;Development;" -mime "application/java-archive;application/x-java-archive"

Select an application "Java .jar", press "right click", and choose "Run with Java launcher". Automatic launchers for other file types can be created.

Folders

Open folder by means of "xdg-utils" package :

# mklauncher -n "Global launchers" -e "xdg-open '/usr/share/applications'" -i "mk-folder.png" -cat "System" -k "Global;Launcher;"

"xdg-open" Open a folder using the default file manager. This option requires that the "xdg-utils" package be installed.


Open folder directly :

# mklauncher -n "Global launchers" -e "nautilus /usr/share/applications" -i "mk-folder.png" -cat "System" -k "Global;Launcher;"

# mklauncher -n "Global launchers" -e "dolphin /usr/share/applications" -i "mk-folder.png" -cat "System" -k "Global;Launcher;"

# mklauncher -n "Global launchers" -e "thunar /usr/share/applications" -i "mk-folder.png" -cat "System" -k "Global;Launcher;"

Files

Open file by means of "xdg-utils" package :

# mklauncher -n "Debian GNU Linux" -e "xdg-open '/opt/books/Debian manual.pdf'" -i "mk-PDF.png" -cat "Education" -k "Linux;manual;"

"xdg-open" Open a file using the application appropriate for the file type. This option requires that the "xdg-utils" package be installed.


Open PDF file directly :

# mklauncher -n "Debian GNU Linux" -e "evince '/opt/books/Debian manual.pdf'" -i "mk-PDF.png" -cat "Education" -k "Linux;manual;"

# mklauncher -n "Debian GNU Linux" -e "atril '/opt/books/Debian manual.pdf'" -i "mk-PDF.png" -cat "Education" -k "Linux;manual;"


Create a simple symbolic link, on the desktop :

# mklauncher -link "/opt/books/Debian manual.pdf"

URL

Open website by means of "xdg-utils" package :

# mklauncher -n "GNU Linux OS" -e "xdg-open https://www.linux.org" -i "mk-internet.png" -cat "Network"


Using the option "-url" :

# mklauncher -n "GNU Linux OS" -url "https://www.linux.org" -i "mk-internet.png" -cat "Network"

Some desktops only allow launchers of websites created with the "-url" option in the Desktop folder.


Open web site directly :

# mklauncher -n "GNU Linux OS" -e "firefox https://www.linux.org" -i "mk-internet.png" -cat "Network"

Launch how root

Run by means of terminal :

# mklauncher -n "Gedit(root)" -e "su -c 'gedit'" -i "mk-text.png" -terminal -cat "Utility" -k "Gedit;root;"


Run by means of "gksu" :

# mklauncher -n "Gedit(root)" -e "gksu gedit" -i "mk-text.png" -cat "Utility" -k "Gedit;root;"

This option requires that the "gksu" package be installed.

Remove launcher

# mklauncher -r "Firefox web browser"


Remove launcher for current user only :

# mklauncher -u -r "Firefox web browser"


- NOTE -

The "-r" option can only erase launchers that were previously created with "mklauncher". To erase launchers that were not created with "mklauncher", it is necessary to write the real name of the file ".desktop". You can use the file manager to copy and paste the names of the ".desktop" files.

# mklauncher -r 'start_smb'


Remove launcher for current user only :

# mklauncher -u -r 'start_smb'


It is also possible to eliminate the launchers directly :

# rm '/usr/share/applications/start_smb.desktop'

# rm '/home/[Current user]/.local/share/applications/start_smb.desktop'

Fix desktop

If is not possible to detect the path of the desktop, use "-fix-desktop" to correct this problem. Example :

# mklauncher -fix-desktop "/home/[user]/darbastalis"

# mklauncher -fix-desktop "/home/[user]/Scriptorio"

# mklauncher -fix-desktop "/home/[user]/Namizje"

Icons

"mklauncher" includes the following standard icons, which can be used with the parameter "-i":

mk-app.png         mk-script.png             mk-wine.png       mk-java.png
mk-game.png       mk-link.png               mk-folder.png      mk-remote.png
mk-group.png       mk-file.png                mk-text.png         mk-image.png
mk-html.png          mk-audio.png           mk-video.png      mk-package.png
mk-photo.png        mk-media.png          mk-print.png        mk-optical.png
mk-pendrive.png   mk-server.png          mk-pc.png           mk-script2.png
mk-PDF.png          mk-game2.png         mk-game3.png    mk-game4.png
mk-python.png      mk-ruby.png             mk-php.png         mk-js.png
mk-graphics.png   mk-freepascal.png   mk-hint.png         mk-internet.png



How to create an ".png" icon

To create a custom icon, you must follow the following procedure :

1)Take a screenshot that contains the desired image.

2)Open the captured image with an image editor, for example "Gimp".

3)Copy an area of 256x256 px, and save how a new "Namefile.png" file.

4)Use the "iconrb" command to create a new file with rounded edges :

    $ iconrb "Namefile.png"
   
    rb-Namefile.png

5)Place this file in an accessible location, example :

    /opt/icons/rb-Namefile.png

6)Use the new PNG icon to create a launcher :

    # mklauncher -n "My app" -e "my_app" -i "/opt/icons/rb-Namefile.png"

Do you have questions?

You can ask any question about "mklauncher", simply you must open a new "Support Request Ticket".

<< Open a new Ticket >>