{"id":287,"date":"2013-04-25T00:43:14","date_gmt":"2013-04-25T00:43:14","guid":{"rendered":"http:\/\/www.timokorthals.de\/?p=287"},"modified":"2016-12-28T00:14:55","modified_gmt":"2016-12-27T23:14:55","slug":"remapping-caps-lock-under-xserver-to-call-e-g-konsole","status":"publish","type":"post","link":"http:\/\/www.timokorthals.de\/?p=287","title":{"rendered":"Remapping Caps-Lock under XServer to call e.g. konsole"},"content":{"rendered":"<p>Hi there,<\/p>\n<p>isn&#8217;t it horrible if you write a text and suddenly THIS HAPPens.<br \/>\nSo while Caps-Lock is the most useless key, one could ask for a remapping to a more usefull key or action (call the console).<\/p>\n<p>So let&#8217;s check out how to remap the Caps-Lock key using <strong>xmodmap<\/strong>:<!--more--><br \/>\nFirst we need to unmap the Caps-Lock from the special mappings:<\/p>\n<pre>$ xmodmap -e \"remove lock = Caps_Lock\"<\/pre>\n<p>Now we need to figure it out, which keycode belongs to the Caps-Lock key. While using th tool <strong>xev<\/strong> and pressing\u00a0<em>Caps-Lock<\/em>, we can see that keycode <em>66<\/em> belongs to the key <em>Caps-Lock<\/em> and that it is mapped to <em>Caps_Lock<\/em>. (The number of the keycode is the unique identyfier regarding a key and the keysymname like <em>Caps_Lock<\/em> is the reinterpretation of the XServer).<\/p>\n<p>Whit the keycode we can now do a remap to any other key like &#8230; let us use an unused one like <strong>F13<\/strong>:<\/p>\n<pre>$ xmodpap -e \"keycode 66 = F13\"<\/pre>\n<p>Now what can we do with <strong>F13<\/strong>? Using <strong>KDE<\/strong> and <strong>global shortcuts<\/strong> (SystemSettings -&gt; Shortcuts and Gestures -&gt; Edit -&gt; New -&gt; Global Shortcut -&gt; Command\/URL), we can bind any action to <strong>F13<\/strong>. I use it for calling &#8220;konsole&#8221; which saves a lot of time while working.<\/p>\n<p>The keymapping will be lost after the next login, so we need to make the remapping permanent. Create a new file in your homefolder which will be executed by <strong>xmodmap<\/strong>\u00a0after every login:<\/p>\n<pre>$ kate ~\/.Xmodmap<\/pre>\n<p>Now add the following lines:<\/p>\n<pre>! Comment: Remove Caps_Lock from special mapping\r\nremove lock = Caps_Lock\r\n! Comment: Tell xmodmap that key 66 (former Caps_Lock) is now F13\r\nkeycode 66 = F13<\/pre>\n<p>Well done!<\/p>\n<p><strong>Edit<\/strong><\/p>\n<p>I&#8217;ve found a nice manual for remapping the right mouse button on http:\/\/www.geocities.jp\/fred_b_maciel\/kbd\/kbd-e.html<\/p>\n<p>Long story short for mapping the right mouse button to Control_R:<\/p>\n<pre class=\"lang:sh decode:true \" title=\"bash commands\">xmodmap -e 'keycode 105 = Pointer_Button3'\r\nxkbset m\r\nxkbset exp =m\r\n<\/pre>\n<p>To make it permanent, create <em>~\/.xinitrc<\/em><\/p>\n<pre class=\"lang:sh decode:true \" title=\".xinitrc\"># Set AltGr to the right button\r\nkeycode 105 \r\n# turn mousekeys on and expiry (timeout) off\r\nxkbset m\r\nxkbset exp =m\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hi there, isn&#8217;t it horrible if you write a text and suddenly THIS HAPPens. So while Caps-Lock is the most useless key, one could ask for a remapping to a more usefull key or action (call the console). So let&#8217;s check out how to remap the Caps-Lock key using xmodmap:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,3,6],"tags":[],"_links":{"self":[{"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/posts\/287"}],"collection":[{"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287"}],"version-history":[{"count":1,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":405,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions\/405"}],"wp:attachment":[{"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.timokorthals.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}