Skip to content

Commit 04658fa

Browse files
committed
feat(DBus): add support for custom arbitrary dbus events
1 parent c94d6bc commit 04658fa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

rootfs/usr/share/inputplumber/schema/device_profile_v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
},
267267
"dbus": {
268268
"type": "string",
269-
"enum": [
269+
"examples": [
270270
"ui_guide",
271271
"ui_quick",
272272
"ui_context",

src/input/event/dbus.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub enum Action {
3535
Keyboard,
3636
Screenshot,
3737
Touch,
38+
Custom(String),
3839
}
3940

4041
impl Action {
@@ -66,10 +67,14 @@ impl Action {
6667
Action::Keyboard => "ui_osk",
6768
Action::Screenshot => "ui_screenshot",
6869
Action::Touch => "ui_touch",
70+
Action::Custom(_str) => "custom",
6971
}
7072
}
7173

7274
pub fn as_string(&self) -> String {
75+
if let Action::Custom(str) = self {
76+
return str.clone();
77+
}
7378
self.as_str().to_string()
7479
}
7580
}
@@ -105,7 +110,7 @@ impl FromStr for Action {
105110
"ui_osk" => Ok(Action::Keyboard),
106111
"ui_screenshot" => Ok(Action::Screenshot),
107112
"ui_touch" => Ok(Action::Touch),
108-
_ => Err(()),
113+
_ => Ok(Action::Custom(s.to_string())),
109114
}
110115
}
111116
}

0 commit comments

Comments
 (0)