Skip to content

Conversation

@rualss
Copy link

@rualss rualss commented Dec 20, 2025

feat: add daemon mode for faster startup

  Add daemon mode that keeps GTK4 initialized between screenshot
  annotation calls, reducing window creation time from ~250ms to ~25ms.

  Features:
  - `--daemon` flag to start background daemon
  - `--show` flag to send images to running daemon
  - Per-window configuration to avoid race conditions
  - Signal handling (SIGTERM/SIGINT) for graceful shutdown
  - Unix socket IPC with length-prefixed JSON protocol
  - Security: socket permissions 0600, path validation

  Usage:
    satty --daemon &
    satty --show -f /tmp/screenshot.png --fullscreen

      Add daemon mode that keeps GTK4 initialized between screenshot
      annotation calls, reducing window creation time from ~250ms to ~25ms.

      Features:
      - `--daemon` flag to start background daemon
      - `--show` flag to send images to running daemon
      - Per-window configuration to avoid race conditions
      - Signal handling (SIGTERM/SIGINT) for graceful shutdown
      - Unix socket IPC with length-prefixed JSON protocol
      - Security: socket permissions 0600, path validation

      Usage:
        satty --daemon &
        satty --show -f /tmp/screenshot.png --fullscreen
@RobertMueller2
Copy link
Member

Thank you for picking this up. We'll review the PR when we get a chance, might be in the new year though.

@rualss
Copy link
Author

rualss commented Dec 20, 2025

No problem at all. I did it because i was irritated with latency on my pc, now satty shows up instantly after taking screenshots of small areas, and i have a latency around 0.3s when i screenshot my both monitors, and i have a 4k monitor with 1.5 scaling and full hd monitor.

@RobertMueller2
Copy link
Member

Thank you for your patience. This is a comprehensive PR so it'll definitely take us a bit longer to review this. Sorry :)

If anyone else (who isn't a maintainer) feels like helping out with a review and test, by all means, please go ahead :)

Just a small thing I thought about at this stage: should we perhaps try something like SATTY_SOCK first before defaulting to the one in this PR? That way, users could decide how to deal with the daemon in e.g. a nested wayland session.

@RobertMueller2
Copy link
Member

I've looked through most of it and I'm ok with what I've seen so far. I still need to figure out and test daemon wide vs instance specific configs, that might require a bit more time.

I'm sticking with my remark regarding SATTY_SOCK above. The only thing I'd like to add right now is to use newer version of nix before we merge, but that seems entirely unproblematic.

And finally, just as a heads-up, #376 may clash regarding config use, but maybe I haven't fully understood this yet 😉

@rualss
Copy link
Author

rualss commented Jan 3, 2026

Yea, i think it's better to have some way to control the way daemon works with sockets. Also i think it's a good idea to add some random hash to the name of the default socket file to avoid collisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants