configs/desktop/bin/print-window.sh
2023-10-09 17:55:47 -03:00

10 lines
392 B
Bash
Executable File

#!/bin/bash
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
maim -i $(xdotool getactivewindow) | xclip -sel clip -t image/png
fi
if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" ~/tmp/jabuxas.png
xclip -sel clip ~/tmp/jabuxas.png
wl-copy < ~/tmp/jabuxas.png
fi