diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-05 10:19:47 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-05 10:19:47 +0400 |
| commit | 65b9c74f624b4a78c2247135bf1a96dcac0bd009 (patch) | |
| tree | d4b960d3aac247df759ada124a2ffa050ae8ee9f /src/ipc | |
| parent | 2dff67447082f3c000b7eb68b4826f5b3db7397b (diff) | |
| download | niri-65b9c74f624b4a78c2247135bf1a96dcac0bd009.tar.gz niri-65b9c74f624b4a78c2247135bf1a96dcac0bd009.tar.bz2 niri-65b9c74f624b4a78c2247135bf1a96dcac0bd009.zip | |
Implement niri msg output
Diffstat (limited to 'src/ipc')
| -rw-r--r-- | src/ipc/client.rs | 9 | ||||
| -rw-r--r-- | src/ipc/server.rs | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/ipc/client.rs b/src/ipc/client.rs index 1704adfb..3aa5eb22 100644 --- a/src/ipc/client.rs +++ b/src/ipc/client.rs @@ -11,6 +11,10 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { Msg::Outputs => Request::Outputs, Msg::FocusedWindow => Request::FocusedWindow, Msg::Action { action } => Request::Action(action.clone()), + Msg::Output { output, action } => Request::Output { + output: output.clone(), + action: action.clone(), + }, Msg::RequestError => Request::ReturnError, }; @@ -237,6 +241,11 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { bail!("unexpected response: expected Handled, got {response:?}"); }; } + Msg::Output { .. } => { + let Response::Handled = response else { + bail!("unexpected response: expected Handled, got {response:?}"); + }; + } } Ok(()) diff --git a/src/ipc/server.rs b/src/ipc/server.rs index 5e18c16a..59f929d8 100644 --- a/src/ipc/server.rs +++ b/src/ipc/server.rs @@ -169,6 +169,12 @@ fn process(ctx: &ClientCtx, request: Request) -> Reply { }); Response::Handled } + Request::Output { output, action } => { + ctx.event_loop.insert_idle(move |state| { + state.apply_transient_output_config(&output, action); + }); + Response::Handled + } }; Ok(response) |
