Compare commits
No commits in common. "f2cb1defa00d6dd432958557afaede0663542c85" and "2f325db17060da96e0ecc420754f90c6ab5537b0" have entirely different histories.
f2cb1defa0
...
2f325db170
3 changed files with 10 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
|||
use int_enum::IntEnum;
|
||||
use log::error;
|
||||
use log::{error, info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
|
@ -100,6 +100,9 @@ pub enum KeyMapVariant {
|
|||
PipeWire {
|
||||
ids: Vec<String>,
|
||||
},
|
||||
Key {
|
||||
keycode: u8, //TODO: add real keycodes
|
||||
},
|
||||
Exec {
|
||||
command: String,
|
||||
args: Option<Vec<String>>,
|
||||
|
|
|
@ -4,7 +4,6 @@ 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,20 +91,8 @@ fn eval(key: NanoKeys, state: u8, config: &Arc<Config>) {
|
|||
}
|
||||
},
|
||||
KeyMapVariant::PipeWire { ids } => {}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
KeyMapVariant::Key { keycode } => {}
|
||||
KeyMapVariant::Exec { command, args } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use log::warn;
|
||||
use mpris::Player;
|
||||
use mpris::PlayerFinder;
|
||||
use regex::Regex;
|
||||
|
@ -37,15 +36,10 @@ where
|
|||
{
|
||||
let player = PlayerFinder::new()
|
||||
.expect("Could not connect to D-Bus")
|
||||
.find_active();
|
||||
match player {
|
||||
Ok(p) => {
|
||||
function(&p);
|
||||
}
|
||||
Err(err) => {
|
||||
warn!("Could not find an active player: {err}");
|
||||
}
|
||||
}
|
||||
.find_active()
|
||||
.expect("Could not find any player");
|
||||
|
||||
function(&player);
|
||||
}
|
||||
|
||||
fn exec_functionality<F>(player_id: Option<&str>, exec_closure: F)
|
||||
|
|
Loading…
Reference in a new issue