Add external command execution
This commit is contained in:
parent
a4e63ae51a
commit
82075e9ff9
1 changed files with 15 additions and 1 deletions
|
@ -4,6 +4,7 @@ use crate::midi_client::KeyEvent;
|
|||
use crate::mpris_client;
|
||||
use crossbeam_channel::Receiver;
|
||||
use log::{error, info, warn};
|
||||
use std::process::{Command, Output};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
|
@ -92,7 +93,20 @@ fn eval(key: NanoKeys, state: u8, config: &Arc<Config>) {
|
|||
},
|
||||
KeyMapVariant::PipeWire { ids } => {}
|
||||
KeyMapVariant::Key { keycode } => {}
|
||||
KeyMapVariant::Exec { command, args } => {}
|
||||
KeyMapVariant::Exec { command, args } => {
|
||||
let output: Result<Output, std::io::Error> = match args {
|
||||
Some(some_args) => Command::new(command).args(some_args).output(),
|
||||
None => Command::new(command).output(),
|
||||
};
|
||||
match output {
|
||||
Ok(out) => {
|
||||
info!("{:?}", out);
|
||||
}
|
||||
Err(err) => {
|
||||
error!("{:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue