mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
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>
This commit is contained in:
+6
-1
@@ -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"#),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user