aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-10-29 22:45:21 +0100
committerTeddy Wing2018-10-29 22:45:21 +0100
commit223651a128363353dc0d7815171e0ba49000a764 (patch)
tree3478ab9ca213113073b543697d54f98ee4357a44
parent9a3775c3b4d557e29021c8a5490634957ae23e6a (diff)
downloaddome-key-map-223651a128363353dc0d7815171e0ba49000a764.tar.bz2
config: Add an `--audio` command line flag
Including this flag will tell the program to play interface audio (namely the sounds for mode activated & deactivated).
-rw-r--r--dome_key_map.h1
-rw-r--r--src/config.rs5
2 files changed, 6 insertions, 0 deletions
diff --git a/dome_key_map.h b/dome_key_map.h
index 97aa8f5..5dbd398 100644
--- a/dome_key_map.h
+++ b/dome_key_map.h
@@ -23,6 +23,7 @@ typedef struct State State;
typedef struct {
bool reload;
bool daemon;
+ bool audio;
bool version;
char *license;
} Args;
diff --git a/src/config.rs b/src/config.rs
index bcaf714..4befa4c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -16,6 +16,7 @@ type Milliseconds = u16;
pub struct Args {
pub reload: bool,
pub daemon: bool,
+ pub audio: bool,
pub version: bool,
pub license: *mut c_char,
}
@@ -25,6 +26,7 @@ impl Default for Args {
Args {
reload: false,
daemon: false,
+ audio: false,
version: false,
license: ptr::null_mut(),
}
@@ -61,6 +63,7 @@ pub fn parse_args<'a>(args: &[String], config: &'a mut Config) -> &'a mut Config
opts.optflag("d", "daemon", "run the daemon in the current shell");
opts.optflag("r", "reload-mappings", "reload the mappings file");
+ opts.optflag("", "audio", "play interface audio");
opts.optopt(
"",
"license",
@@ -84,6 +87,8 @@ pub fn parse_args<'a>(args: &[String], config: &'a mut Config) -> &'a mut Config
config.args.reload = true;
} else if matches.opt_present("d") {
config.args.daemon = true;
+ } else if matches.opt_present("audio") {
+ config.args.audio = true;
} else if let Some(license_path) = matches.opt_str("license") {
match CString::new(license_path) {
Ok(str) => config.args.license = str.into_raw(),