khim(3tk)
π khim β bestie edition π
okay so before we even start: this is khim(3tk) from Kevin's Hacky Input Method, and it's genuinely one of those little tools that changes your whole life. sit down, grab a boba, we're doing this π§β¨
β¨ NAME β¨
khim β it hands you key bindings so you can type international characters on a keyboard that literally does not have them. no cap. π¦
πΈ SYNOPSIS πΈ
package require Tcl
package require khim ?1.0.3?
::khim::getOptions path
::khim::getConfig
::khim::setConfig version enabled compose map
::khim::showHelp path
π DESCRIPTION π
okay so picture this: your keyboard is giving "monolingual" and you need to type, like, everything. this package fixes that. it does it by picking some random key nobody ever uses and crowning it the "Compose" key π β and heads up, that key is not the same as any key actually labeled "Compose", it's usually Pause, F12 or L2. then the whole bit is: you hit "Compose", then a two-key sequence, and boom π₯ some character gets inserted into a widget. and if you hit the "Compose" key twice in a row? a whole dialog pops up with a Unicode character map and you can insert literally anything you want. it's giving infinite possibilities fr fr.
the vast bulk of the package's functionality lives in a single bindtag, KHIM. so if you want any text or entry widget to let people type arbitrary characters, you just put that binding tag ahead of the Text or Entry binding tag for that widget:
text .t -width 80 -height 24
bindtags .t {.t KHIM Text . all}
π¨ bestie listen: theKHIMtag must come before theTextorEntryclass binding, or the whole thing just won't work correctly. order matters, periodt.
π PROCEDURES π
so besides the commands that back the KHIM binding tag, here's what the package exports:
::khim::getOptions pathβ posts a top-level modal dialog with the path name path, and it asks the user for their KHIM options. the user gets to reconfigure the key sequences for the "Compose" key, swap out which key does the "Compose" job, and turn the KHIM key bindings on or off entirely. full control, we love to see it π::khim::getConfigβ returns a Tcl script that restores the current KHIM config: whether it's enabled or disabled, which key is the "Compose" key, and which key sequences can be composed. and the whole point is you save that script to a config file and use it next time you launch the same app:
# Save KHIM configuration
set f [open ~/.khimrc w]
puts $f [::khim::getConfig]
close $f
# Restore KHIM configuration
source ~/.khimrc
::khim::setConfig version enabled compose mapβ brings back an earlier saved configuration. real talk: few, if any, applications will ever call this any way other than evaluating it as whatever came back from::khim::getConfig. so don't get creative with it π::khim::showHelp pathβ pops up a top-level dialog with user-level help for KHIM, and that dialog gets the path name path.
π LOCALISATION π
if you're a programmer and you want KHIM to show up in a non-English-speaking locale β slay, go off π«Ά β you do it by providing a .msg file with the right localised text. the catalog needs these messages, and yes, every single one:
Applyβ the text that shows up on the "Apply" button in the dialog that sets KHIM options.Cancelβ the text that shows up on the "Cancel" button in several dialogs.Changeβ the text that shows up on the "Change" button, which alters the binding of a pair of composed characters (it creates or replaces, whichever is appropriate).Characterβ the text that shows up on the label of the entry widget that accepts a character resulting from a composed sequence.{Compose Key}β the window title for a dialog that prompts the user to strike the key that'll be used for the "Compose" key.{Compose key:}β the label that identifies the component showing the "Compose" key choice in the KHIM options dialog.{Composed sequence must be two characters long}β the error message that shows up if the user tries to define a "Compose" sequence that's shorter or longer than two characters. (two. characters. bestie.)Deleteβ the text for a button that deletes a "Compose" sequence.Help...β the text for a button that displays the KHIM user help dialog.HELPTEXTβ the complete text for the user-level help for KHIM. go look at"en.msg"for the English-language version of the help.{Input key sequence}β the text for a label of the entry widget that prompts the user for a two-character sequence to use with the "Compose" key.{Insert Character}β the window title of the dialog box that displays a Unicode character map and prompts the user to pick a character to insert.{Key sequences}β the text for a label at the head of a listbox showing the composed sequences that are currently bound.{KHIM Controls}β the window title for the dialog box that prompts for KHIM settings.{KHIM Help}β the window title for the window that displays help text for KHIM.OKβ the label for the OK button on several dialogs.Select code page:β the label for a spinbox that prompts the user for a Unicode code page number.SELECT COMPOSE KEYβ a message, which should be composed in short lines, prompting the user to press the key that'll become the "Compose" key in KHIM.Unicode...β the text for a button that brings up the character map so you can pick the character a composed sequence binds to.{Use KHIM}β the text for a checkbutton that asks whether the user wants to use KHIM to manage composed key sequences.
π ACKNOWLEDGMENTS π
KHIM was originally inspired by the key bindings that Brent Welch developed for the 'sedit' editor used in the 'exmh' mail user agent. and important: the code for KHIM is entirely separate from the code for 'sedit'. no crossover, no shared code, we're independent π¦
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. like, obviously. please report them in the category khim of the Tklib Trackers at http://core.tcl.tk/tklib/reportlist. and if you've got ideas for enhancements for either the package and/or the documentation, please report those too. we're listening, we promise π
β KEYWORDS β
character, i18n, input, international, method
and that's the whole thing, bestie π this came from tklib, version 1.0.3, and yeah the page itself is dated khim(3tk) β go forth and compose your little heart out πβ¨
π¦ where this page comes from
- debian trixie: tklib 0.9-1
- ubuntu questing: tklib 0.9-1
- ubuntu resolute: tklib 0.9-1build1
- ubuntu stonking: tklib 0.9-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms