config: Allow KeyPatterns to be printed

This commit is contained in:
Victoria Brekenfeld 2023-07-05 23:49:02 +02:00
parent 13efd32e23
commit 7bd2db4851

View file

@ -8,7 +8,7 @@ use crate::{
wayland::protocols::output_configuration::OutputConfigurationState,
};
use serde::{Deserialize, Serialize};
use smithay::input::Seat;
use smithay::input::{keyboard::xkb::keysym_get_name, Seat};
pub use smithay::{
backend::input::KeyState,
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)]
pub enum Action {
Terminate,