730c56ed35
Take screenshots in any x11 UI by depressing the camera key while keeping the proximity sensor covered This is a variation of [1] and [2] from postmarketOS/pmaports!4133. [1] https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4133/diffs?commit_id=35007eaefd0e471634c74aad9294234ceed260ae [2] https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4133/diffs?commit_id=0ef9ffe3928313b7afc5ce68ad0ec4487f1f2f11 Co-Authored-By: DvaMishkiLapa <thesame.personal@gmail.com> Signed-off-By: Sicelo A. Mhlongo <absicsz@gmail.com>
12 lines
530 B
Bash
12 lines
530 B
Bash
#!/bin/sh
|
|
# Take a screenshot if the proximity sensor is covered.
|
|
# NB: pass the user's username in USER_USER environment variable when calling
|
|
# this script.
|
|
/usr/bin/evtest --query /dev/input/by-path/platform-gpio_keys-event \
|
|
EV_SW SW_FRONT_PROXIMITY
|
|
# return value of `10` means the sensor is in the set state, i.e.
|
|
# proximity = near. see `man 1 evtest`
|
|
if [ "$?" = "10" ]; then
|
|
su "$USER_USER" -c "/bin/mkdir -p ~/Screenshots"
|
|
su "$USER_USER" -c 'cd ~/Screenshots && DISPLAY=:0 /usr/bin/scrot "%Y-%m-%d_%H-%M-%S.png"'
|
|
fi
|