Keyboard Shortcuts

From GnuCash
Revision as of 16:10, 6 November 2023 by Hades (talk | contribs) (update the docs on keyboard shortcut mapping)
Jump to: navigation, search

Some keyboard shortcuts in GnuCash (also in German: De/Tastenkürzel).

Caution
Currently this page is still based on GTK2 while GnuCash 3.x uses GTK3.
Note
The initial text is just copied from the tip-of-the-day. Feel free to edit the list as you like.

Many of the common keyboard shortcuts and key mouse click commonly used in window and editing operations in MS WIndows, Linux and macOS will operate to perform their common functions where these are appropriate in GnuCash, particularly in dialog windows. These are often determined by the GTK library used to build the interfaces rather than within GnuCash itself.

Main Window

  • To switch between multiple tabs in the main window, press
    macOS
    Control - Option - Page Up or Page Down
    Others
    Control + Alt + Page Up or Page Down
Note that the notebook has to have keyboard focus, and you might have to hit Tab once or twice to obtain that.
  • To expand a place holder account in the tree view of the main window account page, use Tab to select the place holder account, then press Shift + right-arrow (the arrow key on pc-keyboard), to collapse the tree view of any place holder account press shift + left-arrow (all sub levels; or + and - to expand or collapse just one level)

Register window

  • As you enter amounts in the register, you can use the GnuCash calculator to add, subtract, multiply and divide . Simply type the first value, then select +, -, *, or /. Type the second value and press Tab or Enter to record the calculated amount.
  • Quick-fill makes it easy to enter common transactions. When you type the first letter(s) of a common transaction description, GnuCash will automatically complete the remainder of the transaction as it was last entered.
  • Type the first letter(s) or the plain account # of an existing account entry in the Transfer register column, and GnuCash will complete the entry from your list of accounts. For subaccounts, type the first letter(s) of the parent account, followed by : and the first letter(s) of the subaccount (e.g. A:C for Assets:Cash.)
  • Want to see all your subaccount transactions in one register? From the main menu, highlight the parent account and select Accounts -> Open Subaccounts from the menu.
  • When entering dates, you can type + or - to increment or decrement the selected date. You can use + and - to increment and decrement check numbers as well.
  • To raise the accounts menu in the transfer field of a register page, press the Menu key or the Ctrl + Down key combination.
  • To jump to the blank transaction at the bottom, Shift + PgDn.

Reconcile Window

  • In the reconcile window, you can press the spacebar to mark transactions as reconciled. You can also press Tab and Shift + Tab to move between deposits and withdrawals. Multiple selection is enabled for the individual panes in the reconcile window. Ctrl + A will select all entries in the current pane of the window. Ctrl + Primary Mouse Click is used to add transactions to the current selection. Shift + Primary Mouse Click will add all transactions between the transaction clicked and the previous current transaction to the current selection. Shift + Up Arrow and Shift + Down Arrow can be similarly used to add the transaction above and below the current transaction to the selection.

Import Matcher Window

Multiple selection of transactions for assignment of a single transfer account is enabled in the import matcher window. Ctrl + A will select or deselect all entries in the current pane of the window. Ctrl + Primary Mouse Click is used to add or delete transactions to the current selection. Shift + Primary Mouse Click will add or delete—if already in the selection—all transactions between the transaction clicked and the previous current transaction to the current selection. A Secondary Mouse Click will bring up a popup menu to allow a transfer account to be assigned to all transactions in the current selection.

Modifying Keyboard Shortcuts

First, it's important to understand that in Gtk there are two kinds of keyboard shortcuts, accelerators and bindings. The former operate on menu items; they're displayed to the right of the menu item when you use the mouse to view the menu, while the latter operate directly on widgets. The copy, cut, and paste actions will use both depending upon whether there's a menu that operates on the widget with focus.

Accelerators

To change the mappings, find the accelerator-map file in your GnuCash config directory. The location varies by your OS and GnuCash version, for example:

Ubuntu
~/.local/share/gnucash/accelerator-map
macOS
~/Library/Application Settings/Gnucash/accelerator-map
GnuCash 3.x on Windows 10
C:\Users\USERNAME\AppData\Roaming\GnuCash\accelerator-map
GnuCash 2.x on Vista
C:\Users\USERNAME\.gnucash\accelerator-map

HAVE A CARE: some accelerator-map internal command names changed from V 4.9 to 5.1. If (some of) your accelerators fail retire the accelerator-map file (do NOT trash yet). GC will load a fresh actual default file on the next start. Paste your old shortcuts to the new command names, THEN trash the old file. (This may apply to Lin*x and Wind*ws, too - not tested)

In the accelerator map
Lines beginning with a semicolon ; are commented out; the semicolon must be removed for your new shortcut to take effect.
Because the names of customized reports are not unique, they are represented by globally unique identifiers [1]. Use the table Report GUIDs to replace them.

For example, to bind the "Split Transaction" action to Ctrl-M, uncomment and edit the following line:

(gtk_accel_path "<Actions>/GncPluginPageRegisterActions/SplitTransactionAction" "<Primary>m")

Bindings

Customizing bindings is done by editing the file .gtkrc-2.0 in the user's Home directory (.gtkrc-2.0-gnucash if you're using the macOS application bundle). To substitute new keybindings for the copy, cut, and paste actions, add something like this to .gtkrc-2.0:

binding "gtk-alt-edit"
{
  bind "<alt>x" { "cut-clipboard" () }
  bind "<alt>c" { "copy-clipboard" () }
  bind "<alt>v" { "paste-clipboard" () }
  unbind "<ctrl>x"
  unbind "<ctrl>c"
  unbind "<ctrl>v"
}

 class "GtkWidget" binding "gtk-alt-edit"

This will change the bindings from e.g. control + c to alt + c. Note that if one leaves out the unbind lines both shortcuts will work.

Special Keys

There are several special names for certain keys on the keyboard, such as <Primary> or <Shift>, or Delete, which are presumably defined somewhere in the GTK world.

References

Key Bindings - GTK+ 3 Reference Manual
Full list of defined keys: gdkkeysyms.h