Skip to content

PiasekDev/kwtypr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kwtypr

kwtypr is KWtype, but blazingly fast™.

It types text through KWin's privileged Fake Input protocol, so it only works on KDE Plasma Wayland and requires an installed desktop entry with org_kde_kwin_fake_input. Character mapping is derived from the compositor-provided XKB keymap.

Requirements

  • KDE Plasma on Wayland
  • An installed desktop entry declaring org_kde_kwin_fake_input
  • just for the recommended install flow

Install

If you do not have just yet, install it first using the official installation instructions.

After installing just, you can just run:

just install

This builds kwtypr, installs the binary to ~/.local/bin/kwtypr, installs the desktop entry to ~/.local/share/applications/kwtypr.desktop, and refreshes KDE's desktop cache so KWin picks up the required fake-input permission.

If ~/.local/bin is not on your PATH, add it before trying to run kwtypr.

Shell completions are not installed automatically. See Shell Completions below.

For a different prefix, for example a system-wide install under /usr/local, run:

sudo just install prefix=/usr/local

To remove an installation:

just uninstall

Usage

kwtypr [OPTIONS] <TEXT>...

Positional arguments are joined with spaces before typing.

By default, kwtypr aims for maximum throughput: --initial-delay 0, no chunk pacing, and --key-hold 0, with no extra Wayland flushes before the final roundtrip. --ready-timeout defaults to 5000, and Unicode fallback is disabled unless --unicode-fallback is passed.

Timing and compatibility options:

  • --initial-delay <MS>: wait before typing starts, default 0
  • --character-delay <MS>: wait after each typed character; shorthand for --chunk-size 1 --chunk-delay <MS>
  • --key-delay <MS>: alias for --character-delay for KWtype compatibility
  • --chunk-size <N>: type text in chunks of N input characters
  • --chunk-delay <MS>: wait after each typed chunk
  • --key-hold <MS>: hold each key before release, default 0
  • --unicode-fallback: enable Ctrl+Shift+U Unicode input fallback
  • --ready-timeout <MS>: fail if Wayland initialization takes too long, default 5000 (0 disables the timeout)

Shell Completions

kwtypr can generate shell completions at runtime:

kwtypr completions bash

You can install the generated completions manually. Common locations are:

kwtypr completions bash > ~/.local/share/bash-completion/completions/kwtypr
kwtypr completions zsh > ~/.local/share/zsh/site-functions/_kwtypr
kwtypr completions fish > ~/.config/fish/completions/kwtypr.fish

Available shells depend on what clap_complete supports for the installed version. Run kwtypr completions --help for the current list.

Differences From KWtype

  • kwtypr joins positional arguments with spaces, so kwtypr hello world types hello world.
  • kwtypr defaults to maximum-throughput typing with no artificial delays, no key hold, and no extra flushes before the final roundtrip.
  • kwtypr supports chunked pacing via --chunk-size and --chunk-delay. --character-delay is shorthand for one-character chunks.
  • Unicode fallback is not enabled by default. Pass --unicode-fallback if you want Ctrl+Shift+U fallback for characters that cannot be typed directly with the current layout.
  • If typing completes but some characters could not be mapped, kwtypr keeps going, reports the failures, and exits with code 2.

Exit Codes

  • 0: all requested characters were typed
  • 1: initialization or Wayland I/O failed
  • 2: typing completed, but one or more characters could not be typed with the current layout

Troubleshooting

If some applications miss the first character, or the typed text does not appear reliably, add a small initial delay:

kwtypr --initial-delay 1 "example text"

In practice, an initial delay of 1 millisecond appears to fix input in Google Chrome in setups where Chromium works without it.

If an application behaves better when text arrives in chunks rather than all at once, add chunk pacing explicitly:

kwtypr --chunk-size 16 --chunk-delay 10 "example text"

Smaller chunk sizes and longer chunk delays may improve compatibility at the cost of throughput.

If a character cannot be typed directly with the current layout, enable Unicode fallback explicitly:

kwtypr --unicode-fallback "..."

If kwtypr still reports that a character could not be typed, check whether the current keyboard layout provides the keys needed for that fallback sequence.

About

KWtype, but blazingly fast™

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors