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

IPC: Accept multiple actions from stdin #1017

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bbb651
Copy link
Contributor

@bbb651 bbb651 commented Jan 19, 2025

This needs some testing, io::stdin().lines() behaves a little weird with EOF, notably pressing Ctrl + D twice (apparently that's a unix thing, you need to hit it twice when not at the start of a line), you still need to hit it an additional time for some reason.. with echo -e "one\ntwo" | niri msg action it works as expected (by the way, it seems like NIRI_SOCKET isn't replaced correctly in the winit backend).

I made the serialization prefer keeping 1-length vectors as single values to maximize compatibility. The amount of tests for one_or_many is a bit excessive (I thought a visitor was needed at first, and then got the order of the enum variants wrong, so they were helpful), should I only keep the derive ones?

Also I'm not sure what should happen if you pass no actions, currently the cli prints a warning and does nothing but it's allowed in the ipc, should niri respond with an error instead?

Also, this currently splits on spaces, meaning it handles quoting and multiple spaces incorrectly, should this use e.g. shlex instead?

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

Successfully merging this pull request may close these issues.

1 participant