feat: add daemon mode for faster startup …#358
feat: add daemon mode for faster startup …#358rualss wants to merge 4 commits intoSatty-org:mainfrom
Conversation
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
2f6fc4c to
fa6c8ad
Compare
|
Thank you for picking this up. We'll review the PR when we get a chance, might be in the new year though. |
|
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. |
|
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 |
|
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 And finally, just as a heads-up, #376 may clash regarding config use, but maybe I haven't fully understood this yet 😉 |
|
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. |
|
Sorry for the delay in response. I'm going to add a few inline remarks. Can't promise these are going to be the last, it's tricky to find enough time to review this properly. Overall, I have these remarks:
Lastly, I have a question. GTK itself has a mode where new instances of an app communicate to an existing instance via DBus, this could in principle also be suitable for a daemon mode. There may be additional challenges with this, and perhaps the dependency on working DBus itself for the daemon mode is something we wouldn't want at all. But out of curiosity, have you considered it, and if so, why have you decided against it? |
feat: add daemon mode for faster startup