Last active
March 25, 2024 12:40
-
-
Save KargJonas/62fe078683f99421360159db47f2902e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### all of these bind the "print" key to take screenshots with slection area using scrot | |
| # use datetime as filename | |
| bindsym --release Print exec --no-startup-id scrot $HOME/Pictures/Screenshots/`date +%Y-%m-%d_%H:%M:%S`.png --select | |
| # ask for filename using dmenu and fall back to datetime if no name provided | |
| bindsym --release Print exec --no-startup-id $HOME/bin/take_screenshot.sh $HOME/Pictures/Screenshots | |
| ### take_screenshot.sh | |
| #!/bin/bash | |
| if [ -z $1 ]; then | |
| exit 1 | |
| fi | |
| # preliminary filename from datetime | |
| filename="$1/$(date +%Y-%m-%d_%H:%M:%S).png" | |
| # take screenshot | |
| scrot $filename --select | |
| # ask use for custom filename | |
| custom_filename="$1/$(dmenu -p 'Enter file name (optional):').png" | |
| # rename file to custom name if user entered something | |
| if [ -n "$custom_filename" ]; then | |
| echo "test" >> /home/jonas/Pictures/Screenshots/test.txt | |
| mv $filename $custom_filename | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment