Add screenshot scripts

This commit is contained in:
Victor Timofei 2023-06-09 15:29:19 +03:00
parent 401333b4ed
commit 09ebca65f8
Signed by: vtimofei
GPG Key ID: B790DCEBE281403A
4 changed files with 46 additions and 0 deletions

11
screenshot Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
area="${1}"
output="${HOME}/Pictures/screenshots/$(date +'%Y%m%d%H%M%S').jpeg"
grim -g "${area}" \
-t jpeg \
-q 100 \
- > "${output}"
notify-send "Screenshot saved to ${output}"

14
screenshot-monitor Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
active_monitor="$(hyprctl activeworkspace -j | jq '.monitor' | sed 's/\"//g')"
jq_filter=".[] | select(.name == \"${active_monitor}\")"
active_monitor_json=$(hyprctl monitors -j | jq "${jq_filter}")
x=$(echo "${active_monitor_json}" | jq '.x')
y=$(echo "${active_monitor_json}" | jq '.y')
width=$(echo "${active_monitor_json}" | jq '.width')
height=$(echo "${active_monitor_json}" | jq '.height')
/home/vtimofei/scripts/screenshot "${x},${y} ${width}x${height}"

10
screenshot-select Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
area="$(slurp)"
err_code=$?
if [ $err_code -ne 0 ]; then
exit 1
fi
/home/vtimofei/scripts/screenshot "${area}"

11
screenshot-window Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
activewindow_json="$(hyprctl activewindow -j)"
x=$(echo "${activewindow_json}" | jq '.at[0]')
y=$(echo "${activewindow_json}" | jq '.at[1]')
width=$(echo "${activewindow_json}" | jq '.size[0]')
height=$(echo "${activewindow_json}" | jq '.size[1]')
/home/vtimofei/scripts/screenshot "${x},${y} ${width}x${height}"