config: Allow KeyPatterns to be printed
This commit is contained in:
parent
13efd32e23
commit
7bd2db4851
1 changed files with 21 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
wayland::protocols::output_configuration::OutputConfigurationState,
|
wayland::protocols::output_configuration::OutputConfigurationState,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use smithay::input::Seat;
|
use smithay::input::{keyboard::xkb::keysym_get_name, Seat};
|
||||||
pub use smithay::{
|
pub use smithay::{
|
||||||
backend::input::KeyState,
|
backend::input::KeyState,
|
||||||
input::keyboard::{keysyms as KeySyms, Keysym, ModifiersState},
|
input::keyboard::{keysyms as KeySyms, Keysym, ModifiersState},
|
||||||
|
|
@ -991,6 +991,26 @@ impl KeyPattern {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ToString for KeyPattern {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
let mut result = String::new();
|
||||||
|
if self.modifiers.logo {
|
||||||
|
result += "Super+";
|
||||||
|
}
|
||||||
|
if self.modifiers.ctrl {
|
||||||
|
result += "Ctrl+";
|
||||||
|
}
|
||||||
|
if self.modifiers.alt {
|
||||||
|
result += "Alt+";
|
||||||
|
}
|
||||||
|
if self.modifiers.shift {
|
||||||
|
result += "Shift+";
|
||||||
|
}
|
||||||
|
result += &keysym_get_name(self.key);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
Terminate,
|
Terminate,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue