grimblast: only allow one instance
Description of changes
Allow only one instance of grimblast to be active at a time. Fixes #112
Things done
-
For new programs
- [ ] Add the program to the README table, with yourself as the maintainer
- [ ] Add a README for the program itself
- [ ] Add Makefile (and Nix derivation optionally, otherwise @fufexan will do it)
- [ ] If the program is a script, add it to the CI checks matrix
-
For changes
- [x] Add changes to the CHANGELOG
@DHDcc can you test this?
@fufexan it works IF I don't spam my keybind:
No spaming: https://github.com/user-attachments/assets/ad69f75a-9d44-4c5d-ace3-ffff9a93f179
Spaming: https://github.com/user-attachments/assets/9d0e3d44-38ff-41e9-9197-4a531beb1246
Insted of having 10+ instances, I have 2 instances max (if I spam my keybind)
Looks like I can't make grimblast only allow one instance of itself to be running from within itself. I've tried using lockfiles, but that doesn't work either. And pgrep seems too slow to be useful when called from within the script.
However, I have these binds in my hyprland config which work exceptionally well, even when spamming the key:
bind=, Print, exec, pgrep grimblast || grimblast --notify copysave area
bind=CTRL, Print, exec, pgrep grimblast || grimblast --notify --cursor copysave output
bind=ALT, Print, exec, pgrep grimblast || grimblast --notify --cursor copysave screen