Skip to content

About

Turn selected code into a beautiful, unmistakably Omarchy image — like codesnap.dev, wearing the live Omarchy theme, coloured exactly as the editor it was snapped from shows it.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

OmaCodeSnap

Share code snaps in Omarchy style with ease.

commonIndent from lib/indent.mjs, snapped from Zed under Gruvbox

Select something, press a key, and a PNG like the one above lands on your clipboard and in ~/Pictures. The frame is your Omarchy theme and your wallpaper. No traffic lights, no logo.

You can snap text from anywhere: a terminal, a browser, a chat. If it's code, it gets syntax highlighting in the theme's colours. If you snap it from a supported editor, it's coloured exactly the way that editor is showing it right now, down to the pixel.

Supported editors

  • Zed
  • VS Code (and VSCodium, Cursor)
  • Neovim

Anything else still snaps, highlighted generically, with the language picked up from the filename or a #! line. Highlighted languages: JavaScript, TypeScript, TSX, Python, Rust, Go, C, Bash, JSON, YAML, Markdown, Ruby, Lua. Everything else renders as plain text.

Beta

OmaCodeSnap is in beta. It works end to end on real hardware, but it has had one desk's worth of testing. If you use Omarchy and post code, please try it and report what breaks.

Want your editor supported? Adding one is a single file under lib/editors/ — see CONTRIBUTING.md. Pull requests welcome; so are issues that just say which editor.

Install

omarchy plugin add https://github.com/keithrowell/omarchy-plugin-omacodesnap.git --enable

Then run its setup once, from a terminal:

~/.config/omarchy/plugins/com.keithrowell.omacodesnap/bin/install

Setup compiles the Zed grammars into the plugin's own directory, adds an app launcher entry (~/.local/share/applications/OmaCodeSnap.desktop) and, if ~/.local/bin exists, an omacodesnap command there, and checks the packages it needs. If anything other than its own entry or link is already at either of those paths, setup says so and leaves it alone. Enabling the plugin never does any of that by itself; if setup hasn't run, it shows one notification saying so. Run it again after an update.

Then add the binding to ~/.config/hypr/bindings.lua:

-- OmaCodeSnap: snap the selected code into an Omarchy-styled image.
o.bind("SUPER + ALT + SHIFT + S", "OmaCodeSnap", "~/.config/omarchy/plugins/com.keithrowell.omacodesnap/bin/omacodesnap")
o.window({ title = "^(OmaCodeSnap)$" }, { float = true, center = true })

Update with omarchy plugin update com.keithrowell.omacodesnap, then run bin/install again.

Removing

~/.config/omarchy/plugins/com.keithrowell.omacodesnap/bin/install --uninstall
omarchy plugin remove com.keithrowell.omacodesnap

--uninstall removes the launcher entry and the ~/.local/bin/omacodesnap link, and only if they point at this plugin. omarchy plugin remove then deletes the plugin directory, compiled grammars included. Delete the binding from ~/.config/hypr/bindings.lua yourself. Snaps you saved in ~/Pictures (omacodesnap-*.png) are yours and stay. Per-snap scratch files live under $XDG_RUNTIME_DIR/omacodesnap/ and are gone at logout. Your saved wrap setting, ~/.local/state/omacodesnap/settings.json (or under $XDG_STATE_HOME), stays too; delete that directory to forget it.

It needs these Arch packages, most of which Omarchy already ships. bin/install checks this exact list and names any that are missing:

quickshell wl-clipboard qt6-5compat tree-sitter-cli gcc nodejs

Using it

Select some code and press SUPER + ALT + SHIFT + S. A preview window appears in about a second.

  • Enter or Copy puts the PNG on the clipboard.
  • S or Save writes it to ~/Pictures as omacodesnap-<date>_<time>.png.
  • The language button bottom-left shows what was detected. Click it, or press Left/Right, to pick another language or plain text. The image redraws.
  • Wrap turns line wrapping on or off, and −/+ change the width (20 to 240 characters, in steps of 10; 80 to start with). Lines break between words; a hyphenated word can break after its hyphen. Whatever you pick here is remembered for the next snap.
  • Esc or Close closes it. Pressing the binding again replaces the preview with a fresh snap.

Selections are capped at 200 lines. Each snap reads the theme fresh, so switching Omarchy themes changes the next image with no restart.

How it works with editors

OmaCodeSnap never installs anything into your editor. It reads the Wayland primary selection (what you've highlighted) and asks Hyprland which window is focused. From there it depends on the editor.

Zed. OmaCodeSnap ships the same tree-sitter grammars and highlight queries Zed uses, pinned to the versions Zed pins, and colours the result from the Omarchy theme's Zed colours. Most Omarchy themes don't ship a Zed theme file, so OmaCodeSnap builds one from the theme's colors.toml.

VS Code. OmaCodeSnap runs the same TextMate tokenizer VS Code does, using the grammar from your installed VS Code (built in or from an extension), and colours it from whatever theme VS Code is actually showing. If you run Nord in VS Code, your snap is Nord. Languages with no static grammar, such as Rust and Go, fall back to the generic highlighting.

Neovim. Neovim lives in a terminal, so OmaCodeSnap finds it in the terminal's process tree and asks the running Neovim, over its RPC socket, for the current visual selection and the colours it's drawing. Nothing is re-highlighted, so plugins, colorschemes and LSP tokens all come through. This is the one editor where OmaCodeSnap takes the selection from the editor rather than from Wayland.

Neovim running inside tmux or herdr works too: OmaCodeSnap follows the multiplexer client to the pane it is showing and looks for Neovim there. A tmux server on a non-default socket (tmux -L or tmux -S) isn't found, so those snaps fall back to the Wayland selection.

Everything else. The text is highlighted with OmaCodeSnap's own Zed grammars in the theme's colours, or left plain if the language isn't recognised.

Every colour comes from ~/.local/state/omarchy/current/theme/. Nothing is hard-coded. The window frame copies your Hyprland border width, colour and corner radius, read live from hyprctl.

Gallery

Eight snippets, eight themes, every image made by OmaCodeSnap. See docs/gallery/SOURCES.md for where each piece of code came from and how to reproduce a render.

DaisyStack's realtime push, Kanagawa A realtime push demo (Ruby, from DaisyStack) — Kanagawa A bounded worker pool, Ristretto A bounded worker pool (Go) — Ristretto
sigmoid and softmax, Catppuccin sigmoid/softmax (Rust) — Catppuccin Quotes on why Ruby is beautiful, Rosé Pine Quotes on why Ruby is beautiful — plain text, no editor — Rosé Pine
Trapezoidal integration, Nord Trapezoidal integration (Fortran 77) — Nord A stack class, Everforest A stack class (Delphi) — Everforest
A VAX MACRO-32 routine, Osaka Jade A greeting routine (VAX MACRO-32, 1980s DEC minicomputer assembly) — Osaka Jade 6809 assembly, Retro 82 Clear-screen routine (6809 assembly, in the style of the Hitachi Basic Master) — Retro 82

The last four have no Zed grammar behind them; SOURCES.md explains how they were coloured.

Contributing

Bug reports, feature requests and pull requests are welcome. See CONTRIBUTING.md for the development loop and CODE_OF_CONDUCT.md for how we treat each other. The current version is the version field in manifest.json, tagged v<version> in git.

Licence

MIT (see LICENSE).

About

Turn selected code into a beautiful, unmistakably Omarchy image — like codesnap.dev, wearing the live Omarchy theme, coloured exactly as the editor it was snapped from shows it.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages