diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-05 13:08:29 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-05 13:08:29 +0400 |
| commit | 9847a652af864109b3543e42d48087a38c0729ad (patch) | |
| tree | a2c04dc2d66ec2c139bcd9874bde1ac814df3e66 /src | |
| parent | 96823eea38fc4690a5f2eb37050ce001a7292d6e (diff) | |
| download | niri-9847a652af864109b3543e42d48087a38c0729ad.tar.gz niri-9847a652af864109b3543e42d48087a38c0729ad.tar.bz2 niri-9847a652af864109b3543e42d48087a38c0729ad.zip | |
ipc: Respect --json for msg output
Diffstat (limited to 'src')
| -rw-r--r-- | src/ipc/client.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ipc/client.rs b/src/ipc/client.rs index 4709f57a..ca472e11 100644 --- a/src/ipc/client.rs +++ b/src/ipc/client.rs @@ -248,6 +248,13 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { bail!("unexpected response: expected OutputConfigChanged, got {response:?}"); }; + if json { + let response = + serde_json::to_string(&response).context("error formatting response")?; + println!("{response}"); + return Ok(()); + } + if response == OutputConfigChanged::OutputWasMissing { println!("Output \"{output}\" is not connected."); println!("The change will apply when it is connected."); |
