From 9847a652af864109b3543e42d48087a38c0729ad Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 5 May 2024 13:08:29 +0400 Subject: ipc: Respect --json for msg output --- src/ipc/client.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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."); -- cgit