<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave &#187; xmodmap</title> <atom:link href="https://bogdan.org.ua/tags/xmodmap/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>Enabling special buttons (keys) on laptops under Linux</title><link>https://bogdan.org.ua/2008/05/08/enabling-special-buttons-keys-on-laptops-under-linux.html</link> <comments>https://bogdan.org.ua/2008/05/08/enabling-special-buttons-keys-on-laptops-under-linux.html#comments</comments> <pubDate>Thu, 08 May 2008 17:25:08 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[buttons]]></category> <category><![CDATA[DCOP]]></category> <category><![CDATA[kde]]></category> <category><![CDATA[keyTouch]]></category> <category><![CDATA[kmilo]]></category> <category><![CDATA[kmix]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[mute]]></category> <category><![CDATA[special keys]]></category> <category><![CDATA[volume]]></category> <category><![CDATA[xmodmap]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=294</guid> <description><![CDATA[Note, that under Gnome I only had to use a single system-wide utility to bind volume buttons to volume control. Under KDE things were a tad tougher. First, you may want to look for kmilo (if you don&#8217;t have it yet). It has several plugins e.g. for ThinkPad and Vaio laptops, as well as &#8220;generic&#8221; [&#8230;]]]></description> <content:encoded><![CDATA[<p>Note, that under Gnome I only had to use a single system-wide utility to bind volume buttons to volume control. Under KDE things were a tad tougher.</p><p>First, you may want to look for <a
href="http://www.thinkwiki.org/wiki/KMilo">kmilo</a> (if you don&#8217;t have it yet). It has several plugins e.g. for ThinkPad and Vaio laptops, as well as &#8220;generic&#8221; plugin. I didn&#8217;t try this solution, though.</p><p>If you need more than kmilo can offer: <a
href="http://keytouch.sourceforge.net/index.html">keyTouch</a> could help. keyTouch should be good also for non-laptop multimedia keyboards. However, this also wasn&#8217;t the solution I used.</p><p>If you want to know how to map your special keys to functions yourself &#8211; then read on.<br
/> <span
id="more-294"></span><br
/> (Main source used: <a
href="http://dev-loki.blogspot.com/2006/04/mapping-unsupported-keys-with-xmodmap.html">mapping unsupported keys with xmodmap</a> &#8211; it&#8217;s easy and clear, but didn&#8217;t work exactly as expected for me).</p><p>Let&#8217;s go step-by-step. (Note: I&#8217;m on Debian Etch on LG LM70 Express laptop.)</p><ol><li>run this command (copy and paste &#8211; should be single line) in the Konsole or whatever terminal window you have open; you don&#8217;t need to be root to run this command</li></ol><div
id="ig-sh-1" class="syntax_hilite"><div
class="code"><ol
class="code" style="font-family:monospace;"><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'</div></li></ol></div></div><ol
start="2"><li>xev window will appear. Put mouse cursor over that window, and press the buttons you need to enable under Linux, memorizing/writing down the codes you get. In my example, I pressed &#8220;vol. -&#8221;, &#8220;vol. +&#8221;, and &#8220;mute&#8221; buttons of the laptop, and observed the following output in the console window:<br
/><blockquote><p><strong>174 NoSymbol<br
/> 176 NoSymbol<br
/> 160 NoSymbol</strong></p></blockquote><p>Those numbers on the left are <em>keycodes</em>, and the <em>NoSymbol</em> tells us that none of <em>keysyms</em> was bound to those <em>keycodes</em></li><li>now we need to create keycode-keysym bindings. For that, open with your favourite text editor (such as <strong>pico</strong>, <strong>nano</strong>, <strong>vi</strong>, <strong>kate</strong>, <strong>mcedit</strong> etc) the file <strong>~/.Xmodmap</strong> (e.g. <strong>nano ~/.Xmodmap</strong> in the console)</li><li>now you need to decide how to bind those special keys. For my case, the X window system has reserved key symbol names, namely X86AudioLowerVolume, X86AudioRaiseVolume, and X86AudioMute. For your case, you may need to lookup if there&#8217;s a pre-defined name for the functionality you are enabling &#8211; it would be best if there is such a name. Otherwise, you can use such keys as F13, F14, F15 etc (which are not physically present on the keyboard)</li><li>write the bindings to the Xmodmap file. Format is simple, as in my case:<br
/><blockquote><p>Keycode 160 = XF86AudioMute<br
/> keycode 174 = XF86AudioLowerVolume<br
/> keycode 176 = XF86AudioRaiseVolume</p></blockquote></li><li>to apply the change, save Xmodmap file, exit the editor, and then from the console execute <strong>xmodmap ~/.Xmodmap</strong>. Now the bound keys must be visible to KDE&#8217;s &#8220;global shortcuts&#8221; (and any other &#8220;keyboard shortcut input&#8221; fields). To check, I right-clicked KMix, &#8220;Show mixer window&#8221;, &#8220;Configure global shortcuts&#8221;, and then just assigned respective keys to volume control options. It worked for me. Later I disabled those shortcuts, and everything still works fine (might be because of the installed kmilo, but I didn&#8217;t check)</li><li>on Debian Etch, when starting KDE from kdm, the <strong>.Xmodmap</strong> file isn&#8217;t automatically applied at KDE startup. This can be easily fixed by creating the <strong>xmodmap.sh</strong> file in the <strong>~/.kde/Autostart/</strong> directory, with a single line: <strong>/usr/bin/xmodmap $HOME/.Xmodmap</strong>. Dont forget to <strong>chmod u+x xmodmap.sh</strong>. The <strong>xmodmap.sh</strong> script will bind codes to symbols at each KDE start. (Alternatively, the same script could be put into <strong>~/.kde/env/</strong>, but according to <strong>startkde man-page</strong>, that folder is used for scripts which set KDE-wide variables, whereas we only run a command and do not assign any variables. Also, I wouldn&#8217;t recommend putting xmodmap invocation into <em>.bashrc</em> or <em>.bash_profile</em> &#8211; those are executed whenever you login, but presented model of xmodmap usage seems to have sense for KDE only.)</li></ol><p>This is it.</p><p>For the method of using DCOP in KDE for hotkeys please see my <a
href="http://dev-loki.blogspot.com/2006/04/mapping-unsupported-keys-with-xmodmap.html">primary source</a>, which has a simple but clear KMix DCOP example.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&amp;linkname=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&amp;linkname=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&amp;linkname=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&amp;linkname=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&amp;linkname=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2008%2F05%2F08%2Fenabling-special-buttons-keys-on-laptops-under-linux.html&#038;title=Enabling%20special%20buttons%20%28keys%29%20on%20laptops%20under%20Linux" data-a2a-url="https://bogdan.org.ua/2008/05/08/enabling-special-buttons-keys-on-laptops-under-linux.html" data-a2a-title="Enabling special buttons (keys) on laptops under Linux"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2008/05/08/enabling-special-buttons-keys-on-laptops-under-linux.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>