ditto

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 14 Imported by: 0

README

ditto logo

Go Bubble Tea Lipgloss evdev

ditto demo

Ditto is an ASCII keyboard visualizer in the terminal that captures global key presses. Even if you're outside the terminal session, the visualizer will still keep updating. Hit the repo with a star if you like this little interactive eye candy app! ⭐

Table of Contents

Motivation

If you've seen rices over at places like r/unixp*rn, every now and then you'll see some developer layouts where you'd have a code editor, then some eye candy to fill up dead space. I thought it would be nice to have an interactive keyboard visualizer that updates no matter where you are active.

Practically, it could have a niche use as well, like sharing your screen to other people so you can flex your Vim skills they can see the keys you press as you navigate through your workflow.

Installation

Installing this program is currently only available through Go. So make sure you have Go installed first:

# Check if Go is installed
go version

# If not, install it from https://go.dev/dl/
# or via your package manager, e.g.:

# sudo pacman -S go            (Arch)
# sudo apt install golang-go   (Debian/Ubuntu)

Once you have Go installed, you can install it directly, or clone if you'd like to mess around with it:


# Install directly
go install github.com/arvingarciabtw/ditto@latest

# Or clone and build
git clone https://github.com/arvingarciabtw/ditto.git
cd ditto
go build

Permissions

[!IMPORTANT] Ditto reads raw evdev events from /dev/input/event*, which isn't readable by normal users by default. Grant the binary read access with:

sudo setcap cap_dac_read_search=ep "$(which ditto)"

This adds a single Linux capability (cap_dac_read_search) to the binary — it only bypasses the DAC read check on /dev/input/event*, nothing else. The binary still runs as your user, not as root. Re-run after rebuilding. Revoke anytime with:

sudo setcap -r "$(which ditto)"

Usage

There's only two main commands you need to be aware of: ctrl+shift+l and ctrl+shift+s. The former opens up the layout list while the latter opens up the size list.

Lists

Size Form Factor
60% Compact, no F-row or arrows
65% 60% + arrow keys + nav cluster
75% Has F-row, compact layout
80% TKL — F-row, arrows, no numpad
96% Compact full-size, includes numpad
100% Full-size with everything
Layout Description
qwerty Standard US layout
dvorak Dvorak simplified
colemak Colemak modern alternative
colemak-dh Colemak with angle mod
workman Workman layout
azerty French AZERTY

Although, if you wish, you can add your own key maps for your custom layouts!

Custom Layouts

Custom layouts are loaded from JSON files placed in ~/.config/ditto/layouts/.

Each .json file becomes a named layout (the filename without extension). Format:

{
  "map": {
    "A": "A",
    "S": "O",
    "D": "E",
    "F": "U",
    "G": "I",
    "H": "D",
    "J": "H",
    "K": "T",
    "L": "N",
    "Q": "'",
    "W": ",",
    "E": ".",
    // ...
  },
  "shift": {
    "1": "!",
    "2": "@", // ...
  },
}
  • map required — maps physical key labels → remapped labels (same format as the built-in layouts in layouts.go)
  • shift optional — shifted state mappings; falls back to US QWERTY shift if omitted

The layout will automatically appear in the layout list (ctrl+shift+l) the next time you launch Ditto.

Roadmap

Some features I'm thinking of implementing in the future, not in order.

  • Windows support
  • Mac support
  • Custom layouts via TUI
  • Custom finger zones

Contributing

I'm certainly not much of an experienced programmer, so any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". If you're liking Ditto, I'd appreciate a star! Thanks again! ⭐

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add super amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a pull request

When writing my commit messages, I follow the Conventional Commits spec, so I'd be glad if you followed this convention as well for your contributions for the sake of consistency.

Acknowledgments

Here are a list of useful resources that I always refer to when developing:

Note on AI

I'm only a beginner programmer (and I've only recently picked up Go), so I'm well aware that the codebase is subpar. I still don't have an eye for what is considered idiomatic Go or not. I've used AI to assist me with making this project, especially in cases where I got really stuck, but rest assured I also tried my best in reviewing it.

I'm always eager to learn and improve, so I'd be happy to hear any improvements. If you'd like to contribute, you can refer to the Contributing section above.

License

Distributed under the MIT License. See LICENSE for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL