11

As a programmer I find myself typing symbols a lot more often than I do numbers. So it would be nice if the numbers row on the keyboard produced symbols by default.

The end results should be: 6 would produce ^ and Shift+6 would give 6.

I tried switching to Dvorak for a while but the combination of a steep learning curve and a looming deadline don't make that an attractive solution.

Ideally I'd like to this on Windows as well but let's focus on Debian as it's my main dev machine.

From what I find on the web the "shift lock" feature, activated by rapidly hitting the Shift button does exactly that on Windows, but I couldn't find any *nix reference.

Edit: Ideally the solution shouldn't interfere with non-num row keys such as [ but if it does I can live with it (as { is more common in C than [).

6
+25

From your question I understand that you only need certain keys to be working exactly as when Pressing shift and vice versa. For this you can build your own Custom Keyboard Layout. For this you can download Microsoft Keyboard Layout Creator MSKLC and then use it to create custom layout for your system. Also after building the custom layout It should ask you to install the created layout so choose YES to go to that folder where the Installer is and install your custom layout. Also you need to restart your system after Building your custom layout. After this you only Need to activate it from the Control Panel.

Go to (For Windows 8)

  1. Press Windows button + I (To open the Settings Charms menu)
  2. Click on Keyboard button (Lower right corner)
  3. You should see your custom Layout
  4. Select it
  5. And now your Custom layout will be activated

Also For a full tutorial on MSKLC you can get it here and here. See both tuts if any problems occur.

  • The question is about Debian. – harrymc Jan 2 '14 at 6:29
  • @harrymc Well, yes and no. "Ideally I'd like to this on Windows as well but let's focus on Debian as it's my main dev machine." So the answer isn't exactly invalid in the context of the question. – a CVn Jan 3 '14 at 13:36
  • Well I guess I should have specified Windows 7 as I don't own a Win8 machine. A valid answer nonetheless. – rath Jan 4 '14 at 0:30
  • @rath don't need to worry I would put up the details for win 7 running on virtual box. – Hunter Jan 4 '14 at 4:05
  • @rath Here are the details for doing it in W7. Refer to these links:- support.microsoft.com/kb/258824 , support.microsoft.com/kb/306560 and sevenforums.com/tutorials/86239-keyboard-layout-change.html . Also see that when you add a custom keyboard layout (or additional ones provided by windows) only then (when you have more than 1 keyboard layouts activated) you would be able to see the Language bar (In taskbar, just like windows 8 except it is in charms menu). – Hunter Jan 4 '14 at 4:20
3

From the thread Reversing role of pressing shift+number comes this xmodmap file :

keycode  10 = exclam 1 exclam 1
keycode  11 = at 2 at 2
keycode  12 = numbersign 3 numbersign 3
keycode  13 = dollar 4 dollar 4
keycode  14 = percent 5 percent 5
keycode  15 = asciicircum 6 asciicircum 6
keycode  16 = ampersand 7 ampersand 7
keycode  17 = asterisk 8 asterisk 8
keycode  18 = parenleft 9 parenleft 9
keycode  19 = parenright 0 parenright 0

See the above link for more information on using this file.

2

You can use either dumpkeys and loadkeys (for the console) or xmodmap (for X) to redefine the function of a given keyboard key. xev can tell you how X sees a particular key input.

I recommend that you print the full set of keymap expressions first; it's possible your system is set up slightly differently to begin with, in which case the above won't match exactly. To do that, just do xmodmap -pke (for print keymap table as expressions).

As an example, to remap 1 to ! and Shift+1 to 1 in X, we first use xev to find out that 1 is keycode 10 (in my case; make sure to verify). To remap the key to inverse its shifted function:

xmodmap -e 'keycode 10 = exclam 1 exclam 1 exclamdown onesuperior exclamdown'

To restore normal function (this matches what's printed by xmodmap -pke):

xmodmap -e 'keycode 10 = 1 exclam 1 exclam exclamdown onesuperior exclamdown'

The changes take effect immediately and affect at least the entire X session (they are not local to the application that launches xmodmap).

Once you have a set of xmodmap commands that sets the keyboard up the way you want it, store those in ~/.xmodmaprc, and then add to your ~/.xsessionrc (creating it if it doesn't exist):

xmodmap ~/.xmodmaprc

The part you want to add to .xmodmaprc is simply the keycode XX = yyy ... portion of the command line command (that is, the argument to the -e switch).

0

For BSD os look At this option The Keyboard Layout Editor or Creating custom keyboard layouts for X11 using XKB

For Windows check out Microsoft Keyboard Layout Creator 1.4

Those seem to be the best options I have found. Not saying they are the only options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.