Skip to content
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

Use mime_app from libcosmic #667

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
80 changes: 20 additions & 60 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ filetime = { git = "https://github.com/jackpot51/filetime" }
# [patch.'https://github.com/pop-os/cosmic-text']
# cosmic-text = { path = "../cosmic-text" }

# [patch.'https://github.com/pop-os/libcosmic']
[patch.'https://github.com/pop-os/libcosmic']
# libcosmic = { path = "../libcosmic" }
libcosmic = { git = "https://github.com/jpttrssn/libcosmic", branch = "launch-app-in-term"}
# cosmic-config = { path = "../libcosmic/cosmic-config" }
# cosmic-theme = { path = "../libcosmic/cosmic-theme" }

Expand Down
22 changes: 17 additions & 5 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use cosmic::{
Alignment, Event, Length, Size, Subscription,
},
iced_runtime::clipboard,
style, theme,
mime_app, style, theme,
widget::{
self,
dnd_destination::DragId,
Expand Down Expand Up @@ -61,7 +61,7 @@ use crate::{
fl, home_dir,
key_bind::key_binds,
localize::LANGUAGE_SORTER,
menu, mime_app, mime_icon,
menu, mime_icon,
mounter::{MounterAuth, MounterItem, MounterItems, MounterKey, MounterMessage, MOUNTERS},
operation::{Controller, Operation, OperationSelection, ReplaceResult},
spawn_detached::spawn_detached,
Expand Down Expand Up @@ -1476,6 +1476,8 @@ impl Application for App {
tab_drag_id: DragId::new(),
};

mime_app::reload(Some(&LANGUAGE_SORTER));

let mut commands = vec![app.update_config()];

for location in flags.locations {
Expand Down Expand Up @@ -1547,37 +1549,44 @@ impl Application for App {
{
items.push(cosmic::widget::menu::Item::Button(
fl!("open"),
None,
NavMenuAction::Open(entity),
));
items.push(cosmic::widget::menu::Item::Button(
fl!("open-with"),
None,
NavMenuAction::OpenWith(entity),
));
} else {
items.push(cosmic::widget::menu::Item::Button(
fl!("open-in-new-tab"),
None,
NavMenuAction::OpenInNewTab(entity),
));
items.push(cosmic::widget::menu::Item::Button(
fl!("open-in-new-window"),
None,
NavMenuAction::OpenInNewWindow(entity),
));
}
items.push(cosmic::widget::menu::Item::Divider);
items.push(cosmic::widget::menu::Item::Button(
fl!("show-details"),
None,
NavMenuAction::Preview(entity),
));
items.push(cosmic::widget::menu::Item::Divider);
if favorite_index_opt.is_some() {
items.push(cosmic::widget::menu::Item::Button(
fl!("remove-from-sidebar"),
None,
NavMenuAction::RemoveFromSidebar(entity),
));
}
if matches!(location_opt, Some(Location::Trash)) {
items.push(cosmic::widget::menu::Item::Button(
fl!("empty-trash"),
None,
NavMenuAction::EmptyTrash,
));
}
Expand Down Expand Up @@ -2858,7 +2867,7 @@ impl Application for App {
let mut paths = Vec::with_capacity(recently_trashed.len());
let icon_sizes = self.config.tab.icon_sizes;

return cosmic::command::future(async move {
return cosmic::task::future(async move {
match tokio::task::spawn_blocking(move || Location::Trash.scan(icon_sizes))
.await
{
Expand Down Expand Up @@ -3713,8 +3722,11 @@ impl Application for App {
widget::row::with_children(vec![
widget::icon(app.icon.clone()).size(32).into(),
if app.is_default {
widget::text::body(fl!("default-app", name = app.name.as_str()))
.into()
widget::text::body(fl!(
"default-app",
name = Some(app.name.as_str())
))
.into()
} else {
widget::text::body(app.name.to_string()).into()
},
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub mod dialog;
mod key_bind;
mod localize;
mod menu;
mod mime_app;
pub mod mime_icon;
mod mounter;
mod mouse_area;
Expand Down
Loading