LinuxCommandLibrary

gendesk

Create desktop entry files

TLDR

Create a .desktop file named app

$ gendesk -n --name "[app]" --exec "[/path/to/app]" --icon "[/path/to/icon.png]" --comment "[This is application]"
copy

Create a .desktop file named app, do not display any output, and overwrite it if it exists
$ gendesk -q -f -n --name "[app]" --exec "[/path/to/app]" --icon "[/path/to/icon.png]" --comment "[This is application]"
copy

Display help
$ gendesk [[-h|--help]]
copy

SYNOPSIS

gendesk [options]

PARAMETERS

--name
    Set the application's name. This will override the application name from the script or program.

--icon
    Specify the application's icon. This can be a path to an icon file or an icon name from the system's icon theme.

--comment
    Provide a brief description or comment for the application.

--exec
    Specify the command to execute when the application is launched. Overrides any command found in the given script.

--type
    Set the type of desktop entry. Usually 'Application', but could be other types like 'Link'.

--categories
    Specify categories for the application, separated by semicolons. These categories help the desktop environment organize applications in menus.

--terminal
    Indicate that the application should be run in a terminal.

--startup-wm-class
    Set the startup WM class (useful for window matching).

--verbose
    Provide verbose output.

--version
    Show version information.

--help
    Show help message.

DESCRIPTION

The gendesk command creates .desktop files, which are used by desktop environments like GNOME, KDE, and XFCE to represent applications and their associated metadata. These files provide information such as the application's name, icon, command to execute, categories, and other properties. Essentially, gendesk streamlines the creation of desktop entry files from simpler input, often a shell script, making it easier to integrate command-line applications into a graphical desktop environment. gendesk simplifies the process of creating properly formatted .desktop files. It helps ensure consistent application integration across different desktop environments and can automate the generation of these files for packages during installation. Proper usage ensures your application appears correctly in menus, launchers, and other desktop utilities.

USAGE EXAMPLES

Example 1:
gendesk myapp.desktop /usr/bin/myapp
This will create a myapp.desktop file based on the /usr/bin/myapp script or executable. gendesk tries to extract the name, command to execute and if necessary sets it to run in terminal.

Example 2:
gendesk --name "My Application" --icon /path/to/icon.png --comment "A simple application" myapp.desktop /usr/bin/myapp
Creates a desktop file with a specific name, icon, and comment.

Example 3:
gendesk --categories "Utility;Development" myapp.desktop /usr/bin/myapp
Creates a desktop file that will be associated with the utility and development categories.

SEE ALSO

Copied to clipboard