diff --git a/Cargo.lock b/Cargo.lock index e364b0f..70e5d45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,7 +129,7 @@ dependencies = [ [[package]] name = "rlaunch" -version = "1.3.6" +version = "1.3.7" dependencies = [ "structopt", "x11-dl", diff --git a/Cargo.toml b/Cargo.toml index 108c116..7662b5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rlaunch" -version = "1.3.6" +version = "1.3.7" authors = ["Ponas "] edition = "2018" diff --git a/README.md b/README.md index 4724ddc..003a69e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This should work on all linux distributions and DEs that use X11, but if it does ### Usage ``` -rlaunch 1.3.5 +rlaunch 1.3.7 A simple and light-weight tool for launching applications and running commands on X11. USAGE: diff --git a/src/applications.rs b/src/applications.rs index 45bbdef..f5427b4 100644 --- a/src/applications.rs +++ b/src/applications.rs @@ -33,7 +33,7 @@ fn do_read_applications( progress.lock().unwrap().1 = files.len() as u32; - for file in files { + 'files: for file in files { // update progress progress.lock().unwrap().0 += 1; @@ -58,7 +58,19 @@ fn do_read_applications( let mut app_type = String::new(); let mut terminal = String::new(); for line in contents.lines() { - if exec == "" && line.starts_with("Exec=") { + if line.starts_with("Hidden=") { + let mut hidden = line[7..].to_string(); + // remove quotes if present + if hidden.len() > 1 && hidden.starts_with('"') && hidden.ends_with('"') { + hidden = hidden[1..hidden.len() - 1].to_string(); + } + match hidden.trim().to_lowercase().parse() { + Err(_) | Ok(true) => { // hidden or couldnt parse + continue 'files; + }, + _ => {}, + } + } else if exec == "" && line.starts_with("Exec=") { exec = line[5..].to_string(); // remove any arguments while let Some(i) = exec.find('%') {