File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 123123 fi
124124 '' ) } ";
125125 "${ modifier } +shift+x" = "exec ${ ( pkgs . writeShellScript "screenshot" ''
126+ focused=$(${ pkgs . sway } /bin/swaymsg -t get_outputs | ${ pkgs . jq } /bin/jq -r '.[] | select(.focused) | .name')
126127 temp_file=$(mktemp /tmp/screenshot-XXXXXX.png)
127- ${ pkgs . grim } /bin/grim - < "$temp_file" | ${ pkgs . wl-clipboard } /bin/wl-copy
128- ${ pkgs . grim } /bin/grim $HOME/Pictures/Screenshots/screenshot-$(date +%Y%m%d%H%M%S).png
128+ ${ pkgs . grim } /bin/grim -o "$focused" - < "$temp_file" | ${ pkgs . wl-clipboard } /bin/wl-copy
129+ ${ pkgs . grim } /bin/grim -o "$focused" $HOME/Pictures/Screenshots/screenshot-$(date +%Y%m%d%H%M%S).png
129130 '' ) } ";
130131 "${ modifier } +x" = "exec ${ ( pkgs . writeShellScript "screenshot-select" ''
132+ focused=$(${ pkgs . sway } /bin/swaymsg -t get_outputs | ${ pkgs . jq } /bin/jq -r '.[] | select(.focused) | .name')
131133 temp_file=$(mktemp /tmp/screenshot-XXXXXX.png)
132- ${ pkgs . grim } /bin/grim "$temp_file"
134+ ${ pkgs . grim } /bin/grim -o "$focused" "$temp_file"
133135 ${ pkgs . imv } /bin/imv -f "$temp_file" &
134136 imv_pid=$!
135137 sleep 0.1
136- region=$(${ pkgs . slurp } /bin/slurp)
138+ region=$(${ pkgs . slurp } /bin/slurp -o "$focused" )
137139 if [ -n "$region" ]; then
138140 ${ pkgs . grim } /bin/grim -g "$region" - < "$temp_file" | ${ pkgs . wl-clipboard } /bin/wl-copy
139141 ${ pkgs . grim } /bin/grim -g "$region" $HOME/Pictures/Screenshots/screenshot-$(date +%Y%m%d%H%M%S).png
You can’t perform that action at this time.
0 commit comments