+
Skip to content

Run #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2025
Merged

Run #48

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ which = "7.0.3"
meval = "0.2.0"
tree_magic_mini = "3.1.6"
rayon = "1.10.0"
nix = { version = "0.30.0", features = ["process"] }
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ It supports various modes:
* DRun
* File
* Ssh
* Run
* // WebSearch
* // Emoji
* // Run
* Auto

Auto mode tries to detect the desired mode automatically, i.e. `ssh`, `?` (for web search), `emoji`, `/` or `~` (for file).

<img src="images/demo.gif" style="width:600px;">

## Not finished
* [ ] run
* [ ] key support
* [ ] full config support
* [ ] web search mode
Expand Down
12 changes: 12 additions & 0 deletions src/lib/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use freedesktop_file_parser::DesktopFile;
use rayon::prelude::*;
use regex::Regex;
use std::collections::HashMap;
use std::os::unix::fs::PermissionsExt;
use std::os::unix::prelude::CommandExt;
use std::path::Path;
use std::path::PathBuf;
Expand Down Expand Up @@ -279,3 +280,14 @@ pub fn create_file_if_not_exists(path: &PathBuf) -> Result<(), Error> {
Err(e) => Err(Error::Io(e.to_string())),
}
}

/// Check if the given dir entry is an executable
#[must_use]
pub fn is_executable(entry: &Path) -> bool {
if let Ok(metadata) = entry.metadata() {
let permissions = metadata.permissions();
metadata.is_file() && (permissions.mode() & 0o111 != 0)
} else {
false
}
}
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载