Skip to content

Supporting reading the image from stdin #42

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

Closed
JustSimplyKyle opened this issue Oct 12, 2022 · 15 comments · Fixed by #62 or #79
Closed

Supporting reading the image from stdin #42

JustSimplyKyle opened this issue Oct 12, 2022 · 15 comments · Fixed by #62 or #79
Labels
enhancement New feature or request

Comments

@JustSimplyKyle
Copy link

This is a weird request, but I wish it's possible to do something like this
cat wallpaper.png | swww img -
where - stands for read from standard input as most program do

@JustSimplyKyle
Copy link
Author

The current workaround is to first save it to a temp file, load swww img, and then removes the temp file

@LGFae LGFae added the enhancement New feature or request label Oct 12, 2022
@LGFae
Copy link
Owner

LGFae commented Oct 12, 2022

This should be pretty doable, actually. Though it will create a problem where swww query won't know the name of the image (since it uses the file's name for that). So it would answer something like: currently displaying "stdin". Would that be fine?

@JustSimplyKyle
Copy link
Author

Perfectly fine!

@LGFae
Copy link
Owner

LGFae commented Nov 12, 2022

My apologies, I realized that this is actually harder than I initially thought. This is because what we send to the daemon is not the image file, but the image's filename. This means that, currently, in order to read a image, it needs to exist somewhere in the file system. I might be able to do something using temporary files, but, again, this is more complicated than what I had fist envisioned.

@LGFae
Copy link
Owner

LGFae commented Dec 11, 2022

Alright. The only limitation is that #62 will not animate any gifs you send in. I think I am going to keep it that way, since I don't really like the idea of piping giant gifs through stdin into the program.

@LGFae LGFae closed this as completed in #62 Dec 11, 2022
@LGFae
Copy link
Owner

LGFae commented Dec 11, 2022

I decided to close like this for now, if anyone reading this would like to read animated gifs from stdin, please open another issue and I will get to it.

@JustSimplyKyle
Copy link
Author

org-cat test.png | swww img -o HDMI-A-1 -(error msg Error: "Failed to serialize request: io error: Broken pipe (os error 32)")
Why would this fail?
org-cat test.png | imv -
This however works.

@LGFae
Copy link
Owner

LGFae commented Dec 12, 2022

it shouldn't, specially not with that error.
Thanks for testing this!

Re-openning.

@LGFae LGFae reopened this Dec 12, 2022
@LGFae
Copy link
Owner

LGFae commented Dec 12, 2022

Now, we have a problem: I can't seem to be able to reproduce this...

Can you maybe give some more details? Do you literally just swww init and then try doing that?

@JustSimplyKyle
Copy link
Author

Wait... I just forgot to restart swww after my upgrade. Sorry for the confusion!

@JustSimplyKyle
Copy link
Author

JustSimplyKyle commented Feb 3, 2023

this seem to be broken on the latest git.
org-cat /tmp/out.png | swww img - this doesn't work

@JustSimplyKyle JustSimplyKyle reopened this Feb 3, 2023
@JustSimplyKyle
Copy link
Author

image
This is the faulty commit. I wonder if it's possible to make these kind of stuff in tests.

@LGFae
Copy link
Owner

LGFae commented Feb 3, 2023

Ah yes, this is because we are trying to canonicalize all paths, but '-' is not a valid path, is it?

@LGFae
Copy link
Owner

LGFae commented Feb 3, 2023

I am fixing it; added a new test too to make sure it doesn't happen again

@JustSimplyKyle
Copy link
Author

Thanks for the immediate fix!

@LGFae LGFae closed this as completed in #79 Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants