updated screenshot tools
This commit is contained in:
@@ -3,17 +3,19 @@
|
|||||||
### ~/.config/hypr/scripts/screenshot/screenshot_area.sh
|
### ~/.config/hypr/scripts/screenshot/screenshot_area.sh
|
||||||
###
|
###
|
||||||
|
|
||||||
time=$(date +%Y-%m-%d-%I-%M-%S)
|
time=$(date +%Y-%m-%d-%H%M%S)
|
||||||
geometry=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | "\(.width)x\(.height)"')
|
|
||||||
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
||||||
file="Screenshot_${time}_${geometry}.png"
|
file="Screenshot_${time}.png"
|
||||||
|
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
||||||
# Take screenshot of selected region using hyprshot
|
# Select a region with slurp; exit silently if cancelled (ESC/right-click)
|
||||||
hyprshot -m region -o "$dir" -f "$file"
|
geometry=$(slurp) || exit 1
|
||||||
|
|
||||||
# Optional: open in swappy for annotation (since hyprshot doesn't pipe to swappy directly)
|
# Capture region, save it and copy to clipboard
|
||||||
# if command -v swappy >/dev/null 2>&1; then
|
grim -g "$geometry" "$dir/$file" || exit 1
|
||||||
# swappy -f "$dir/$file"
|
wl-copy -t image/png < "$dir/$file"
|
||||||
# fi
|
|
||||||
|
if command -v notify-send >/dev/null 2>&1; then
|
||||||
|
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
###
|
###
|
||||||
### ~/.config/hypr/scripts/screenshot/screenshot_area.sh
|
### ~/.config/hypr/scripts/screenshot/screenshot_area_2.sh
|
||||||
###
|
###
|
||||||
|
|
||||||
time=$(date +%Y-%m-%d-%I-%M-%S)
|
# Select a region with slurp; exit silently if cancelled (ESC/right-click)
|
||||||
geometry=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | "\(.width)x\(.height)"')
|
geometry=$(slurp) || exit 1
|
||||||
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
|
||||||
file="Screenshot_${time}_${geometry}.png"
|
|
||||||
|
|
||||||
mkdir -p "$dir"
|
# Capture region and copy to clipboard only
|
||||||
|
grim -g "$geometry" - | wl-copy -t image/png
|
||||||
|
|
||||||
# Take screenshot of selected region using hyprshot
|
if command -v notify-send >/dev/null 2>&1; then
|
||||||
hyprshot -m region -o "$dir" -f "$file" --clipboard-only
|
notify-send -a Screenshot -i camera-photo "Screenshot copied to clipboard"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -3,17 +3,20 @@
|
|||||||
### ~/.config/hypr/scripts/screenshot/screenshot_monitor.sh
|
### ~/.config/hypr/scripts/screenshot/screenshot_monitor.sh
|
||||||
###
|
###
|
||||||
|
|
||||||
time=$(date +%Y-%m-%d-%I-%M-%S)
|
time=$(date +%Y-%m-%d-%H%M%S)
|
||||||
geometry=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | "\(.width)x\(.height)"')
|
|
||||||
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
||||||
file="Screenshot_${time}_${geometry}.png"
|
|
||||||
|
monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')
|
||||||
|
[ -n "$monitor" ] || exit 1
|
||||||
|
|
||||||
|
file="Screenshot_${time}_${monitor}.png"
|
||||||
|
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
||||||
# Take screenshot of selected region using hyprshot
|
# Capture the focused monitor, save it and copy to clipboard
|
||||||
hyprshot -m output -o "$dir" -f "$file"
|
grim -o "$monitor" "$dir/$file" || exit 1
|
||||||
|
wl-copy -t image/png < "$dir/$file"
|
||||||
|
|
||||||
# Optional: open in swappy for annotation (since hyprshot doesn't pipe to swappy directly)
|
if command -v notify-send >/dev/null 2>&1; then
|
||||||
# if command -v swappy >/dev/null 2>&1; then
|
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
||||||
# swappy -f "$dir/$file"
|
fi
|
||||||
# fi
|
|
||||||
|
|||||||
@@ -3,17 +3,39 @@
|
|||||||
### ~/.config/hypr/scripts/screenshot/screenshot_window.sh
|
### ~/.config/hypr/scripts/screenshot/screenshot_window.sh
|
||||||
###
|
###
|
||||||
|
|
||||||
time=$(date +%Y-%m-%d-%I-%M-%S)
|
time=$(date +%Y-%m-%d-%H%M%S)
|
||||||
geometry=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | "\(.width)x\(.height)"')
|
|
||||||
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
||||||
file="Screenshot_${time}_${geometry}.png"
|
file="Screenshot_${time}.png"
|
||||||
|
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
||||||
# Take screenshot of selected region using hyprshot
|
# Build selection boxes for windows on visible workspaces
|
||||||
hyprshot -m window -o "$dir" -f "$file"
|
ids=$(hyprctl monitors -j | jq -c '[.[].activeWorkspace.id]')
|
||||||
|
boxes=$(hyprctl clients -j | jq -r --argjson ids "$ids" '
|
||||||
|
[.[] | select(.workspace.id | IN($ids[]))] | .[] |
|
||||||
|
"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1]) \(.title)"
|
||||||
|
' | cut -d' ' -f1,2)
|
||||||
|
|
||||||
# Optional: open in swappy for annotation (since hyprshot doesn't pipe to swappy directly)
|
# Let the user pick a window (click the box); exit silently if cancelled
|
||||||
# if command -v swappy >/dev/null 2>&1; then
|
geometry=$(slurp -r <<< "$boxes") || exit 1
|
||||||
# swappy -f "$dir/$file"
|
|
||||||
# fi
|
# Expand the selection by border + gap so the capture includes the border
|
||||||
|
border=$(hyprctl getoption general:border_size -j | jq -r '(.int // 0)')
|
||||||
|
gap=$(hyprctl getoption general:gaps_out -j | jq -r '(.int // 0)')
|
||||||
|
pad=$(( border + gap ))
|
||||||
|
|
||||||
|
geometry=$(awk -v p="$pad" '
|
||||||
|
{
|
||||||
|
split($1, pos, ",");
|
||||||
|
split($2, size, "x");
|
||||||
|
printf "%d,%d %dx%d\n",
|
||||||
|
pos[1] - p, pos[2] - p, size[1] + p * 2, size[2] + p * 2
|
||||||
|
}' <<< "$geometry")
|
||||||
|
|
||||||
|
# Capture the window, save it and copy to clipboard
|
||||||
|
grim -g "$geometry" "$dir/$file" || exit 1
|
||||||
|
wl-copy -t image/png < "$dir/$file"
|
||||||
|
|
||||||
|
if command -v notify-send >/dev/null 2>&1; then
|
||||||
|
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user