Skip to content

Instantly share code, notes, and snippets.

@oesmith
Created February 9, 2024 14:22
Show Gist options
  • Save oesmith/bae2066264b69752fe4cb18afe2515d2 to your computer and use it in GitHub Desktop.
Save oesmith/bae2066264b69752fe4cb18afe2515d2 to your computer and use it in GitHub Desktop.
Take a screenshot of the current focused window in Sway
#!/bin/bash
swaymsg -t get_tree \
| jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"' \
| grim -g - - \
| wl-copy \
&& notify-send -t 3000 "Screenshot" "Window captured"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment