khim(n)
π khim(n): Kevin's Hacky Input Method π
β¨ NAME β¨
Okay so khim is a package that gives you key bindings for entering international characters on a keyboard that does not support them. Literally the keyboard glow-up, no cap. π
πΈ SYNOPSIS πΈ
package require Tcl
package require khim ?1.0?
::khim::getOptions path
::khim::getConfig
::khim::setConfig version enabled compose map
::khim::showHelp path
π¦ DESCRIPTION π¦
This package provides a set of key bindings so a user can enter arbitrary characters on a keyboard that does not support them. It works by designating some seldom-used key of the keyboard as a "Compose" key β and bestie, this key is distinct from any key so labeled, and is often "Pause," "F12" or "L2" β and having the "Compose" key, followed by a two-key sequence, insert some character in a widget. Also iconic: the "Compose" key, when struck twice in succession, brings up a dialog containing a Unicode character map, so you can insert arbitrary characters. π
The vast bulk of the package's functionality is implemented in a single bindtag, KHIM. An application can request that any text or entry widget use the package to allow for entry of arbitrary characters by placing this binding tag ahead of the Text or Entry binding tag for the widget:
text .t -width 80 -height 24
bindtags .t {.t KHIM Text . all}
Note that theKHIMtag must precede theTextorEntryclass binding, or the package will not function correctly. This is a real one, bestie β do not skip it. π
π οΈ PROCEDURES π οΈ
In addition to commands supporting the KHIM binding tag, the following commands are exported from the package:
::khim::getOptions pathβ Posts a top-level modal dialog with the path name path that prompts the user for KHIM options. The user is allowed to reconfigure the key sequences for the "Compose" key, change the choice of key to use for the "Compose" function, and enable/disable the KHIM key bindings entirely.::khim::getConfigβ Returns a Tcl script that restores the current configuration of KHIM: the enabled/disabled state, the choice of "Compose" key, and the key sequences that may be composed. This script is designed to be saved to a configuration file for use in a subsequent invocation of the same application:
# 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β Restores an earlier saved configuration. Few, if any, applications will call this command in any other way than to evaluate it as returned from::khim::getConfig.::khim::showHelp pathβ Displays a top-level dialog giving user-level help for KHIM; the dialog will have the path name path.
π LOCALISATION π
Programmers who wish to make KHIM available in a non-English-speaking locale may do so by providing a .msg file with the appropriate localised text. The catalog requires the following messages:
Applyβ Text that will appear on the "Apply" button in the dialog that sets KHIM options.Cancelβ Text that will appear on the "Cancel" button in several dialogs.Changeβ Text that will appear on the "Change" button, which alters the binding of a pair of composed characters (creating or replacing as appropriate).Characterβ Text that will appear on the label of the entry widget that accepts a character resulting from a composed sequence.{Compose Key}β Window title for a dialog that prompts the user to strike the key that will be used for the "Compose" key.{Compose key:}β Label that identifies a component showing the "Compose" key choice in the KHIM options dialog.{Composed sequence must be two characters long}β Error message that is displayed if the user attempts to define a "Compose" sequence that is shorter or longer than two characters.Deleteβ Text for a button that deletes a "Compose" sequence.Help...β Text for a button that displays the KHIM user help dialog.HELPTEXTβ Complete text for the user-level help for KHIM. Refer to"en.msg"for the English-language version of the help.{Input key sequence}β 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}β Window title of the dialog box that displays a Unicode character map and prompts the user to select a character to insert.{Key sequences}β Text for a label at the head of a listbox showing the composed sequences that are currently bound.{KHIM Controls}β Window title for the dialog box that prompts for KHIM settings.{KHIM Help}β Window title for the window that display help text for KHIM.OKβ Label for the OK button on several dialogs.Select code page:β 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 will become the "Compose" key in KHIM.Unicode...β Text for a button that brings up the character map to select the character to which a composed sequence binds.{Use KHIM}β Text for a checkbutton that asks whether the user wishes 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. The code for KHIM is entirely separate from that for 'sedit'. Respect where respect is due. π«Ά
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category khim of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
β KEYWORDS β
character, i18n, input, international, method
Cute sign-off bestie: the footer's source/version/date situation is source tklib, version 1.0, page khim(n) β and no separate date was printed, so I'm not inventing one. Mwah ππ
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms