Skip to content
gig3mPublic

About

Chess for Omarchy — a keyboard-first, theme-following one-player chess workspace built on Quickshell, with a bundled UCI engine

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

omamate

Chess for Omarchy 4. One window, one player, one engine. Keyboard first, themed from whatever Omarchy theme is active, and it never assumes what size the compositor is going to give it.

omamate at full width

curl -fsSL https://raw.githubusercontent.com/gig3m/omamate/main/install.sh | bash
omamate

Nothing needs root and nothing is written outside $HOME. Run the same command again to update — it pulls and reinstalls. uninstall.sh reverses it and leaves your saved games and settings alone.

On Arch there is a package too, which pulls in the runtime for you:

git clone https://github.com/gig3m/omamate.git
cd omamate/packaging/aur && makepkg -si

From a checkout, ./install.sh installs that checkout instead of cloning, and bin/omamate runs it without installing anything at all. The installed command is a symlink into that checkout, so if you move or rename the folder, re-run ./install.sh to repoint it.

omamate is a Quickshell config, not a compiled binary — there is nothing to build.

What it is

A game against a computer opponent. You pick a level, a colour and a time control; it plays the other side and shows you what it is thinking. There is no human-versus-human mode, no online play, and no account.

  • Board — drag a piece, click it, or drive it with hjkl. Legal destinations are marked, a king in check is tinted, and the last move keeps its trail: a soft tint on the square it left, a stronger one on the square it reached.
  • Sound — each move is a struck-body sound, with capture, castling, check, promotion and the end of the game each getting their own. / → toggle sound.
  • Engine pane — the engine's own score, principal variation, and search depth, plus the opening by name.
  • Clocks — 3+0, 5+3, 10+0, or untimed. Increment is applied per move and flag-fall ends the game.
  • History — step back through the game with [ and ] without losing it.
  • Picking up where you left off — settings and the game in progress are written to $XDG_STATE_HOME/omamate/state.json. Close the window mid-game and the new-game screen offers resume game next time.
  • PGN — x writes the game to $XDG_DATA_HOME/omamate/games/, with the players, date, time control, level, result and how it ended. A PGN whose Result is * and whose White is ? records neither who played nor who won.

What it looks like

Every shot below is generated by omamate/preview.qml, so they are the current build rather than a hopeful memory of it. Theme is tokyo-night; the app follows whatever yours is.

new game half width
New game. Level, colour and time control, reachable by pointer or keyboard. 900px. The engine pane folds into the header readout.
command palette key list
/ — command palette. Prefix-filtered, walker-shaped. ? — the key list. Overlays dim the board, never navigate away from it.
game over narrow
End of game. Only numbers omamate measured. 440px. Stacked; eval becomes a chip, moves a ticker.

Keys

Everything is reachable without a pointer. ? shows this in the app.

hjkl move the focus square
↵ select a piece, then a destination
u undo — takes back your move, the reply, and the time both cost
f flip the board
r / d resign / offer draw
[ ] step back and forward through the game
e c toggle the engine pane, the coordinates
/ command palette
? key list
n x q new game, export PGN, quit

Sound

The six clips are synthesised by tools/make-sounds.py, not sampled — the set lives in the repo as a script that can be retuned rather than as binaries nobody can explain. Each one is a short noise burst rung through a bank of resonators, which is roughly what a wooden piece meeting a board does; the pitch comes from the resonator frequencies and the character from how fast each one decays. Check and promotion add a small bell over the hit; the end of a game is a low, settled triad rather than a fanfare.

Re-run the script after changing it:

python3 tools/make-sounds.py

Two things in the launcher exist because of sound, and both are worth knowing before anyone "cleans them up":

  • The clips are warmed at startup. Qt decodes a clip and opens the audio sink on the first play(), not when the source is set — the better part of a second on the main thread. Untouched, that cost lands on the player's first move and freezes the board mid-gesture. Sound.warmUp() plays every clip muted during startup instead, before the window is on screen.
  • QT_FFMPEG_DECODING_HW_DEVICE_TYPES is set empty. Qt's FFmpeg backend probes every hardware video decoder on the machine — vdpau, cuda, vaapi, qsv, vulkan — the first time any media is touched. That measured 650ms here, to play a 13KB mono WAV. Declaring no hardware device types skips the probe and keeps startup at ~220ms with the warm-up in place.

The engine

omamate speaks UCI and does not care what is on the other end. engine/omamate-engine resolves one at launch:

  1. Stockfish, if stockfish is on PATH. Not in the Arch repositories any more — yay -S stockfish if you want it. Strongest option by a wide margin.
  2. The bundled engine otherwise: engine/omamate-engine.mjs, run under node. Principal-variation search with iterative deepening, fail-soft quiescence, killer moves and a history table for ordering, piece-square evaluation, and a skill ladder that reaches depth 4-5 at level 8.

Level is 1-8 and can be changed at any time — on the new-game screen (click the pips, or jk to the row and hl), or mid-game with + / - and the increase level / decrease level commands. It takes effect on the engine's next move.

Levels weaken by searching less deeply and valuing positions more loosely. What they never do is decline a forced mate the search has already found: an opponent that walks past mate in one does not read as "easy", it reads as broken.

Whichever answers, the app learns its name from the UCI handshake and shows it — the ENGINE pane never claims a search that did not happen.

The engine is given the clock, not a fixed think time: go wtime … btime … winc … binc …, which both engines understand. The level sets the ceiling and the clock sets the floor, so it spends a thirtieth of what is left plus most of the increment and never enough to flag. Spending a per-level budget regardless of time remaining is how an engine loses on time in a won position — at level 8 in 3+0 that arrived around move 45, which is most games.

If the engine dies it is restarted automatically, twice, and the shell hands the restarted process the position it owes a move on. Without that last part a crash leaves the board sitting there with resign as the only way out. A third failure in a row means there is no engine on this machine, and it stops trying rather than spinning on processes.

The bundled engine runs as a subprocess rather than inside QML for two reasons: a multi-second search would freeze the UI, and Qt's JavaScript engine is around two orders of magnitude slower than node at this workload.

Theming

There is no palette in this repository. Every colour is read from the active theme's colors.toml under ~/.local/state/omarchy/current/, or derived from those tokens — board squares from muted, highlights mixed toward accent, clocks from green and red. omarchy theme set rewrites theme.name, which omamate watches, so the window restyles itself live.

Defaults are tokyo-night, so a missing state directory still gives you a styled window rather than a grey one.

Layout

The window never assumes a size. Every layout decision reads the width the compositor actually gave it:

width layout
≥ 1100px three panes — engine · board · moves
640–1100px board and moves; the engine folds into the header readout
< 640px stacked; eval becomes a chip, the move list a ticker, coordinates off

Height matters too. Below 560px the hint bar gives up its 34 pixels to the board, and a cramped player row drops its detail text before it will let the name run underneath the clock — a tiling compositor hands this window sizes below its own stated minimum, so the squeezed cases are real rather than theoretical.

The board side is snapped down to a multiple of 8 so squares stay pixel-crisp, and it never scrolls — the panels give way first. The board column is positioned with one anchor and an arithmetic offset rather than by swapping which vertical anchor is live; two anchors fighting is how a board ends up drawn off the top of the window.

preview.qml renders one layout at an exact size, for checking a breakpoint against its artboard without resizing anything:

cd omamate
OMAMATE_PREVIEW=440x800 quickshell -p preview.qml
OMAMATE_PREVIEW=900x800 OMAMATE_PREVIEW_OVERLAY=palette quickshell -p preview.qml

Rules

Every legal move, SAN string, FEN and result comes from chess.js. Nothing above Game.qml decides a chess question — it only asks.

The bundled chess.mjs is pinned to chess.js 1.2.0, transpiled to ES2016. Both halves matter, and the reason is Qt's V4 JavaScript engine:

  • No BigInt. chess.js 1.3 added Zobrist hashing built on BigInt literals. V4 cannot parse the file at all. 1.2.0 is the last release without it, and BigInt is not something a transpiler can lower away.
  • No class fields. Every chess.js 1.x ESM build writes color; in a class body, which V4 also rejects. esbuild's --target=es2016 lowers those into constructor assignments.

tools/build-chess.sh regenerates the bundle and documents the pin. Change it only deliberately, and re-run the tests afterwards.

Tests

omamate/tests/run.sh
  • perft counts leaf nodes from four known positions against published values. Matching them is what proves castling, en passant, promotion and pin detection are right in the exact bundle the app ships — playing a few games proves nothing.
  • selfplay drives engine/omamate-engine over UCI the way the app does and plays a whole game with it on both sides, asserting every bestmove is legal in the position it was handed.
  • strength checks the engine finds a forced mate at every level. The mates are not hard-coded answers — they are derived from the position with chess.js, so a bad FEN reports itself instead of silently passing.
  • geometry checks the square/point mapping that drag-and-drop depends on: all 64 squares in both orientations, the pixel on either side of every boundary, and cursor stepping. It is the part that is easy to get subtly wrong — a rank read upside down drops the piece one square off, and the game accepts it as perfectly legal.

Documentation

  • CONTRIBUTING.md — running it, the preview harness, the generated-artifact scripts, and the one gotcha (qmldir) that will otherwise cost you an afternoon.
  • docs/ARCHITECTURE.md — where the boundaries are and why they are there.
  • CHANGELOG.md — what is in this release, and what is knowingly missing from it.

Layout of the source

bin/omamate              launcher
omamate/shell.qml        session state, game flow, keyboard, overlays
omamate/PlayScreen.qml   board and panes; reads its own width for breakpoints
omamate/Game.qml         the only thing that talks to chess.js
omamate/Engine.qml       UCI client
omamate/Board.qml        squares, drag-and-drop, the move animation
omamate/geometry.mjs     square <-> point mapping, tested outside QML
omamate/Theme.qml        Omarchy theme -> colours, live
omamate/Sound.qml        the clips, and which move makes which
omamate/engine/          the launcher and the bundled engine
omamate/preview.qml      renders one breakpoint at an exact size
tools/build-chess.sh     regenerate chess.mjs
tools/make-sounds.py     regenerate the sound set

omamate/qmldir is generated — a qmldir makes its directory authoritative, so every component has to be listed in it. Run omamate/mkqmldir.sh after adding or renaming a .qml file.

Licence

omamate is MIT — see LICENSE. The bundled chess.js is BSD-2-Clause and keeps its own notice at omamate/chess.js.LICENSE. The piece glyphs and the icon come from Noto Sans Symbols 2 and the UI type from JetBrainsMono Nerd Font; both are system fonts, neither is redistributed here.

Not in this version

Online play, opening books beyond naming, analysis of a finished game, configurable keys, and human-versus-human. The end-of-game card reports only what omamate measured — how often your move was the reply the engine expected, and how long you took — rather than an accuracy score it did not compute.

About

Chess for Omarchy — a keyboard-first, theme-following one-player chess workspace built on Quickshell, with a bundled UCI engine

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages