feat(startup_apps): fallback icon/name, removing cosmic applets from search list
This commit is contained in:
parent
5ec142a480
commit
8b5b2aca0a
1 changed files with 13 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
use cosmic::iced::{Alignment, Length};
|
use cosmic::iced::{Alignment, Length};
|
||||||
use cosmic::widget::{button, icon, settings, text, vertical_space};
|
use cosmic::widget::{button, icon, settings, text};
|
||||||
use cosmic::{widget, Apply, Element, Task};
|
use cosmic::{widget, Apply, Element, Task};
|
||||||
use cosmic_settings_page::section::Entity;
|
use cosmic_settings_page::section::Entity;
|
||||||
use cosmic_settings_page::{self as page, Content, Info, Section};
|
use cosmic_settings_page::{self as page, Content, Info, Section};
|
||||||
|
|
@ -328,15 +328,14 @@ impl Page {
|
||||||
{
|
{
|
||||||
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
||||||
|
|
||||||
if let Some(icon) = app.icon() {
|
row = row.push(icon::from_name(app.icon().unwrap_or("application-default")));
|
||||||
row = row.push(icon::from_name(icon));
|
|
||||||
} else {
|
|
||||||
row = row.push(vertical_space().height(16.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(name) = app.name(&startup_apps.locales) {
|
if let Some(name) = app.name(&startup_apps.locales) {
|
||||||
row = row.push(text(name));
|
row = row.push(text(name));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
row = row.push(text(&app.appid));
|
||||||
|
}
|
||||||
|
|
||||||
list = list.add(settings::flex_item_row(vec![
|
list = list.add(settings::flex_item_row(vec![
|
||||||
row.into(),
|
row.into(),
|
||||||
|
|
@ -387,15 +386,14 @@ fn apps() -> Section<crate::pages::Message> {
|
||||||
for app in apps {
|
for app in apps {
|
||||||
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
||||||
|
|
||||||
if let Some(icon) = app.icon() {
|
row = row.push(icon::from_name(app.icon().unwrap_or("application-default")));
|
||||||
row = row.push(icon::from_name(icon));
|
|
||||||
} else {
|
|
||||||
row = row.push(vertical_space().height(16.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(name) = app.name(&startup_apps.locales) {
|
if let Some(name) = app.name(&startup_apps.locales) {
|
||||||
row = row.push(text(name));
|
row = row.push(text(name));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
row = row.push(text(&app.appid));
|
||||||
|
}
|
||||||
|
|
||||||
section = section.add(settings::flex_item_row(vec![
|
section = section.add(settings::flex_item_row(vec![
|
||||||
row.into(),
|
row.into(),
|
||||||
|
|
@ -446,6 +444,10 @@ fn get_all_apps(locales: Vec<String>) -> Vec<DesktopEntry> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if entry.desktop_entry("X-CosmicApplet").is_some() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip if we can't run this in COSMIC
|
// skip if we can't run this in COSMIC
|
||||||
if let Some(only_show_in) = entry.only_show_in() {
|
if let Some(only_show_in) = entry.only_show_in() {
|
||||||
if !only_show_in.contains(&"COSMIC") {
|
if !only_show_in.contains(&"COSMIC") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue