Difference between revisions of "Keyboard Shortcuts"

From GnuCash
Jump to: navigation, search
(Main Window: Update change-current-page to reflect Mac)
m (Accelerators: grammar and format fixes.)
 
(27 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Some keyboard shortcuts in GnuCash (also in German: [[De/Tastenkürzel]])
+
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.''
  
(''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 {{Mac}} 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 ===
 
=== Main Window ===
* To switch between multiple tabs in the main window, press Control+Alt+Page Up/Down (Control-Command-Page Up/Down on a Mac.) Note that the notebook has to have keyboard focus, and you might have to hit "Tab" once or twice to obtain that.
+
* To '''switch between multiple tabs''' in the main window, press
 +
*;{{Mac}}:<code>Control</code> - <code>Option</code> - <code>Page Up</code> or <code>Page Down</code>
 +
*;Others: <code>Control</code> + <code>Alt</code> + <code>Page Up</code> or <code>Page Down</code>
 +
: Note that the notebook has to have keyboard focus, and you might have to hit <code>Tab</code> once or twice to obtain that.
 +
* To '''expand a place holder account''' in the tree view of the main window account page, use <code>Tab</code> to select the place holder account, then press <code>Shift</code> + <code>right-arrow</code> (the arrow key on pc-keyboard), to collapse the tree view of any place holder account press <code>shift</code> + <code>left-arrow</code> (all sub levels; or <code>+</code> and <code>-</code> to expand or collapse just one level)
  
 
=== Register window ===
 
=== 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 Enter to record the calculated amount.
+
* 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 <code>+</code>, <code>-</code>, <code>*</code>, or <code>/</code>.  Type the second value and press <code>Tab</code> or <code>Enter</code> 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.
+
* '''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.)
+
* 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 <code>:</code> 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.
+
* 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.
+
* When entering dates, you can type <code>+</code> or <code>-</code> to '''increment or decrement the selected date'''. You can use <code>+</code> and <code>-</code> 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 '''raise the accounts menu''' in the transfer field of a register page, press the <code>Menu</code> key or the <code>Ctrl</code> + <code>Down</code> key combination.
 +
 
 +
* To '''jump to''' the blank transaction at '''the bottom''', <code>Shift</code> + <code>PgDn</code>.
  
 
=== Reconcile Window ===
 
=== 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.
+
* In the reconcile window, you can press the <code>spacebar</code> to mark transactions as reconciled. You can also press <code>Tab</code> and <code>Shift</code> + <code>Tab</code> to move between deposits and withdrawals. Multiple selection is enabled for the individual panes in the reconcile window.  <code>Ctrl</code> + <code>A</code> will select all entries in the current pane of the window. <code>Ctrl</code> + <code>Primary Mouse Click</code> is used to add transactions to the current selection. <code>Shift</code> + <code>Primary Mouse Click</code> will add all transactions between the transaction clicked and the previous current transaction to the current selection. <code>Shift</code> + <code>Up Arrow</code> and <code>Shift</code> + <code>Down Arrow</code> 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. <code>Ctrl</code> + <code>A</code> will select or deselect all entries in the current pane of the window. <code>Ctrl</code> + <code>Primary Mouse Click</code> is used to add or delete transactions to the current selection. <code>Shift</code> + <code>Primary Mouse Click</code> 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 <code>Secondary Mouse Click</code> 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 <tt>accelerator-map</tt> file in your GnuCash config directory. The location varies by your OS and GnuCash version, for example:
 +
 
 +
;Most Linux and BSD: <tt>~/.local/share/gnucash/accelerator-map</tt>
 +
;{{Mac}}: <tt>~/Library/Application Settings/Gnucash/accelerator-map</tt>
 +
;Windows: GnuCash 3 and later: <tt>C:\Users\USERNAME\AppData\Roaming\GnuCash\accelerator-map</tt>
 +
:GnuCash 2.x: <tt>C:\Users\USERNAME\.gnucash\accelerator-map</tt>
 +
 
 +
HAVE A CARE: some accelerator-map internal command names changed from V 4.9 to 5.1. If (some of) your accelerators fail rename the accelerator-map file (do NOT trash yet). GC will load a fresh default file on the next start. Copy the shortcuts from the old file to the corresponding actions in the new file.
 +
 
 +
;In the accelerator map:
 +
:Lines beginning with a semicolon <code>;</code> 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 [{{URL:wp}}Universally_unique_identifier globally unique identifier]s <ref>[{{BugURL}}/show_bug.cgi?id=798027 Bug 798027 - accelerator-map contains user-unfriendly hashs for <Actions>/MenuAdditions/]</ref>. 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:
 +
 
 +
<tt>
 +
(gtk_accel_path "<Actions>/GncPluginPageRegisterActions/SplitTransactionAction" "<Primary>m")
 +
</tt>
 +
 
 +
=== 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 {{Mac}} application bundle).
 +
To substitute new keybindings for the ''copy'', ''cut'', and ''paste'' actions, add something like this to .gtkrc-2.0:
 +
<Syntaxhighlight lang="C">
 +
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"
 +
</Syntaxhighlight>
 +
This will change the bindings from e.g. <code>control</code> + <code>c</code> to <code>alt</code> + <code>c</code>. Note that if one leaves out the <tt>unbind</tt> lines ''both'' shortcuts will work.
  
 +
=== Special Keys ===
 +
There are several special names for certain keys on the keyboard, such as <code><Primary></code> or <code><Shift></code>, or <code>Delete</code>, which are presumably defined somewhere in the GTK world.
  
= Footnotes =
+
=== References ===
# Does not work on Mac. See discussion page.
+
:[{{URL:GTK-docs}}gtk3/key-bindings.html Key Bindings - GTK+ 3 Reference Manual]
 +
:Full list of defined keys: [{{URL:Gnome-git}}gtk/-/blob/main/gdk/gdkkeysyms.h gdkkeysyms.h]
 +
----
 +
[[Category:GTK]] [[Category:Customization]]

Latest revision as of 20:31, 6 November 2023

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:

Most Linux and BSD
~/.local/share/gnucash/accelerator-map
macOS
~/Library/Application Settings/Gnucash/accelerator-map
Windows
GnuCash 3 and later: C:\Users\USERNAME\AppData\Roaming\GnuCash\accelerator-map
GnuCash 2.x: 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 rename the accelerator-map file (do NOT trash yet). GC will load a fresh default file on the next start. Copy the shortcuts from the old file to the corresponding actions in the new file.

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