Pi66

pind
Simple Rust hotkey daemon.
git clone https://git.pi66.xyz/pind

← back to log

fix: fix some pull request glitches problems

author: pi66
date: 2025-09-04 19:27
hash: 7d9e251847fa98c894438f8a96450569cec10ef6

Diffstat:

M

src/main.rs
7 +++++++++++++-----------------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff --git a/src/main.rs b/src/main.rs
index 511d3f2..5471787 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,7 +27,7 @@ use evdev::{AttributeSet, Device, KeyCode, enumerate, EventType, uinput::Virtual
 use std::{env::{var,args},fs::{read_to_string,canonicalize}, path::PathBuf, process::{exit,Command, Stdio}, sync::{Arc, OnceLock}, thread};

 const DELAY  :u64  =  25; // 25ms
-const CONFIG :&str =  "~/etc/pind/pindrc"; // You can use ~/ for user path
+const CONFIG :&str =  "/etc/pind/pindrc"; // You can use ~/ for user path
                                           // like ~/.config/pind/pindrc
 static BINDINGS: OnceLock<Arc<Vec<(AttributeSet<KeyCode>, String)>>> = OnceLock::new();

@@ -168,7 +168,7 @@ fn read_keys(kc: &[(AttributeSet<KeyCode>, String)], kbs: PathBuf, delay: u64, u
     // First, get all supported keys from the physical device to set up the virtual device properly
     let supported_keys = match device.supported_keys() {
         Some(keys) => keys,
-        None => {
+        _ => {
             eprintln!("Failed to get supported keys from device");
             return;
         }
@@ -253,13 +253,12 @@ fn read_keys(kc: &[(AttributeSet<KeyCode>, String)], kbs: PathBuf, delay: u64, u
                         let (since, last) = &mut state[i];
                         if pressed {
                             if *since == 0 {
-                                run(cmd, &user);
                                 *since = tick;
                                 *last = tick;
                             } else if tick - *since >= init && tick > *last {
-                                run(cmd, &user);
                                 *last = tick;
                             }
+                            run(cmd, &user);
                         } else {
                             *since = 0;
                         }