cargo fmt
This commit is contained in:
parent
68ac7ea809
commit
e5bdc727db
1 changed files with 17 additions and 22 deletions
|
|
@ -19,6 +19,7 @@ use cctk::{
|
|||
workspace::v1::client::ext_workspace_handle_v1::ExtWorkspaceHandleV1,
|
||||
},
|
||||
};
|
||||
use cosmic::desktop::fde::unicase::Ascii;
|
||||
use cosmic::desktop::fde::{get_languages_from_env, DesktopEntry};
|
||||
use cosmic::{
|
||||
app,
|
||||
|
|
@ -57,7 +58,6 @@ use iced::{widget::container, Alignment, Background, Length};
|
|||
use itertools::Itertools;
|
||||
use rand::{rng, Rng};
|
||||
use std::{borrow::Cow, collections::HashMap, path::PathBuf, rc::Rc, str::FromStr, time::Duration};
|
||||
use cosmic::desktop::fde::unicase::Ascii;
|
||||
use switcheroo_control::Gpu;
|
||||
use tokio::time::sleep;
|
||||
use url::Url;
|
||||
|
|
@ -1105,7 +1105,8 @@ impl cosmic::Application for CosmicAppList {
|
|||
WaylandUpdate::Toplevel(event) => match event {
|
||||
ToplevelUpdate::Add(mut info) => {
|
||||
let unicase_appid = fde::unicase::Ascii::new(&*info.app_id);
|
||||
let new_desktop_info = self.find_desktop_entry_for_toplevel(&info, unicase_appid);
|
||||
let new_desktop_info =
|
||||
self.find_desktop_entry_for_toplevel(&info, unicase_appid);
|
||||
|
||||
if let Some(t) = self
|
||||
.active_list
|
||||
|
|
@ -1178,7 +1179,10 @@ impl cosmic::Application for CosmicAppList {
|
|||
self.active_list.retain(|t| !t.toplevels.is_empty());
|
||||
|
||||
// find a new one for it
|
||||
let new_desktop_entry = self.find_desktop_entry_for_toplevel(&info, Ascii::new(&info.app_id));
|
||||
let new_desktop_entry = self.find_desktop_entry_for_toplevel(
|
||||
&info,
|
||||
Ascii::new(&info.app_id),
|
||||
);
|
||||
|
||||
if let Some(t) = self
|
||||
.active_list
|
||||
|
|
@ -2329,28 +2333,23 @@ impl CosmicAppList {
|
|||
focused_toplevels
|
||||
}
|
||||
|
||||
fn find_desktop_entry_for_toplevel(&mut self, info: &ToplevelInfo, unicase_appid: Ascii<&str>) -> DesktopEntry {
|
||||
fn find_desktop_entry_for_toplevel(
|
||||
&mut self,
|
||||
info: &ToplevelInfo,
|
||||
unicase_appid: Ascii<&str>,
|
||||
) -> DesktopEntry {
|
||||
match fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
Some(appid) => appid.clone(),
|
||||
None => {
|
||||
// Update desktop entries in case it was not found.
|
||||
|
||||
self.update_desktop_entries();
|
||||
match fde::find_app_by_id(
|
||||
&self.desktop_entries,
|
||||
unicase_appid,
|
||||
) {
|
||||
match fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
Some(appid) => appid.clone(),
|
||||
None => {
|
||||
tracing::error!(
|
||||
id = info.app_id,
|
||||
"could not find desktop entry for app"
|
||||
);
|
||||
tracing::error!(id = info.app_id, "could not find desktop entry for app");
|
||||
|
||||
let mut fallback_entry =
|
||||
fde::DesktopEntry::from_appid(
|
||||
info.app_id.clone(),
|
||||
);
|
||||
let mut fallback_entry = fde::DesktopEntry::from_appid(info.app_id.clone());
|
||||
|
||||
// proton opens games as steam_app_X, where X is either
|
||||
// the steam appid or "default". games with a steam appid
|
||||
|
|
@ -2359,8 +2358,7 @@ impl CosmicAppList {
|
|||
// under proton
|
||||
// in addition, try to match WINE entries who have its
|
||||
// appid = the full name of the executable (incl. .exe)
|
||||
let is_proton_game =
|
||||
info.app_id == "steam_app_default";
|
||||
let is_proton_game = info.app_id == "steam_app_default";
|
||||
if is_proton_game || info.app_id.ends_with(".exe") {
|
||||
for entry in &self.desktop_entries {
|
||||
let localised_name = entry
|
||||
|
|
@ -2372,10 +2370,7 @@ impl CosmicAppList {
|
|||
// if this is a proton game, we only want
|
||||
// to look for game entries
|
||||
if is_proton_game
|
||||
&& !entry
|
||||
.categories()
|
||||
.unwrap_or_default()
|
||||
.contains(&"Game")
|
||||
&& !entry.categories().unwrap_or_default().contains(&"Game")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue