Created
August 11, 2023 22:44
-
-
Save louipc/9372edff97893581708046ffed8050fb 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
| #!/bin/bash | |
| SCREEN_DIR=~/ | |
| SCREEN_PROMPT=1 | |
| FONT=-*-terminus-*-*-*-*-32-*-*-*-*-*-*-* | |
| GM="gm" | |
| window='root' | |
| case $1 in | |
| root) | |
| window='root';; | |
| active | aa) | |
| window=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d' ' -f5`;; | |
| -h | --help) | |
| echo "Specify root (default) or active (aa)" | |
| exit;; | |
| esac | |
| [ ! -z "$SCREEN_PROMPT" ] && \ | |
| name=`i3-input -f $FONT -P 'screen-name: ' | sed -n '/command = /s/command = //p'` | |
| if [ -z "$name" ];then | |
| if [ $window == "root" ];then | |
| name='root' | |
| else | |
| name=`xprop -id $window | sed -n '/WM_CLASS/s/.* = "\([^\"]*\)".*/\1\n/p'` | |
| [ -z "$name" ] && name='window' | |
| fi | |
| fi | |
| filename="$name-`date +%Y%m%d-%H%M%S`.png" | |
| $GM import -border -window $window "$SCREEN_DIR/$filename" | |
| #ln -sf "$filename" $SCREEN_DIR/last | |
| # wayland | |
| # grim -g "$(slurp)" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment