User:Twt

From GnuCash
Revision as of 22:24, 5 February 2013 by Twt (talk | contribs) (How Do I Add GnuCash Shortcuts to Ubuntu's Unity Launcher?)
Jump to: navigation, search

on irc I'm usually TommyT


FAQ entry

How Do I Add GnuCash Shortcuts to Ubuntu's Unity Launcher?

Starting with Ubuntu 11.10, default Ubuntu installations include Unity, and its launcher, a row of icons for commonly-used applications. If you regularly open more than one set of GnuCash books you can add a useful right-click menu to the GnuCash icon on your 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. Then create a file ~/.local/share/applications/gnucash_with_shortcuts.desktop and paste into it the following

[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

About half way down (just below the Comment lines) where it says Exec= put the full path to the accounts file that you want opened if you just left click the launcher.

If you need to include a full path to run GnuCash on your system (such as if you compiled it yourself) then Exec= should start with /usr/bin/gnucash or /home/user/bin/gnucash or wherever you keep the compiled binary.

Where it says X-Ayatana-Desktop-Shortcuts= then put a list representing the projects (these names don't appear to the user). No spaces, items separated by semicolons. You can have as many entries here as you like. Then below this line create shortcut groups. For each shortcut group put the exact same name as in the Shortcuts list and for Name= put the menu text you want to appear when right clicking the launcher. In Exec= put the full path to the appropriate accounts file (preceded by the path to the GnuCash binary if needed).

Then when you are through editing, in the file manager right click the file and select Properties > Permissions and select Allow Executing file as Program.

Note that now if you want to edit this file again you will have to do it from a terminal using

 gedit ~/.local/share/applications/gnucash_with_shortcuts.desktop 

(You won't be able to edit this file using the file manager as Nautilus will insist on just running it.)

Double click the file in nautilus and it should open your default accounts file and the icon should appear in the launcher. Right click the icon and select Lock to Launcher. Now it should remain in the launcher when you close GnuCash and you should be able to right click the icon and see the additional menu links that you put in the file.

Sources

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

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