dotfiles-pub/linux/.local/bin/screenie

39 lines
1.3 KiB
Text
Raw Permalink Normal View History

2022-04-04 03:46:58 +00:00
#!/bin/bash
# screenie - capture a screenshot and use elixiremanager to send to
# elixi.re. uses flameshot as a drop-in replacement for kshare's "editing
# before sending" mechanic
# based off lynnesbian's sshotr.sh,
# https://gist.github.com/Lynnesbian/203e2a90a312cd02880f8e5762c01797
# this:
# - uses ~/Screenshots as a folder to store them all
# - requires notify-send, elixiremanager.sh requires it as well, so.
# - uses flameshot, more @ https://github.com/lupoDharkael/flameshot
# - On latest versions of flameshot, the Return key has been changed. You
# want to set the return key to copy image, rather than upload to imgur.
# - NOTE: press enter after doing a screenshot, instead of saving, for all
# of this to work
# change this if wanted
screenshot_folder="$HOME/Screenshots"
# set this to the path for elixiremanager.sh
elixiremanager="$HOME/.local/bin/elixiremanager.sh"
mkdir -p "$screenshot_folder"
date_str=$(date +'%Y-%m-%d-%H_%M_%S')
target="$screenshot_folder/screenie-$date_str.png"
2022-11-08 16:36:46 +00:00
flameshot gui -r > "$target"
2022-04-04 03:46:58 +00:00
2022-11-08 16:36:46 +00:00
if [ ! -s "$target" ]; then
notify-send "screenshot aborted, skipping sending"
2022-04-04 03:46:58 +00:00
else
2022-11-08 16:36:46 +00:00
aplay "$HOME/.local/bin/assets/capture.wav" &
2022-04-04 03:46:58 +00:00
notify-send -t 5000 "screenie: sending: $target"
source ~/.secrets
$elixiremanager "$target"
fi