User Tools

Site Tools


blog:linux_adapt_keyboard

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:linux_adapt_keyboard [2012-04-17 11:08] brbblog:linux_adapt_keyboard [2012-04-17 11:10] (current) brb
Line 19: Line 19:
 By the way, if you want to generate this list, there are probably more elegant ways but here's my two-minute hack: By the way, if you want to generate this list, there are probably more elegant ways but here's my two-minute hack:
  
-[code]+<code>
 ~% cat paper.tex| \ ~% cat paper.tex| \
        perl -lne 'while ($_) {        perl -lne 'while ($_) {
Line 31: Line 31:
                }                }
            }'            }'
-[/code]+</code>
  
 The backslash key is often hard to stretch to, the curly braces usually require shift (or Alt-Gr on some international keyboards). That's a lot of work for what is, as far as catching mammoths is concerned, something pretty useless. The backslash key is often hard to stretch to, the curly braces usually require shift (or Alt-Gr on some international keyboards). That's a lot of work for what is, as far as catching mammoths is concerned, something pretty useless.
Line 41: Line 41:
 Suppose you want to put the backslash where the semi-colon is. First you need to find the keycode for the semi-colon. There are two ways to do this. Firstly, from a terminal run a program called xev. When you press a key in its window, it tells you lots of information about it in the terminal - including the keycode. The other way to do it is to run xmodmap -pke. This produces a list of all the current assignments from which you can read off the keycode for the semi-colon. Suppose you want to put the backslash where the semi-colon is. First you need to find the keycode for the semi-colon. There are two ways to do this. Firstly, from a terminal run a program called xev. When you press a key in its window, it tells you lots of information about it in the terminal - including the keycode. The other way to do it is to run xmodmap -pke. This produces a list of all the current assignments from which you can read off the keycode for the semi-colon.
  
-~% xmodmap -pke | grep semicolon +  ~% xmodmap -pke | grep semicolon 
-keycode   47 = semicolon colon oslash Oslash+  keycode   47 = semicolon colon oslash Oslash
  
 (Yeah, I'm on a Norwegian keyboard.) Now you just need to remap that: (Yeah, I'm on a Norwegian keyboard.) Now you just need to remap that:
  
-~% xmodmap -e 'keycode 47 = backslash colon oslash Ooslash'+  ~% xmodmap -e 'keycode 47 = backslash colon oslash Ooslash'
  
 Lo and behold! Keyboard modified. Lo and behold! Keyboard modified.
Line 52: Line 52:
 Three things to note. Save the initial output of xmodmap -pke since if everything goes wrong typing: Three things to note. Save the initial output of xmodmap -pke since if everything goes wrong typing:
  
-~% xmodmap original_list+  ~% xmodmap original_list
  
 will reset it (though that might be difficult if you've reset all the keys! In that case, log out and log back in again). Secondly, to save you typing in all those commands every time, you can put them all in a file called, say, .xmodmap and put a line xmodmap ~/.xmodmap in your startup file. Gnome actually goes looking for these files and asks if you want to load them so you don't need to put them in your startup file. The final point is that you might want to consider having different keyboards for different tasks. I have a keyboard for writing LaTeX documents and a "normal" one for everything else; switching between them is easy using "hot keys". will reset it (though that might be difficult if you've reset all the keys! In that case, log out and log back in again). Secondly, to save you typing in all those commands every time, you can put them all in a file called, say, .xmodmap and put a line xmodmap ~/.xmodmap in your startup file. Gnome actually goes looking for these files and asks if you want to load them so you don't need to put them in your startup file. The final point is that you might want to consider having different keyboards for different tasks. I have a keyboard for writing LaTeX documents and a "normal" one for everything else; switching between them is easy using "hot keys".
blog/linux_adapt_keyboard.1334653739.txt.gz · Last modified: 2012-04-17 11:08 by brb