From bbb57e98c143057dba276f52061dada8d3b2e3e1 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Thu, 12 Feb 2026 17:04:38 -0500 Subject: [PATCH] Update screenshot behavior - Unifies screenshot to a single shortcut - Provides easy override for screenshot editor of choice via env var or flag - Edit screenshots via clicking the notification - Screenshots are copied to clipboard + saved by default --- bin/omarchy-cmd-screenshot | 49 +++++++++++++++++++++++----- default/hypr/bindings/utilities.conf | 3 +- default/mako/core.ini | 4 +++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/bin/omarchy-cmd-screenshot b/bin/omarchy-cmd-screenshot index b988a3b7..d07d4a15 100755 --- a/bin/omarchy-cmd-screenshot +++ b/bin/omarchy-cmd-screenshot @@ -2,6 +2,7 @@ # Take a screenshot of the whole screen, a specific window, or a user-drawn region. # Saves to ~/Pictures by default, but that can be changed via OMARCHY_SCREENSHOT_DIR or XDG_PICTURES_DIR ENVs. +# Editor defaults to Satty but can be changed via --editor= or OMARCHY_SCREENSHOT_EDITOR env [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}" @@ -13,6 +14,33 @@ fi pkill slurp && exit 0 +SCREENSHOT_EDITOR="${OMARCHY_SCREENSHOT_EDITOR:-satty}" + +# Parse --editor flag from any position +ARGS=() +for arg in "$@"; do + if [[ "$arg" == --editor=* ]]; then + SCREENSHOT_EDITOR="${arg#--editor=}" + else + ARGS+=("$arg") + fi +done +set -- "${ARGS[@]}" + +open_editor() { + local filepath="$1" + if [[ "$SCREENSHOT_EDITOR" == "satty" ]]; then + satty --filename "$filepath" \ + --output-filename "$filepath" \ + --early-exit \ + --actions-on-enter save-to-clipboard \ + --save-after-copy \ + --copy-command 'wl-copy' + else + $SCREENSHOT_EDITOR "$filepath" + fi +} + MODE="${1:-smart}" PROCESSING="${2:-slurp}" @@ -46,7 +74,7 @@ case "$MODE" in SELECTION=$(echo "$RECTS" | slurp 2>/dev/null) kill $PID 2>/dev/null - # If the selction area is L * W < 20, we'll assume you were trying to select whichever + # If the selection area is L * W < 20, we'll assume you were trying to select whichever # window or output it was inside of to prevent accidental 2px snapshots if [[ "$SELECTION" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+)$ ]]; then if (( ${BASH_REMATCH[3]} * ${BASH_REMATCH[4]} < 20 )); then @@ -71,16 +99,19 @@ case "$MODE" in ;; esac -[ -z "$SELECTION" ] && exit 0 +[[ -z $SELECTION ]] && exit 0 + +FILENAME="screenshot-$(date +'%Y-%m-%d_%H-%M-%S').png" +FILEPATH="$OUTPUT_DIR/$FILENAME" if [[ $PROCESSING == "slurp" ]]; then -grim -g "$SELECTION" - | - satty --filename - \ - --output-filename "$OUTPUT_DIR/screenshot-$(date +'%Y-%m-%d_%H-%M-%S').png" \ - --early-exit \ - --actions-on-enter save-to-clipboard \ - --save-after-copy \ - --copy-command 'wl-copy' + grim -g "$SELECTION" "$FILEPATH" || exit 1 + wl-copy < "$FILEPATH" + + ( + ACTION=$(notify-send "Screenshot copied & saved" "Click to edit" -t 10000 -i "$FILEPATH" -A "default=edit") + [[ "$ACTION" == "default" ]] && open_editor "$FILEPATH" + ) & else grim -g "$SELECTION" - | wl-copy fi diff --git a/default/hypr/bindings/utilities.conf b/default/hypr/bindings/utilities.conf index c6ab8fab..3c3629fe 100644 --- a/default/hypr/bindings/utilities.conf +++ b/default/hypr/bindings/utilities.conf @@ -34,8 +34,7 @@ bindd = CTRL, F2, Apple Display brightness up, exec, omarchy-brightness-display- bindd = SHIFT CTRL, F2, Apple Display full brightness, exec, omarchy-brightness-display-apple +60000 # Captures -bindd = , PRINT, Screenshot with editing, exec, omarchy-cmd-screenshot -bindd = SHIFT, PRINT, Screenshot to clipboard, exec, omarchy-cmd-screenshot smart clipboard +bindd = , PRINT, Screenshot, exec, omarchy-cmd-screenshot bindd = ALT, PRINT, Screenrecording, exec, omarchy-menu screenrecord bindd = SUPER, PRINT, Color picker, exec, pkill hyprpicker || hyprpicker -a diff --git a/default/mako/core.ini b/default/mako/core.ini index 0c9a46e8..203d4e8c 100644 --- a/default/mako/core.ini +++ b/default/mako/core.ini @@ -28,3 +28,7 @@ on-button-left=exec sh -c 'omarchy-notification-dismiss "Update System"; omarchy [summary~="Learn Keybindings"] on-button-left=exec sh -c 'omarchy-notification-dismiss "Learn Keybindings"; omarchy-menu-keybindings' + +[summary~="Screenshot copied & saved"] +max-icon-size=80 +format=%s\n%b