Add niri msg keyboard-layouts

This commit is contained in:
Ivan Molodetskikh
2024-08-25 09:38:45 +03:00
parent 20cd4f5d04
commit f19e1711a7
4 changed files with 59 additions and 2 deletions
+14
View File
@@ -36,6 +36,8 @@ pub enum Request {
Workspaces,
/// Request information about the focused output.
FocusedOutput,
/// Request information about the keyboard layout.
KeyboardLayouts,
/// Respond with an error (for testing error handling).
ReturnError,
}
@@ -70,6 +72,8 @@ pub enum Response {
Workspaces(Vec<Workspace>),
/// Information about the focused output.
FocusedOutput(Option<Output>),
/// Information about the keyboard layout.
KeyboardLayouts(KeyboardLayouts),
}
/// Actions that niri can perform.
@@ -566,6 +570,16 @@ pub struct Workspace {
pub is_active: bool,
}
/// Configured keyboard layouts.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
pub struct KeyboardLayouts {
/// XKB names of the configured layouts.
pub names: Vec<String>,
/// Index of the currently active layout in `names`.
pub current_idx: u8,
}
impl FromStr for WorkspaceReferenceArg {
type Err = &'static str;