Skip to content

Command finishes before the file is actually saved to the disk #134

@satma0745

Description

@satma0745

I'm using the following script to take screenshots:

#!/usr/bin/env bash
set -euo pipefail

filename=$(date +"%F_%T.%3N.png")

hyprshot --mode region --freeze --output-folder ~/Screenshots --filename "$filename" || true

sleep 1

satty --fullscreen --early-exit --initial-tool marker --actions-on-escape exit --filename ~/Screenshots/$filename

BTW if the issue is caused by the script itself, then I'm terribly sorry, but I really don't see how the script would cause this issue.

You can see that this script has a 1s delay before opening the image (in satty). This delay is necessary, because it turns out that without it the hyprshot command finishes before the image is fully written on the disk and satty can't open it yet.

The required delay depends on the screenshot size (e.g. for 200x200 screenshots I don't need any additional delay at all) and isn't fully consistent (sometimes 200ms is enough for 3440x1440 screenshots and sometimes it isn't, even if I'm consistently screenshotting the same consistent empty workspace without any windows open).

Here's a link to a GDrive with a .tar archive with a .mp4 clip of how it behaves: https://drive.google.com/file/d/1__TwvkqkTky2pwGSVWJwqIwJj1Aj1BJq/view?usp=sharing
Sorry for such a convoluted way of sharing, the GitHub fails to upload this video for some reason. If another way of sharing is preferred - please let me know, I will upload with a different approach.

I don't think that the issue is with my hardware (I have an nvme sdd disk, capable cpu, ram, gpu).
I think that it's possible that the issue can be worked around by editing the script (maybe adding sufficient delay as mentioned above, or by trying to open the image in a loop).
I would like a fix (if this behavior is a bug) or some kind of flag (to opt-in the built-in delay if this behavior is intentional for some reason).

Configuration:

  • I didn't create any configuration files for the hyprshot.
  • Kernel version is 6.17.4-arch2-1 (I use Endeavour OS).
  • hyprland version is 0.51.1-6, hyprshot version is 1.3.0-4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions