feat(commands): add touchpad inhibition handling and status display

New Features
- Implement touchpad enable/disable commands via /sys/class/input/inhibited.
- Add permission adjustments for touchpad inhibition files.
- Show touchpad status in `lapctl status`.

Enhancements
- Update install rules to manage touchpad inhibition permissions.
- Expose new `touchpad` command module.

Bug Fixes
- Resolve missing permission errors for touchpad devices.
- Handle missing /sys/class/input directory gracefully.
This commit is contained in:
sankalp committed 2026-03-16 22:26:22 +05:45
1 parent 1bb54facaf
commit 42b3fb47fd
4 files changed
+85

No files matched your search

+26
View File
@@ -153,4 +153,30 @@ pub fn execute() {
if !tdp_found {
println!("CPU TDP Limit: Hardware Managed");
}
// Touchpad Status
let sys_class_input = Path::new("/sys/class/input");
if sys_class_input.exists()
&& let Ok(entries) = fs::read_dir(sys_class_input)
{
for entry in entries.flatten() {
let path = entry.path();
let name_path = path.join("name");
let inhibited_path = path.join("inhibited");
if name_path.exists()
&& inhibited_path.exists()
&& let Ok(name) = fs::read_to_string(&name_path)
&& name.to_lowercase().contains("touchpad")
&& let Ok(val) = fs::read_to_string(&inhibited_path)
{
let status = if val.trim() == "1" {
"Disabled"
} else {
"Enabled"
};
println!("Touchpad: {} ({})", status, name.trim());
}
}
}
}