about summary refs log tree commit diff
path: root/.local/bin/take-slurpshot
blob: f30fabe0957b4538a022e6c6fac2f3c7656628ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

# Generate base filename with timestamp
base_filename=$(date +"%m-%d-%Y_%H-%M-%S")
extension=".png"

# Initialize full filename
filename="${base_filename}${extension}"
counter=1

# Check if file exists and append incremental suffix if needed
while [[ -e "$filename" ]]; do
    filename="${base_filename}-${counter}${extension}"
    ((counter++))
done

# Output the available filename
grim -g "$(slurp)" "$HOME/Pictures/Screenshots/$filename"