1
0
Fork 0
forked from wry/wry

toml-config: add named actions

This commit is contained in:
Julian Orth 2025-04-25 17:18:49 +02:00
parent 8552c5f1eb
commit 3100773ae0
15 changed files with 587 additions and 4 deletions

View file

@ -33,6 +33,7 @@ use {
std::{
error::Error,
fmt::{Display, Formatter},
rc::Rc,
time::Duration,
},
thiserror::Error,
@ -64,6 +65,7 @@ pub enum SimpleCommand {
}
#[derive(Debug, Clone)]
#[expect(clippy::enum_variant_names)]
pub enum Action {
ConfigureConnector {
con: ConfigConnector,
@ -133,6 +135,16 @@ pub enum Action {
SetRepeatRate {
rate: RepeatRate,
},
DefineAction {
name: String,
action: Box<Action>,
},
UndefineAction {
name: String,
},
NamedAction {
name: String,
},
}
#[derive(Debug, Clone, Default)]
@ -338,6 +350,12 @@ pub struct Shortcut {
pub latch: Option<Action>,
}
#[derive(Debug, Clone)]
pub struct NamedAction {
pub name: Rc<String>,
pub action: Action,
}
#[derive(Debug, Clone)]
pub struct Config {
pub keymap: Option<ConfigKeymap>,
@ -371,6 +389,8 @@ pub struct Config {
pub xwayland: Option<Xwayland>,
pub color_management: Option<ColorManagement>,
pub float: Option<Float>,
pub named_actions: Vec<NamedAction>,
pub max_action_depth: u64,
}
#[derive(Debug, Error)]