Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Activate wayland overlay as described in [README](https://github.com/bsd-ac/wayl
### Optional Dependencies

- hyprpicker (to freeze the screen contents with the `--freeze` flag)
- yad (to be able to use the GUI mode)

### Manual

Expand Down
2 changes: 1 addition & 1 deletion hyprshot
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function args() {
FILENAME=$1
;;
-D | --delay)
shift;
shift;
DELAY=$1
;;
-m | --mode)
Expand Down
35 changes: 35 additions & 0 deletions hyprshot-gui
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

CHOICE=$(yad --form --title="Hyprshot" --text="<b>Select Screenshot Mode</b>" \
--field="Mode:CB" "window!active window!output!region!selected monitor" \
--field="Delay (seconds):NUM" 0 \
--field="📋 Clipboard only:CHK" FALSE \
--button="🎯 Capture":0 --button="❌ Cancel":1 \
--undecorated --borders=20 --fixed)

# Exit if the user cancels
if [[ $? -ne 0 ]]; then
exit 1
fi

MODE=$(echo "$CHOICE" | cut -d'|' -f1)
DELAY=$(echo "$CHOICE" | cut -d'|' -f2)
CLIPBOARD=$(echo "$CHOICE" | cut -d'|' -f3)

case $MODE in
"active window") MODE="-m window -m active" ;;
"selected monitor") MODE="-m output -m $(hyprctl monitors -j | jq -r '.[0].name')" ;;
*) MODE="-m $MODE" ;;
esac

while [ $DELAY -gt 0 ]; do
echo $((DELAY * 100 / 60))
sleep 1
DELAY=$((DELAY - 1))
done | yad --progress --title="Hyprshot Delay" --text="Time remaining:" --percentage=0 --auto-close --fixed

if [[ "$CLIPBOARD" == "TRUE" ]]; then
hyprshot $MODE --clipboard-only
else
hyprshot $MODE
fi