Skip to content

Implementation discussion: Custom exit codes and/or customizable file picker #208

@mallo-m

Description

@mallo-m

Hi,

Continuing the subject that has been open in #193, regarding custom exit-codes for non-error behaviors.

Maybe I should explain why I implemented this approach, as I feel like some other people might have ran into the same issue as me :)
I use swappy in a script, binded to a keyboard shortcut to quickly screenshot, edit and save stuff that is on my screen. So far nothing never seen before.
The pipeline is a follows :
grim (save screen's region to a buffer) -> swappy (edit the image's buffer) -> zenity (select where to save the edited image)

Problem is, that if I screenshot something that gets passed to swappy, and then decide to discard the current picture, zenity will still open and prompt for where I wish to save the picture. Same behavior if I click the "Copy image to clipboard" button. Because the script/zenity has no way to know that the edition has been canceled by the user.

Hence the custom exit codes. With them, the script knows that I have discarded the image or saved to clipboard and will not trigger zenity to open.

Now, I feel like this could be solved by implementing a configuration/customization element in swappy to automatically open a "File saver program" to save what has been edited.

What's your opinion on this ?
I use swappy a lot, and whatever solution you think is the best, I'm happy to implement and send a PR afterwards.

Kind regards,

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