omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Screenshoot tool does not work (sometimes)

Open alexandru-calinoiu opened this issue 1 year ago • 5 comments

System details

Laptop 13 (AMD Ryzen AI 300 Series) (A9)

What's wrong?

On my system sometimes the screenshoot tool will show up but after taking a screenshoot nothing happened.

Running omarchy-cmd-screenshoot throws the following error:

Fatal error reading PNG image file: IDAT: CRC error (twice)

After some investigation I've found this issue with hypershot https://github.com/Gustash/Hyprshot/issues/106, apparently there is a problem raw is to slow.

I've updated the script command to use a tmp file:

#!/bin/bash

[[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs
OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}"

if [[ ! -d "$OUTPUT_DIR" ]]; then
  notify-send "Screenshot directory does not exist: $OUTPUT_DIR" -u critical -t 3000
  exit 1
fi

pkill slurp

# Use temp file with proper wait for hyprshot to finish
TEMP_FILE="/tmp/omarchy-screenshot-$(date +'%Y-%m-%d_%H-%M-%S').png"
hyprshot -m ${1:-region} --freeze --silent -o /tmp -f "$(basename "$TEMP_FILE")"

# Wait for hyprshot to finish writing the file
while [[ ! -f "$TEMP_FILE" ]] || [[ $(stat -c%s "$TEMP_FILE" 2>/dev/null || echo 0) -eq 0 ]]; do
  sleep 0.1
done

# Additional small delay to ensure file is completely written
sleep 0.2

cat "$TEMP_FILE" | 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' &&
  rm "$TEMP_FILE"

Is someone else experiencing this issue? Shall I open a pr with this fix?

alexandru-calinoiu avatar Sep 13 '25 10:09 alexandru-calinoiu

https://github.com/basecamp/omarchy/issues/1607

ghost avatar Sep 13 '25 14:09 ghost

same here. I noticed, that it seems to differ depending on which app i start to draw the region on. e.g earlier, i had chrome left and terminal right. I was able to screenshot chrome every time, but the terminal failed - everytime.

LucaNerlich avatar Sep 13 '25 18:09 LucaNerlich

same here. I noticed, that it seems to differ depending on which app i start to draw the region on. e.g earlier, i had chrome left and terminal right. I was able to screenshot chrome every time, but the terminal failed - everytime.

@LucaNerlich can you try my updated version and see if you can reproduce?

alexandru-calinoiu avatar Sep 13 '25 19:09 alexandru-calinoiu

Will try, tomorrow or monday.

Sure. But it might take a day or two.

To get around the issue, ive installed fireshot (which is miles better than the solution built into omarchy, imo). Flameshot also works every time, without a hitch so far, only snag, i cannot get it to work via hotkey. Only clicking the icon/shortcut in waybar works.

> flameshot gui

seems to not work correctly with either hyprland tiling or wayland in general.

https://wiki.archlinux.org/title/Flameshot

LucaNerlich avatar Sep 13 '25 20:09 LucaNerlich

I've just discovered this now too, strangely, it works fine when my external monitor is plugged in using any application but not when it's just the single laptop display.

tgh-bit avatar Sep 14 '25 07:09 tgh-bit