From 823ad95477b0c0a1f419e9271d838486c411091c Mon Sep 17 00:00:00 2001 From: noneofyourbusiness Date: Sun, 6 Jun 2021 20:45:15 +0200 Subject: [PATCH] add scrot script & add scrot to appmenu Signed-off-by: Maarten van Gompel --- scripts/appscripts/sxmo_screenshot.sh | 9 +++++++++ scripts/core/sxmo_appmenu.sh | 3 +++ 2 files changed, 12 insertions(+) create mode 100755 scripts/appscripts/sxmo_screenshot.sh diff --git a/scripts/appscripts/sxmo_screenshot.sh b/scripts/appscripts/sxmo_screenshot.sh new file mode 100755 index 0000000..4fc4679 --- /dev/null +++ b/scripts/appscripts/sxmo_screenshot.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh +# scrot refuses to work with double quotes +# shellcheck disable=SC2016 + +if [ "$1" = "selection" ]; then + notify-send "select an area" && scrot -e 'echo $f | xsel -i -b' -d 1 -s -q 1 && notify-send "screenshot saved, filename copied to clipboard" +else + scrot -e 'echo $f | xsel -i -b' -d 1 -q 1 && notify-send "screenshot saved, filename copied to clipboard" +fi diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 3221c8c..4b7d1b5 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -24,10 +24,13 @@ programchoicesinit() { case "$WMCLASS" in scripts ) # Scripts menu + # shellcheck disable=SC2015 CHOICES=" $icon_mic Record ^ 0 ^ sxmo_record.sh $icon_red Reddit ^ 0 ^ sxmo_reddit.sh $icon_rss RSS ^ 0 ^ sxmo_rss.sh + $(command -v scrot >/dev/null && echo $icon_cam Screenshot ^ 0 ^ sxmo_screenshot.sh || notify-send failed to take a screenshot) + $(command -v scrot >/dev/null && echo $icon_cam Screenshot \(selection\) ^ 0 ^ sxmo_screenshot.sh selection || notify-send failed to take a screenshot) $icon_tmr Timer ^ 0 ^ sxmo_timer.sh $icon_ytb Youtube ^ 0 ^ sxmo_youtube.sh video $icon_ytb Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio