Unity Shortcuts

From GnuCash
(Redirected from UbuntuShortcuts)
Jump to: navigation, search

Starting with Ubuntu 11.10, default Ubuntu installations include Unity, and its Launcher, which contains a set of icons for commonly-used applications. For detailed information about creating and editing Launcher icons and menus, see the [Ubuntu Help page] on the topic.

If you regularly open more than one set of GnuCash books you can add a useful right-click menu to the GnuCash icon in the Launcher to open each of your sets of books independently. (Using this method you can have multiple sets of GnuCash books open simultaneously, which you cannot do using the menu within GnuCash.)

You will need to know the path to each of your GnuCash data files. If you compiled GnuCash yourself or installed it in a non-standard location you will also need to know the path to the GnuCash application.

  • First remove GnuCash from the Launcher if it is there already by right-clicking the icon and choosing "Unlock from Launcher."
  • Create a file ~/.local/share/applications/gnucash_with_shortcuts.desktop

and paste the following text into the file:

[Desktop Entry]
Type=Application
MimeType=application/x-gnucash;
Version=0.9.4
Name=Gnucash with shortcuts
GenericName=Finance Management
GenericName[de]=Finanzmanagement
Comment=Manage your finances, accounts, and investments
Comment[bg]=Управлявайте финанси, сметки и инвестиции
Comment[ca]=Gestioneu les vostres finances, comptes i inversions
Comment[cs]=Spravovat vaše finance, účty a investice
Comment[de]=Verwaltung der Finanzen von Privatanwendern und Kleinbetrieben.
Comment[en_GB]=Manage your finances, accounts, and investments
Comment[es]=Gestione sus finanzas, cuentas e inversiones
Comment[eu]=Kudeatu zure finantzak, kontuak eta inbertsioak
Comment[fr]=Gérez vos finances, vos comptes et vos investissements
Comment[hu]=Igazgassa pénzügyeit, számláit és befektetéseit
Comment[it]=Gestisce le proprie finanze, i conti e gli investimenti
Comment[ja]=財務、口座および投資を管理します
Comment[ko]=재정, 계정 및 투자 관리
Comment[lv]=Pārvaldiet savas finanses, kontus un investīcijas
Comment[nb]=Forvalt dine finanser, kontoer og investeringer
Comment[ne]=तपाईँको वित्तहरू, खाताहरू, र लगानीहरू प्रबन्ध गर्नुहोस्
Comment[nl]=Om uw financiën, rekeningen en investeringen te beheren
Comment[pl]=Zarządzaj swoimi finansami, kontami i inwestycjami
Comment[pt_BR]=Gerencie suas finanças, contas e investimentos
Comment[ro]=Administrează-ţi finanţele, conturile şi investiţiile
Comment[ru]=Управляйте своими финансами, счетами и инвестициями
Comment[ta]=உங்க‌ளுடைய‌ நிதிக‌ள், க‌ண‌க்குக‌ள் ம‌ற்றும் முத‌லீடுக‌ளை நிர்வ‌கிக்க‌வும்
Comment[uk]=Керування вашими фінансами, рахунками та інвестиціями
Comment[vi]=Quản lý tài chính, các tài khoản và vốn cố định
Comment[zh_CN]=管理你的财务、账户和投资
Exec=gnucash /full/path/to/default/accounts.gnucash
Icon=gnucash-icon
StartupNotify=true
Terminal=false
Categories=Office;Finance;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=GnuCash
X-GNOME-Bugzilla-Component=General
X-GNOME-Bugzilla-Version=2.4.10
X-GNOME-DocPath=gnucash/gnucash.xml
X-GNOME-FullName=GnuCash Finance Management

X-Ayatana-Desktop-Shortcuts=File_One;File_II;File_3

[File_One Shortcut Group]
Name=This Is The Text of the FIRST Menu
Exec=gnucash /full/path/to/project1/accounts.gnucash
TargetEnvironment=Unity

[File_II Shortcut Group]
Name=This Is the Text of Menu Two
Exec=gnucash /full/path/to/project2/accounts.gnucash
TargetEnvironment=Unity

[File_3 Shortcut Group]
Name=And This is the Text Yet Another Menu I Call Number Three
Exec=gnucash /full/path/to/project3/accounts.gnucash
TargetEnvironment=Unity

  • Just below the Comment lines, on the line that says Exec= put the full path to the accounts file that you want opened by default when you left click the launcher. If GnuCash is not in a standard location on your system (such as if you compiled it yourself) then Exec= should start with a full path such as /usr/bin/gnucash or /home/user/bin/gnucash or wherever you put the compiled GnuCash binary.
  • Edit the line that says X-Ayatana-Desktop-Shortcuts= to include an entry for each of your sets of GnuCash books. (These names will NOT appear to the user.) The list must contain no spaces, and its items separated by semicolons. You can have as many entries here as you like.
  • Below the X-Ayatana-Desktop-Shortcuts= line, edit the shortcut groups. Each shortcut group should have the same name as its item in the Shortcuts list. The Name= line contains the menu text you want to see when right clicking the launcher. In Exec= put the full path to the appropriate accounts file. (Just as in the first Exec= line, the gnucash command can include the path to the GnuCash binary if necessary.)
  • When you are finished editing, save the file, and in the file manager right click the file and select Properties --> Permissions and choose "Allow executing file as program."

[Note that now if you want to edit this file again, you won't be able to edit it using the file manager -- Nautilus will give you no option other than just running it. You will have to edit it using a terminal or command prompt:

gedit ~/.local/share/applications/gnucash_with_shortcuts.desktop 
  • Double click the file in nautilus and if there are no typing errors, the file should take on the GnuCash icon. Clicking it should cause the GnuCash icon to appear in the launcher and the application will open your default accounts file.
  • Right click the icon in the Launcher and select the option "Lock to Launcher" (below your new menu items). The locked icon will remain in the launcher when you close GnuCash. You can right click and choose the new menu links that you added and open multiple GnuCash data files.

Sources

https://lists.gnucash.org/pipermail/gnucash-user/2013-February/047607.html

https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles