dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.local/bin/pantallazo

27 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
file=$HOME/img/scrot/"$(date +%F_%H_%M)".png
vent=$(bspc query -N -n .focused)
icon="$XDG_DATA_HOME/icons/Haiku/scalable/apps/applets-screenshooter.svg"
notify() {
notify-send -i "$icon" "Pantalla Capturada"
}
case "$(printf "Seleccion\\nVentana\\nPantalla\\nCopiar seleccion\\nCopiar ventana\\nCopiar pantalla" | rofi -dmenu -p " ")" in
"Seleccion") maim -us "$file" ;;
"Ventana") maim -ui "$(printf "%d\n" $vent)" "$file" ;;
"Pantalla")
conectados=$(xrandr | awk '( $2 == "connected" ) { count++ } END { print count }')
if [ "$conectados" = 1 ]; then
maim -u "$file"
elif [ "$conectados" = 2 ]; then
moni="$(xrandr | awk '( $2 == "connected" ) { print $1 }' | rofi -dmenu -p "Pantalla")"
maim -u "$moni" "$file"
fi
;;
"Copiar seleccion") maim -us | xclip -selection clipboard -t image/png && notify ;;
"Copiar ventana") maim -ui "$(printf "%d\n" "$vent")" | xclip -selection clipboard -t image/png && notify ;;
"Copiar pantalla") maim -u | xclip -selection clipboard -t image/png && notify ;;
esac