<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=2855&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / basic keylogger/hotstrings shell script (e.g., for Esperanto input)]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=2855</link>
		<description><![CDATA[The most recent posts in basic keylogger/hotstrings shell script (e.g., for Esperanto input).]]></description>
		<lastBuildDate>Fri, 17 May 2019 00:24:56 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[basic keylogger/hotstrings shell script (e.g., for Esperanto input)]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16104#p16104</link>
			<description><![CDATA[<p>For any Esperantists out there: There are various ways of entering Esperanto characters in GNU/Linux, but I couldn&#039;t find how to do it with the x-system. Therefore, I cooked up a barebones shell script that does the job. As long as the script is running, you can use the x input method.</p><p>For example, if you type <span class="bbc">ehxosxangxocxiujxauxde</span>, you get <span class="bbc">eĥoŝanĝoĉiuĵaŭde</span></p><p>Feel free to use my shell script below, which I hereby release into the public domain. Simply name the script &quot;iksilo&quot;, make it executable, and run!</p><p>The script is tested and working in Devuan ASCII and OpenBSD 6.5, but should work in any UNIX-like OS using the X window system. (To use it in OpenBSD, simply change <span class="bbc">stdbuf</span> to <span class="bbc">gstdbuf</span>.)</p><div class="codebox"><pre class="vscroll"><code>#!/bin/sh

# Deps: coreutils, xdotool, dzen2
# Usage: iksilo start|stop

keyboard_id=9 # use &#039;xinput list&#039; to find your keyboard&#039;s id. uzu &#039;xinput list&#039; por trovi la id-numeron de via klavaro.

# 1. die gracefully 
dzen2_pid_file=/tmp/iksilo-dzen2-pid
die() { setxkbmap -option; kill $(cat $dzen2_pid_file); pkill -KILL -f iksilo; }
trap die INT HUP TERM; [ &quot;$1&quot; = &quot;stop&quot; ] &amp;&amp; die

# 2. add the necessary keyboard options 
setxkbmap -option lv3:ralt_switch,esperanto:qwerty

# 3. simulate an array using variable names: mappings_38=a mappings_39=s mappings_40=d etc.
xmodmap -pke &gt;/tmp/keymap
while read line; do
	keycode=&quot;$(echo $line | cut -d&#039; &#039; -f 2)&quot;
	key=&quot;$(echo $line | cut -d&#039; &#039; -f 4)&quot;
	eval mappings_&quot;$keycode&quot;=&quot;$key&quot;
done &lt;/tmp/keymap
rm /tmp/keymap

# 4. create indicator
echo &quot;IKSO&quot; | dzen2 -fg &quot;white&quot; -bg &quot;green&quot; -w 40 -h 20 -x 1235 -y 755 -p -e &#039;&#039; &amp; echo $! &gt;$dzen2_pid_file

# 5. go!
replace() { xdotool key BackSpace BackSpace &quot;$1&quot;; }
memory=&quot;--&quot;

xinput test $keyboard_id | stdbuf -oL awk &#039;/press/ {print $3}&#039; | while read keycode; do
	key=$(eval echo \$mappings_$keycode)
	memory=$(echo &quot;${memory}${key}&quot; | grep -o &#039;..$&#039;)
	case $memory in
		cx) replace ISO_Level3_Shift+c ;;
		gx) replace ISO_Level3_Shift+g ;;
		hx) replace ISO_Level3_Shift+h ;;
		jx) replace ISO_Level3_Shift+j ;;
		sx) replace ISO_Level3_Shift+s ;;
		ux) replace ISO_Level3_Shift+u ;;
	esac
done</code></pre></div><p>Karaj samideanoj, nomu la supran programeton &quot;iksilo&quot;, igu ĝin rulebla, kaj rulu ĝin. Dum la programeto rulas, vi povas uzi la ikso-sistemon por tajpi esperantajn literojn ie ajn ene de X.org.&#160; Nur certigu (per la eligaĵo de <span class="bbc">xinput list</span>), ke la numero post <span class="bbc">keyboard_id=</span> estas korekta por vi--ĉe <em>mia</em> komputilo, X.org vidas la klavaron kiel enigilo id=9, sed eble ĉe vi la numero estas alia. Por uzi la programeton en OpenBSD, simple ŝanĝu <span class="bbc">stdbuf</span> al <span class="bbc">gstdbuf</span>.</p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Fri, 17 May 2019 00:24:56 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16104#p16104</guid>
		</item>
	</channel>
</rss>
