-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
67 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
# DESCRIPTION: | ||
# * make and save a screenshot | ||
# * [optionally] copy to clipboard | ||
# * [optionally] optimize it | ||
# * [optionally] OCR it | ||
# | ||
# ARGUMENTS: | ||
# * mode: full|selected|focused | ||
# | ||
# ENVIRONMENT VARIABLES: | ||
# * SCREENSHOT_DOCKER_HOST: set to prefer using docker for image optimization | ||
# Examples: `unix:///var/run/docker.sock` for local execution | ||
# `ssh://[email protected]` for remote | ||
# | ||
# DEPENDENCIES: | ||
# * Interpreter: POSIX shell + coreutils | ||
# * Screenshot tool: maim + xdotool | scrot | graphicsmagick + xdotool | imagemagick + xdotool | ||
# * Clipboard tool [opt]: xclip | xsel | ||
# * Image lossless optimizer [opt]: optipng | pngcrush | jpegoptim | ||
# * OCR tool [opt]: tesseract + tesseract-ocr-rus | ||
# * Locks manager [opt]: flock | ||
# | ||
|
||
|
||
set -o errexit # exit on fail | ||
set -o nounset # exit on undeclared variable | ||
# set -o xtrace # trace execution | ||
|
||
|
||
selected_option=$( | ||
printf '%s\n' "QR Code" "B" | | ||
rofi -dmenu | ||
) | ||
|
||
case ${selected_option} in | ||
"QR Code") | ||
# Get file path from primary X buffer (middle mouse click to paste) | ||
# and decode the QR code | ||
zbarimg --quiet -- "$(xclip -selection primary -out)" | | ||
# Drop the `QR-Code:` prefix. Also drop the newline | ||
sed 's/^QR\-Code:\(.*\)$/\1/' |tr -d '\n' | | ||
# Paste the result to clipboard (Ctrl+V to paste) | ||
xclip -in -selection clipboard -filter | ||
;; | ||
"B") | ||
echo "You chose B!" | ||
;; | ||
*) | ||
echo "Invalid selection" | ||
exit 1 | ||
;; | ||
esac |