chore: update deps and test fixes
This commit is contained in:
parent
5432fee112
commit
0bfda2e28c
4 changed files with 36 additions and 25 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -66,7 +66,7 @@ jobs:
|
||||||
- name: Rust toolchain
|
- name: Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
- name: Test features
|
- name: Test features
|
||||||
run: cargo test --no-default-features --features "${{ matrix.features }}"
|
run: cargo test --no-default-features --features "${{ matrix.features }}" -- --test-threads=1
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: full
|
RUST_BACKTRACE: full
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ name = "cosmic"
|
||||||
default = [
|
default = [
|
||||||
"winit",
|
"winit",
|
||||||
"tokio",
|
"tokio",
|
||||||
"a11y",
|
"a11y",
|
||||||
"dbus-config",
|
"dbus-config",
|
||||||
"x11",
|
"x11",
|
||||||
"wayland",
|
"wayland",
|
||||||
|
|
@ -119,7 +119,7 @@ ashpd = { version = "0.12.1", default-features = false, optional = true }
|
||||||
async-fs = { version = "2.2", optional = true }
|
async-fs = { version = "2.2", optional = true }
|
||||||
async-std = { version = "1.13", optional = true }
|
async-std = { version = "1.13", optional = true }
|
||||||
auto_enums = "0.8.7"
|
auto_enums = "0.8.7"
|
||||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "d0e95be", optional = true }
|
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "160b086", optional = true }
|
||||||
jiff = "0.2"
|
jiff = "0.2"
|
||||||
cosmic-config = { path = "cosmic-config" }
|
cosmic-config = { path = "cosmic-config" }
|
||||||
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
|
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
|
||||||
|
|
|
||||||
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit b479f3e87fd54b9e80a95cf1f4d7767f9dcfbccf
|
Subproject commit 4516691f3582a2a8c31f886b8e6090a235f6e72c
|
||||||
|
|
@ -416,7 +416,6 @@ fn match_exec_basename(
|
||||||
};
|
};
|
||||||
|
|
||||||
let basename_lower = basename.to_ascii_lowercase();
|
let basename_lower = basename.to_ascii_lowercase();
|
||||||
|
|
||||||
if normalized
|
if normalized
|
||||||
.iter()
|
.iter()
|
||||||
.any(|candidate| candidate == &basename_lower)
|
.any(|candidate| candidate == &basename_lower)
|
||||||
|
|
@ -440,8 +439,7 @@ fn fallback_entry(context: &DesktopLookupContext<'_>) -> fde::DesktopEntry {
|
||||||
let name = context
|
let name = context
|
||||||
.title
|
.title
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|title| title.to_string())
|
.map_or_else(|| context.app_id.to_string(), |title| title.to_string());
|
||||||
.unwrap_or_else(|| context.app_id.to_string());
|
|
||||||
entry.add_desktop_entry("Name".to_string(), name);
|
entry.add_desktop_entry("Name".to_string(), name);
|
||||||
entry
|
entry
|
||||||
}
|
}
|
||||||
|
|
@ -458,7 +456,9 @@ fn proton_or_wine_fallback(
|
||||||
) -> Option<fde::DesktopEntry> {
|
) -> Option<fde::DesktopEntry> {
|
||||||
let app_id = context.app_id.as_ref();
|
let app_id = context.app_id.as_ref();
|
||||||
let is_proton_game = app_id == "steam_app_default";
|
let is_proton_game = app_id == "steam_app_default";
|
||||||
let is_wine_entry = app_id.ends_with(".exe");
|
let is_wine_entry = std::path::Path::new(app_id)
|
||||||
|
.extension()
|
||||||
|
.is_some_and(|ext| ext.eq_ignore_ascii_case("exe"));
|
||||||
|
|
||||||
if !is_proton_game && !is_wine_entry {
|
if !is_proton_game && !is_wine_entry {
|
||||||
return None;
|
return None;
|
||||||
|
|
@ -487,10 +487,6 @@ fn proton_or_wine_fallback(
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
fn candidate_desktop_ids(context: &DesktopLookupContext<'_>) -> Vec<String> {
|
fn candidate_desktop_ids(context: &DesktopLookupContext<'_>) -> Vec<String> {
|
||||||
const SUFFIXES: &[&str] = &[".desktop", ".Desktop", ".DESKTOP"];
|
|
||||||
let mut ordered = Vec::new();
|
|
||||||
let mut seen = HashSet::new();
|
|
||||||
|
|
||||||
fn push_candidate(seen: &mut HashSet<String>, ordered: &mut Vec<String>, candidate: &str) {
|
fn push_candidate(seen: &mut HashSet<String>, ordered: &mut Vec<String>, candidate: &str) {
|
||||||
let trimmed = candidate.trim();
|
let trimmed = candidate.trim();
|
||||||
if trimmed.is_empty() {
|
if trimmed.is_empty() {
|
||||||
|
|
@ -531,11 +527,11 @@ fn candidate_desktop_ids(context: &DesktopLookupContext<'_>) -> Vec<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if trimmed.contains('.') {
|
if trimmed.contains('.')
|
||||||
if let Some(last) = trimmed.rsplit('.').next() {
|
&& let Some(last) = trimmed.rsplit('.').next()
|
||||||
if last.len() >= 2 {
|
{
|
||||||
push_candidate(seen, ordered, last);
|
if last.len() >= 2 {
|
||||||
}
|
push_candidate(seen, ordered, last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -546,13 +542,20 @@ fn candidate_desktop_ids(context: &DesktopLookupContext<'_>) -> Vec<String> {
|
||||||
push_candidate(seen, ordered, &trimmed.replace('_', "-"));
|
push_candidate(seen, ordered, &trimmed.replace('_', "-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for token in trimmed.split(|c: char| matches!(c, '.' | '-' | '_' | '@' | ' ')) {
|
for token in
|
||||||
|
trimmed.split(|c: char| matches!(c, '.' | '-' | '_' | '@') || c.is_whitespace())
|
||||||
|
{
|
||||||
if token.len() >= 2 && token != trimmed {
|
if token.len() >= 2 && token != trimmed {
|
||||||
push_candidate(seen, ordered, token);
|
push_candidate(seen, ordered, token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SUFFIXES: &[&str] = &[".desktop", ".Desktop", ".DESKTOP"];
|
||||||
|
|
||||||
|
let mut ordered = Vec::new();
|
||||||
|
let mut seen = HashSet::new();
|
||||||
|
|
||||||
add_variants(
|
add_variants(
|
||||||
&mut seen,
|
&mut seen,
|
||||||
&mut ordered,
|
&mut ordered,
|
||||||
|
|
@ -915,12 +918,20 @@ mod tests {
|
||||||
let candidates = candidate_desktop_ids(&ctx);
|
let candidates = candidate_desktop_ids(&ctx);
|
||||||
|
|
||||||
assert_eq!(candidates.first().unwrap(), "com.example.App.desktop");
|
assert_eq!(candidates.first().unwrap(), "com.example.App.desktop");
|
||||||
assert!(candidates.contains(&"com.example.App".to_string()));
|
for test in [
|
||||||
assert!(candidates.contains(&"com-example-App".to_string()));
|
"com.example.App",
|
||||||
assert!(candidates.contains(&"com_example_App".to_string()));
|
"com-example-App",
|
||||||
assert!(candidates.contains(&"Example App".to_string()));
|
"com_example_App",
|
||||||
assert!(candidates.contains(&"Example".to_string()));
|
"Example App",
|
||||||
assert!(candidates.contains(&"App".to_string()));
|
"Example",
|
||||||
|
"App",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
candidates
|
||||||
|
.iter()
|
||||||
|
.any(|c| c.to_ascii_lowercase() == test.to_ascii_lowercase()),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -985,7 +996,7 @@ Icon=vmware-workstation\n\
|
||||||
|
|
||||||
let resolved = resolve_desktop_entry(&mut cache, &ctx, &DesktopResolveOptions::default());
|
let resolved = resolve_desktop_entry(&mut cache, &ctx, &DesktopResolveOptions::default());
|
||||||
|
|
||||||
assert_eq!(resolved.id(), "vmware-workstation.desktop");
|
assert_eq!(resolved.id(), "vmware-workstation");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue