Taken screenshots on SwayWM
Published:
, Updated:
Talks about:
<a class="post-tag post-tag-grim" href="/tags/grim">grim</a>, <a class="post-tag post-tag-screenshot" href="/tags/screenshot">screenshot</a>, <a class="post-tag post-tag-slurp" href="/tags/slurp">slurp</a>, and <a class="post-tag post-tag-swaywm" href="/tags/swaywm">swaywm</a>
SwayWM uses can use a mixture of grim and slurp to take screenshots of their desktop. Place the following key binding in your Sway configuration:
# take screenshot of currently focused screen
bindsym $mod+Print exec /usr/bin/grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S.png')
# take screenshot of selection
bindsym $mod+Shift+p exec /usr/bin/grim -g "$(/usr/bin/slurp)" $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S.png')