#!/bin/sh file="$HOME/img/scrot/$(date +%F_%H_%M).png" vent=$(bspc query -N -n .focused) icon="$XDG_DATA_HOME/icons/BeOS/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 "Captura de")" in "Seleccion") maim -us "$file" && notify ;; "Ventana") maim -ui "$(printf "%d\n" "$vent")" "$file" && notify ;; "Pantalla") conectados=$(xrandr | awk '( $2 == "connected" ) { count++ } END { print count }') if [ "$conectados" = 1 ]; then maim -u "$file" && notify elif [ "$conectados" = 2 ]; then moni="$(xrandr | awk '( $2 == "connected" ) { print $1 }' | rofi -dmenu -p "Pantalla")" maim -u "$file" "$moni" && notify 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