diff options
| author | Evgeny Zemtsov <eugene.zemtsov@gmail.com> | 2025-01-26 20:09:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-26 19:09:01 +0000 |
| commit | baa051891237054f2d4db86d7bcfe0f17440c35f (patch) | |
| tree | 60931bc4385d6802482a8a9d5b502d1ea3585bee /niri-ipc/src | |
| parent | d665079b84a7af503efc82cca63a351e762d6b11 (diff) | |
| download | niri-baa051891237054f2d4db86d7bcfe0f17440c35f.tar.gz niri-baa051891237054f2d4db86d7bcfe0f17440c35f.tar.bz2 niri-baa051891237054f2d4db86d7bcfe0f17440c35f.zip | |
Extend switch-layout action to accept layout index (#1045)
* Extend switch-layout action to accept layout index
* Update src/input/mod.rs
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'niri-ipc/src')
| -rw-r--r-- | niri-ipc/src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs index 44ef1d94..5d611c5a 100644 --- a/niri-ipc/src/lib.rs +++ b/niri-ipc/src/lib.rs @@ -668,6 +668,8 @@ pub enum LayoutSwitchTarget { Next, /// The previous configured layout. Prev, + /// The specific layout by index. + Index(u8), } /// Output actions that niri can perform. @@ -1174,7 +1176,10 @@ impl FromStr for LayoutSwitchTarget { match s { "next" => Ok(Self::Next), "prev" => Ok(Self::Prev), - _ => Err(r#"invalid layout action, can be "next" or "prev""#), + other => match other.parse() { + Ok(layout) => Ok(Self::Index(layout)), + _ => Err(r#"invalid layout action, can be "next", "prev" or a layout index"#), + }, } } } |
