#!/bin/sh # Get focused output output="$(mmsg get all-monitors | jq -r '.monitors[] | select(.active == true) | .name')" case $1 in selected-region) # Take a screenshot of the selected region grim -t jpeg -g "$(slurp)" ~/Pictures/Screenshots/"$(date +%Y-%m-%d_%H-%m-%s)".jpg ;; save-to-clipboard) # Take a screenshot and save it to the clipboard grim -g "$(slurp -d)" - | wl-copy ;; focused-window) # Take a screenshot of the focused window geometry=$(mmsg get focusing-client | jq -r '"\(.x),\(.y) \(.width)x\(.height)"') grim -g "$geometry" -t jpeg ~/Pictures/Screenshots/"$(date +%Y-%m-%d_%H-%m-%s)".jpg ;; *) # Take a screenshot of the currently focused output and save it into screenshots grim -o "$output" -t jpeg ~/Pictures/Screenshots/"$(date +%Y-%m-%d_%H-%m-%s)".jpg ;; esac