image_ss.sh: update to 0.5

Se modifica nombre de variables de mayúscula a minúsculas y cambio de tamaño y font de la notificación
This commit is contained in:
Tuxliban Torvalds 2023-09-21 01:03:41 -06:00
parent 857918d4a6
commit 27473013d6
1 changed files with 17 additions and 16 deletions

View File

@ -1,14 +1,15 @@
#!/bin/sh
# v0.3
#
# v0.5 - 19/09/2023
# Dependencias:ImageMagick, xclip, dzen2, xdotool
#
# Shell: POSIX compliant
# Autor: O. Sánchez <o-sanchez@linuxmail.org>
# Autor: O. Sánchez <o-sanchez@linuxmail.org> 2023
script="${0##*/}"
DIR="$HOME"/Datos/Capturas
DATE="$(date +%Y%m%d-%H%M%S)"
_dir="$HOME"/Datos/Capturas
_date="$(date +%Y%m%d-%H%M%S)"
admin() {
@ -19,20 +20,20 @@ admin() {
fi
}
SUDO=$(admin)
_sudo=$(admin)
if ! command -v import > /dev/null; then
printf '%b' "\033[31;5m[ERROR] Dependencias no satisfecha. Instalando ImageMagick...\033[0m\n"
"$SUDO" xbps-install -y ImageMagick
"$_sudo" xbps-install -y ImageMagick
elif ! command -v xclip > /dev/null; then
printf '%b' "\033[31;5m[ERROR] Dependencias no satisfecha. Instalando xclip...\033[0m\n"
"$SUDO" xbps-install -y xclip
"$_sudo" xbps-install -y xclip
elif ! command -v dzen2 > /dev/null; then
printf '%b' "\033[31;5m[ERROR] Dependencias no satisfecha. Instalando dzen2...\033[0m\n"
"$SUDO" xbps-install -y dzen2
"$_sudo" xbps-install -y dzen2
elif ! command -v xdotool > /dev/null; then
printf '%b' "\033[31;5m[ERROR] Dependencias no satisfecha. Instalando xdotool...\033[0m\n"
"$SUDO" xbps-install -y xdotool
"$_sudo" xbps-install -y xdotool
fi
ayuda() {
@ -53,7 +54,7 @@ Modo de uso:
}
msg() {
dzen2 -p 8 -e 'onstart=uncollapse' -fn 'JetBrains Mono:size=8:style=bold' -ta 5 \
dzen2 -p 8 -e 'onstart=uncollapse' -fn 'Inconsolata:size=10:style=bold' -ta 5 \
-sa c -w 260 -x 1100 -y 25 -l 1
}
@ -68,20 +69,20 @@ case "$1" in
import -window "$(xdotool getwindowfocus)" png:- | xclip -t 'image/png' -selection 'clipboard' -i
;;
-g)
[ ! -d "$DIR" ] && mkdir "$DIR"
import -format png -window root "$DIR/$DATE.png"
[ ! -d "$_dir" ] && mkdir "$_dir"
import -format png -window root "$_dir/$_date.png"
"$HOME"/.local/bin/dunst_sound
printf '%s\n' "CAPTURA DE PANTALLA" "Guardando en: ~/Datos/Capturas" | msg
;;
-S)
[ ! -d "$DIR/Select" ] && mkdir -p "$DIR/Select"
sleep 1 && import -format png "$DIR/Select/select-$DATE.png"
[ ! -d "$_dir/Select" ] && mkdir -p "$_dir/Select"
sleep 1 && import -format png "$_dir/Select/select-$_date.png"
"$HOME"/.local/bin/dunst_sound
printf '%s\n' "ÁREA SELECCIONADA" "Guardando en: ~/Datos/Capturas/select" | msg
;;
-F)
[ ! -d "$DIR/Select" ] && mkdir -p "$DIR/Select"
import -window "$(xdotool getwindowfocus)" -format png "$DIR/Select/window-$DATE.png"
[ ! -d "$_dir/Select" ] && mkdir -p "$_dir/Select"
import -window "$(xdotool getwindowfocus)" -format png "$_dir/Select/window-$_date.png"
;;
--help|-h|*)
ayuda