Desktop Shortcuts

From GnuCash
Revision as of 12:39, 27 December 2021 by Fell (talk | contribs) (Try to modernize)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Desktop files can be used to start a specific version of a program like GnuCash with a specific data file. You can create as many separate desktop files as you need:

By Data files
my, spouse, charity…
By installed program versions
From Distribution, stable and nighly Flatpak

Create Customized Desktop Files

Make a desktop file, set permissions, and move to the correct location for your environment.

  1. Create a plain text file called gnucash-xyz.desktop containing the following:
    [Desktop Entry]
    Type=Application
    # append purpose:
    Name=GnuCash
    # adjust path, optionally add path to data file:
    Exec=/usr/bin/gnucash
    # Enable for debugging:
    Terminal=false
    Icon=/usr/share/pixmaps/gnucash-icon-256x256.png
    Encoding=UTF-8
    Categories=Office;Finance;
    Comment=Manage your finances, accounts, and investments
    
  2. Set the permissions and copy the file to a known place:
    chmod 644 gnucash-xyz.desktop
    sudo cp gnucash-xyz.desktop /usr/share/applications/
    
  3. Create a link from the executable file to the name used in the desktop file if you are using stable/testing multiple versions of GnuCash.

You can easily relink to a new version, and if something goes really bad, relink to the old version without downtime.

Also you might find different configurations install to different locations, so good to check this matches your system:
ln -s /usr/local/bin/gnucash /usr/bin/

Optionally Create Separate Icons

You might want separate icons for stable, distro, and latest. You can use an image editor like GIMP and create modified icons for each purpose.

You might copy the svg or png file for your icon:
cp /usr/local/share/gnucash/pixmaps/gnucash-icon-256x256.png /usr/share/pixmaps/

For more information on desktop shortcuts, see the official desktop entry specification.

[Thanks to Bob Brush on the GnuCash Users email list for the initial content of this page.]