Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--output-file is surprising #143

Open
ThinkChaos opened this issue Jan 6, 2023 · 7 comments
Open

--output-file is surprising #143

ThinkChaos opened this issue Jan 6, 2023 · 7 comments

Comments

@ThinkChaos
Copy link

Hi,

I find the behaviour of --output-file quite surprising: usually tools use that file to save/output anything.
Swappy instead uses the save dir by default, and only at the end writes to that file.
I'd like Swappy to not create a new file every time I click save, instead of just overwriting the same file again and again.

How do you feel about changing -o's behavior to match what most applications do?
If changing it is out of the question, maybe we can add another option to opt out of the extra files?

I could make a PR, just want to ask what's your thoughts first.

@jtheoof
Copy link
Owner

jtheoof commented Jan 6, 2023

I'm have trouble to understand.

I'd like Swappy to not create a new file every time I click save, instead of just overwriting the same file again and again.

What does this mean? Can you clarify the use case?

@ThinkChaos
Copy link
Author

When I make a screen shot, it automatically opens in Swappy.
Then when I edit it, and click save, it creates a file in my home directory (the default save dir). I often click save/ctrl-s a bunch of times, and end up with a bunch of files in there.

I tried changing my setup to use -o so I only ever get a single file, even if pressing save a lot. But that's not what it does.
I'd like it to also prevent writing the intermediate saves. Or at least have a different way to do so.

@jtheoof
Copy link
Owner

jtheoof commented Jan 7, 2023

The goal of the -o option is properly stated in the man page and works as expected.

Print the final surface to when exiting the application.`

Perhaps you can try to tweak the value of save_filename_format=swappy.png in the config file to achieve what you want. Besides that I would prefer to keep the current behavior.

@ThinkChaos
Copy link
Author

ThinkChaos commented Jan 7, 2023

Yeah I understand it's documented well, I just think it goes against the general meaning of -o in other tools, which is why I called it surprising. I'm fine with not changing this.

How I use Swappy is I have a script that takes a screenshot and saves it in a timestamped file. Then it runs Swappy on that file.
I'd like Swappy to just act as an editor of that file, i.e. never write anything else than it.

A static config with save_filename_format could work if my script then moved that static file to where I want. But that's pretty hacky IMO and doesn't support multiple instances at the same time.
I guess if there was a --config flag to tell Swappy where to read the config, I could use that to generate a config per run with both save_filename_format and save_dir set.
Is that something you'd be interested in merging?

EDIT: My other suggestion was adding something like --no-snapshots, and change the save to always write to -o. What do you think of that?

@jtheoof
Copy link
Owner

jtheoof commented Jan 9, 2023

I'm not really opposed to change the -o option to match the use case you describe. I think it makes sense even though that would be a breaking change.
Having a --config would be good as well.

@zefr0x
Copy link

zefr0x commented Jun 23, 2023

When I make a screen shot, it automatically opens in Swappy. Then when I edit it, and click save, it creates a file in my home directory (the default save dir). I often click save/ctrl-s a bunch of times, and end up with a bunch of files in there.

Using the time when the image was opened in the file name format rather then the time when the file if save would fix that.

The current behavior is that swappy will change the file name for the same image every time it's being saved.

Maybe a config like file-format-time=[when-save|when-open] could be used.

@adonespitogo
Copy link

Hi, I have a problem related to the -o option. I wanted to save the file to the exact location. In this example, I want to save it to $HOME/Pictures/itworks.png, but it always saves to the default save_dir instead of the option I provided. Here's what I did:

grim -g "$(slurp)" - | swappy --output-file "$HOME/Pictures/itworks.png" -f - 

What is the proper way to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants