When I started using Linux, I discovered GNUCash, which is close (close, but not identical) to QB. One of the ways it isn’t identical to QB is with the keypad enter key being able to act like the Tab key. So, naturally, I looked for a way to make it happen. And I did, as follows. Note: you can use this to reassign most any key on the keyboard to function as a different key; it is known as the “xmodmap” command.
I’ll use Linux Mint’s Cinnamon desktop environment as an example, but you can enter in these shortcuts according to the shortcut-keyboard’s entry process of your particular desktop environment. In Linux Mint, you’ll want to go to your menu → Preferences → Keyboard, then click on the shortcut tab. Once that is open, select “Custom Shortcuts” on the left panel, then click on the button at the bottom of that window where it says “Add custom shortcut.” That will bring up a window. In the first field, it wants the name this will go by. I’ve used the description of the shortcut’s purpose for that field. For instance, in this case, I’ve called this function: KP_Enter → Tab. In the next field goes the actual command. Enter:
xmodmap -e "keycode 104 = Tab"
A keycode is a number given to each key on one’s keyboard. Code 104 is the one listed for the Keypad’s Enter key by my keyboard. A keysym, on the other hand, is a name given to main keys used that are control and function keys. Common ones are Tab, Return, Control_L and Control_R, Alt_L and Alt_R. Note, these names are case sensitive. If you enter “return” or “RETURN,” it will not work, it must be “Return.”
To discover what the keycode and keysym of any key is, enter in a terminal window the following:
xev | grep keycode
Then press a key. It should show the line with the keycode, as well as the keysym name (last entry within the parenthesis) for your keyboard. When you’re done, click the X in the box with your mouse to return to the command line.
Now, you could use keysym alone to do this:
xmodmap -e “keysym KP_Enter = Tab”
Problem is, when you go back, you have to use the keycode 104 as any attempt to point to the Keysym Tab will point one to the wrong key to change. So, to change the key back to operating as an enter or a Return key (Use xev as above to know what the keysym for your main enter key is), you would enter the following:
xmodmap -e “keycode 104 = Return”
Once those two fields are filled in, click the “Add” button. Then you will want to double-click in the first unassigned keyboard binding for the new custom keyboard shortcut you just created, and press the key combinations you wish to assign to that function. For instance, in my example, I use Ctrl-Shift-{ to turn on the Tab functionality of the keypad’s enter key, and Ctrl-Shift-} to return it back to working as an enter key.
Now, it is important to know that this changes the key for all operations and programs. Not just GNUCash. That’s why you’ll want to have a key to change it back, if you tend to use it in some applications as an enter key. Like the calculator, for example. You may be used to hitting that key in doing 10-key entry, expecting it to perform as an enter key to get a total. Thus, the key to change it back on the fly. I, however, tend to leave it on the Tab functionality and use the main Enter key to add the total in calculator or other programs. It’s what you are used to.
Another tip, you can start any preferred changes by entering the appropriate command in your startup file (Menu → Preferences → Startup Applications).
That’s it. You can change most any key to do the job of a different key using the “xmodmap” command.
Happy Linuxing!
No comments:
Post a Comment