Skip to content

Generate Linux .desktop shortcut files from the command line.

License

Notifications You must be signed in to change notification settings

Lateralus138/desktopgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DesktopGen

Generate Linux .desktop shortcut files from the command line.


Description

This is a tool written in C++ that helps me quickly create Linux .desktop shortcut files from the command line.

If you are not familiar with these files they are Linux application/command line shortcut files just like you find in Windows or many other operating systems.

This generates a basic template with a few defaults and parameter/arguments for the most common Entries that many find in a .desktop file and is not meant to have an extensive list of paramters for every Entry under the sun. Having said that you can circumvent this and add any additional Entries you want by simply appending some formatted text of the Entries you want with one of the pre-existing parameters. For example:

 $ desktopgen --file fakeshortcut --icon "$(echo -e \\nFakeKey=FakeValue)"
 $ cat fakeshortcut.desktop
[Desktop Entry]
Name=
GenericName=
Comment=
Exec=
Terminal=false
Type=Application
Icon=
FakeKey=FakeValue
Categories=GNOME;GTK;Utility;

will add the new Key/Value pair in after the Icon Entry with the \\n new line. You can still set the Icon (or whatever parameter) by adding the text before the new line. In this way you preformat your added values in a variable/array and append anything you want. You can override any default by it's corresponding parameter.

More information about .desktop files and Entries,Categories etc... can be found here: [FreeDesktop Specifications]

I do most things from the command line if possible, but I'm working on a little YAD/Zenity UI, but I might make a GTK gui for it in the near future. I have lots of other projects and to work on, but this project was spawned from inspiration and necessity and so other things had to wait while I wrote this first, but I'm not sure when I'll get around to a real UI. There are other methods to create shortcuts, but this is my method.


Installation

This is a single binary executable built on and for 64 bit Linux machines and here I have provided several methods of use and installation. All files are found in the Releases section.

Portable

A single compiled binary executable is provided unless you want to download the source and build it yourself. This file's name is desktopgen.

Debian Package Installer

I have provided a .deb package installer that contains teh program, bash completion, and icons that will be removed upon un-installing. Sorry, I do not have a PPA yet, though I have started the process. This file's name is desktopgen.deb.


Usage

As stated above this is a command line utility for Linux shells/terminals/consoles/whatever/etc... And also, as stated above, this could work well with a YAD/Zenity GUI.

Examples

Create program shortcut

 $ desktopgen \
 > --path ~/.local/share/applications \
 > --file ProgramName \
 > --name "Program Name" \
 > --generic "ProgramName" \
 > --comment "Program Name does something" \
 > --exec "/path/to/programname" \
 > --icon "/path/or/name/of/icon"
 $ cat ~/.local/share/applications/Programname.desktop
[Desktop Entry]
Name=Program Name
GenericName=ProgramName
Comment=Program Name does something
Exec=/path/to/programname
Terminal=false
Type=Application
Icon=/path/or/name/of/icon
Categories=GNOME;GTK;Utility;

Help Screen

 $ desktopgen --help

  'desktopgen' - Generate .desktop shortcut files  
  from the command line.                          

  USAGE: desktopgen [OPTIONS]...                  

  OPTIONS:                                        
    -h,--help       This help screen.             
    -p,--path       Directory of the new file.    
    -f,--file       The name of the file without  
                    the .desktop extension. This  
                    parameter has to be provided. 
    -m,--monochrome Remove color from all output. 
    -q,--quiet      All errors are non-verbose.   
    -n,--name       [Name] string entry.          
    -g,--generic    [GenericName] string entry.   
    -c,--comment    [Comment] string entry.       
    -e,--exec       [Exec] string entry.          
    -T,--terminal   [Terminal] string entry.      
    -t,--type       [Type] string entry.          
    -i,--icon       [Icon] string entry.          
    -C,--categories [Categories] string entry.    

Bash Completion

Bash completion can be provided either by installing with the .deb installer or found here.


Project Information

This project is written in C++.

C++

Readme Card

Description Status
Build Status Build Status
CodeFactor Grade CodeFactor Grade
Project Release Date GitHub Release Date
Total downloads for this project GitHub all releases
Complete repository size This Repo Size
Commits in last month GitHub commit activity
Commits in last year GitHub commit activity

Latest Version Status

Description Status Number of Downloads
Latest Release version Release Version GitHub release (latest by date)
Latest Tag version, possible Pre-Release's Tag Version GitHub release (latest by date)

File Information

All current compiled files and the source of this project can be found at this repository in the Releases section under Stable Release.

This is the recommended method of download.

CR

You can, of course, build, fork, and/or download the source of this project as per the LICENSE of this project. If you want me to create a build for a different architecture and don't want to do it yourself then just let me know what you need and I'll look into it.

MD5

These MD5 values are evaluated immediately after the build.

Linux MD5

Linux MD5

Debian MD5

Debian MD5


Media

Social

https://twitter.com/intent/user?screen_name=thefluxapex

Images

Logo

Logo

Help Screen

Help Screen