Skip to content

Commit 9c22fcd

Browse files
and3rsonwez
andauthored
Add option to configure startup delay (#33)
Add option to configure startup delay Co-authored-by: Wez Furlong <[email protected]>
1 parent e33ee41 commit 9c22fcd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

evremap.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ WorkingDirectory=/
33
# For reasons I don't care to troubleshoot, Fedora 31 won't let me start this
44
# unless I use `bash -c` around it. Putting the command line in directly
55
# yields a 203 permission denied error with no logs about what it didn't like.
6-
ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.toml"
6+
ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.toml -d 0"
77
Restart=always
88

99
[Install]

src/main.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ enum Opt {
3131
/// Specify the configuration file to be loaded
3232
#[structopt(name = "CONFIG-FILE")]
3333
config_file: PathBuf,
34+
35+
/// Number of seconds for user to release keys on startup
36+
#[structopt(short, long, default_value = "2")]
37+
delay: f64,
3438
},
3539
}
3640

@@ -66,14 +70,14 @@ fn main() -> Result<()> {
6670
match opt {
6771
Opt::ListDevices => deviceinfo::list_devices(),
6872
Opt::ListKeys => list_keys(),
69-
Opt::Remap { config_file } => {
73+
Opt::Remap { config_file, delay } => {
7074
let mapping_config = MappingConfig::from_file(&config_file).context(format!(
7175
"loading MappingConfig from {}",
7276
config_file.display()
7377
))?;
7478

7579
log::warn!("Short delay: release any keys now!");
76-
std::thread::sleep(Duration::new(2, 0));
80+
std::thread::sleep(Duration::from_secs_f64(delay));
7781

7882
let device_info = deviceinfo::DeviceInfo::with_name(
7983
&mapping_config.device_name,

0 commit comments

Comments
 (0)