fn3x/sneemok
[mirror] D-bus wl-roots based screenshot tool written in Zig
v0.4.0.tar.gzv0.19.3.tar.gzWayland screenshot annotation tool in Zig.
The main repository is on codeberg, which is where the issue tracker may be found and where contributions are accepted.
Read-only mirrors exist on github.
wget https://codeberg.org/fn3x/sneemok/raw/branch/main/scripts/install.sh
chmod +x install.sh
./install.sh
yay -S sneemok
# or
yay -S sneemok-git
In your Home Manager configuration:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
sneemok.url = "git+https://codeberg.org/fn3x/sneemok.git";
};
outputs = { nixpkgs, home-manager, sneemok, ... }: {
homeConfigurations.youruser = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
sneemok.homeManagerModules.default
{
services.sneemok = {
enable = true;
};
}
];
};
};
}
Then rebuild:
home-manager switch --flake .#youruser
In your NixOS configuration:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
sneemok.url = "git+https://codeberg.org/fn3x/sneemok.git";
};
outputs = { nixpkgs, sneemok, ... }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
sneemok.nixosModules.default
{
services.sneemok = {
enable = true;
};
}
];
};
};
}
Then rebuild:
sudo nixos-rebuild switch --flake .#yourhostname
systemctl --user start sneemok
systemctl --user stop sneemok
systemctl --user status sneemok
systemctl --user restart sneemok
View logs:
journalctl --user -u sneemok -f
Once the service is running:
# Trigger a screenshot
sneemok --screenshot
# Or just
sneemok
Add to your compositor config (e.g., Hyprland):
bind = $mainMod, P, exec, sneemok
bind = $mainMod SHIFT, P, exec, sneemok --screenshot
Or in sway:
bindsym $mod+p exec sneemok
bindsym $mod+Shift+p exec sneemok --screenshot
Service won't start:
# Check logs
journalctl --user -u sneemok -n 50
# Check if D-Bus session bus is available
echo $DBUS_SESSION_BUS_ADDRESS
# Check if compositor is running
echo $WAYLAND_DISPLAY
Screenshots not triggering:
# Test D-Bus connection manually
dbus-send --session --print-reply \
--dest=org.sneemok.Service \
/org/sneemok/service \
org.sneemok.Service.Screenshot
Service keeps restarting:
# Check what's failing
systemctl --user status sneemok
journalctl --user -u sneemok -f
Common issues:
Manually:
systemctl --user disable --now sneemok
Home Manager:
services.sneemok.enable = false;
NixOS:
services.sneemok.enable = false;
With Nix:
nix build
Without Nix:
zig build
s - Selection toola - Arrowr - Rectangle c - Circlel - LineCtrl+C - Copy to clipboardESC - Change current tool to selection or exitMouse wheel up - Increase thickness of the current toolMouse wheel down - Decrease thickness of the current toolsrc/
├── main.zig # Events, signals and threading of the D-Bus handler
├── state.zig # Application state
├── wayland.zig # Wayland-related objects
├── dbus.zig # Dbus struct with connection initialization, requesting and parsing screenshot from portal
├── output.zig # Rendering
├── canvas/ # Image + elements
└── tools/ # Selection + drawing tools
Rendering: Screenshot → Overlay → Selection → Elements → Tool UI
Format: BGRA internally, RGBA PNG export
Clipboard: Native Wayland
MIT