Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

[Framework]: https://frame.work/

This is a fork of the original `keylightd` to make it compatible with systems that use [keyd] or [kanata].

[keyd]: https://github.com/rvaiya/keyd
[kanata]: https://github.com/jtroo/kanata

## Installation

To install from source, clone the repository and run:
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ fn main() -> anyhow::Result<()> {
for (path, mut device) in evdev::enumerate() {
// Filter devices so that only the Framework's builtin touchpad and keyboard are listened
// to. Since we don't support hotplug, listening on USB devices wouldn't work reliably.
//log::info!("checking device {:#?}", device.name());
match device.name() {
Some("PIXA3854:00 093A:0274 Touchpad" | "AT Translated Set 2 keyboard") => {
Some("PIXA3854:00 093A:0274 Touchpad" | "AT Translated Set 2 keyboard" | "keyd virtual keyboard" | "kanata" ) => {
let act = act.clone();
thread::spawn(move || -> io::Result<()> {
let name = device.name();
Expand Down Expand Up @@ -131,12 +132,13 @@ fn main() -> anyhow::Result<()> {
loop {
let guard = act.last_activity.lock().unwrap();
let last = *guard;
let (_, result) = act
let (unneeded, result) = act
.condvar
.wait_timeout_while(guard, Duration::from_secs(args.timeout.into()), |instant| {
*instant == last
})
.unwrap();
drop(unneeded);
let new_state = !result.timed_out();
if state != Some(new_state) {
log::info!("activity state changed: {state:?} -> {new_state}");
Expand Down