From 9e6bca0b2fadeb55d55a27329a72e03b31d9998d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Sat, 6 Sep 2025 16:37:54 -0700 Subject: All the sites --- jankime.html | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 jankime.html (limited to 'jankime.html') diff --git a/jankime.html b/jankime.html new file mode 100644 index 0000000..3c54176 --- /dev/null +++ b/jankime.html @@ -0,0 +1,117 @@ + + +Janky IME + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Janky IME                                                      6-29-2023
+--------------------------------------------------------------------------------
+UPDATE: This IME is now tmux based, old xdotool version is still here
+
+UPDATE2: I have created the most cursed thing in existance. Full unicode display
+and input support in the linux console using only userland bash/busybox and
+tmux. See we have unicode at home
+
+A new python version came out, so of course that means every python package on
+my rolling-release system has broken. This includes ibus, which I need for my
+input method. I'm currently running some web-crawling scripts that I don't want
+to stop, so while I wait for my machine to finish downloading all of PDB, I decided
+to write a janky bashscript implementation of ibus table so that I can still use
+嘸蝦米.
+
+Background:
+	嘸蝦米 (EN: Boshiamy) is a proprietary component-based input method for
+	Chinese. They offer paid software on iOS, Android, and Windows, but no
+	Linux version is available. On my phone I gladly pay for a Boshiamy
+	license, but on Linux I use this implementation of Boshiamy using ibus
+	table from here.
+
+	However, I urge that people pay for the license anyways as most of the
+	actual work in creating an IME is organizational. The technical aspects
+	of IMEs are fairly trivial as you'll see here.
+
+	In technical terms, it's just a very large TSV file with the first
+	column being the input code, the 2nd being the character, and the 3rd
+	being a ranking for ordering which character comes first when selecting
+	them.
+	
+	EX: 
+		typing wso[SPACE] or wso1 inputs 浩, typing wso2 inputs 澢
+			wso     浩      100
+			wso     澢      99
+
+		It can also be used for non-chinese characters such as è
+			,ne     è       100
+
+The Implementation:
+	I want this to work in the terminal, and I want it to only require bash,
+	and tmux, and it needs to work on all programs running in the terminal
+	regardless of whether they use cooked input(bash) or raw input(vim). 
+
+	So what I ended up on is a bash script that runs in a seperate tmux
+	panel and sends input to the previously active panel
+
+	Input is read with read in a loop
+
+	CODE:
+		OIFS=$IFS
+		export IFS=""; read -rsn1 i
+		IFS=$OIFS
+
+	IFS="" is done to make it read spaces as input, but this makes this
+	implementation very brittle and probably not portable depending on bash
+	versions. This also passes along control and special characters such as
+	delete and move left, and it seems tmux handles most of the differences
+	between terminals. An older version of this ime using xdotool did not
+	handle these control characters well.
+
+	I then simply run grep ^$code\s, rearrange the columns with awk and sort,
+	then take out the ranking column
+
+	CODE:
+		opt=$(grep "^$code\s" ~/lang/zh/boshiamy/ibus-boshiamy/boshiamy.txt |\
+					#remove simplfied
+					grep -v 98|\
+					awk '{print $3" "$2}' |\
+					sort -nr|\
+					awk '{print $2}')
+
+	finally, it inputs the selected character into tmux if the ime input is
+	1-9 or Space. NOTE: bash variables don't store newlines, so the
+	conversion of the input characters from line seperated to space
+	seperated was done for free.  However this makes the code less portable
+
+	CODE:
+		char=$(echo $opt | awk "{print \$1}")
+		...
+		tmux send-key -t "!" "$char"
+
+Downsides/The Future:
+	This works in the linux console but obviously the linux console has
+	limitations on what text it can display(by default the linux console can
+	not display fonts with more than 512 characters). I think I'm gonna
+	write a bash based cbrll implemntation and a character displayer as well
+	so that I can get full userland unicode display and input support.
+
+
+
+
+ + -- cgit v1.1