Skip to content

Commit

Permalink
grimblast: only allow one instance
Browse files Browse the repository at this point in the history
Co-authored-by: Tomo <[email protected]>
  • Loading branch information
fufexan and DHDcc committed Aug 2, 2024
1 parent 65d42dc commit 50e1dcb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 2024-08-02

grimblast: changed method to check if another instance is running

### 2024-07-10

grimblast: recognize windows of special workspaces
Expand All @@ -26,15 +30,16 @@ grimblast: use fadeLayers to prevent visible borders

### 2024-03-18

scratchpad: Fixed -m command. Now it kills the preprocess of menu before starting it.
scratchpad: Fixed -m command. Now it kills the preprocess of menu before
starting it.

### 2024-03-13

scratchpad: allow supplying command flags in any order

### 2024-03-02

hdrop: 0.4.4 -> 0.5.0
hdrop: 0.4.4 -> 0.5.0\
Add --floating and associated options

### 2024-01-25
Expand All @@ -43,14 +48,14 @@ grimblast: fixed border still visible when taking screenshot of an area

### 2024-01-19

hdrop: -> 0.4.4
hdrop: -> 0.4.4\
Fix --class quoting

### 2024-01-14

hdrop: 0.3.0 -> 0.4.0
Add `-c | --class`
Improve Documentation
hdrop: 0.3.0 -> 0.4.0\
Add `-c | --class`\
Improve Documentation\
Refactor

### 2024-01-11
Expand Down
12 changes: 12 additions & 0 deletions grimblast/grimblast
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
## hyprctl equivalents.
## https://github.com/swaywm/sway/blob/master/contrib/grimshot

# Check whether another instance is running


grimblastInstanceCheck="${XDG_RUNTIME_DIR:-$XDG_CACHE_DIR:-$HOME/.cache}/grimblast.lock"
if [ -e "$grimblastInstanceCheck" ]; then
exit 2
else
touch "$grimblastInstanceCheck"
fi
trap "rm -f '$grimblastInstanceCheck'" EXIT


getTargetDirectory() {
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" &&
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
Expand Down
5 changes: 5 additions & 0 deletions grimblast/grimblast.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ bind = SUPER ALT, p, exec, grimblast save output
bind = SUPER CTRL, p, exec, grimblast save screen
```

# EXIT CODES

0 - Normal exit++
2 - Another instance of grimblast is running

# SEE ALSO

*grim*(1)
Expand Down

0 comments on commit 50e1dcb

Please sign in to comment.