Merge remote-tracking branch 'upstream/master' into local/libcosmic-path-patch
# Conflicts: # Cargo.lock # Cargo.toml # src/app.rs # src/dialog.rs # src/menu.rs # src/tab.rs
This commit is contained in:
commit
1488e2b01b
43 changed files with 2154 additions and 1007 deletions
111
src/app.rs
111
src/app.rs
|
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic::app::{self, Core, Task, context_drawer};
|
||||
use cosmic::core::Auto;
|
||||
use cosmic::cosmic_config::{self, ConfigSet};
|
||||
use cosmic::iced::clipboard::dnd::DndAction;
|
||||
use cosmic::iced::core::SmolStr;
|
||||
|
|
@ -27,7 +28,7 @@ use cosmic::iced::{
|
|||
IcedMargin, IcedOutput, SctkLayerSurfaceSettings,
|
||||
},
|
||||
platform_specific::shell::wayland::commands::layer_surface::{
|
||||
Anchor, KeyboardInteractivity, Layer, destroy_layer_surface, get_layer_surface,
|
||||
Anchor, KeyboardInteractivity, Layer, destroy_layer_surface,
|
||||
},
|
||||
};
|
||||
use cosmic::widget::about::About;
|
||||
|
|
@ -2718,6 +2719,9 @@ impl Application for App {
|
|||
),
|
||||
]);
|
||||
|
||||
if matches!(flags.mode, Mode::Desktop) {
|
||||
core.set_auto_blur(Auto::Window | Auto::Popup);
|
||||
}
|
||||
let mut app = Self {
|
||||
core,
|
||||
about,
|
||||
|
|
@ -2836,8 +2840,16 @@ impl Application for App {
|
|||
cosmic::Action::App(Message::NavMenuAction(NavMenuAction::OpenInNewTab(entity)))
|
||||
})
|
||||
.context_menu(self.nav_context_menu())
|
||||
.close_icon(icon::from_name("media-eject-symbolic").size(16).icon())
|
||||
.into_container();
|
||||
.close_icon(icon::from_name("media-eject-symbolic").size(16).icon());
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
{
|
||||
nav = nav
|
||||
.window_id_maybe(self.core().main_window_id())
|
||||
.on_surface_action(|m| cosmic::Action::Cosmic(cosmic::app::Action::Surface(m)))
|
||||
}
|
||||
|
||||
let mut nav = nav.into_container();
|
||||
|
||||
if !self.core.is_condensed() {
|
||||
nav = nav.max_width(280);
|
||||
|
|
@ -2848,14 +2860,12 @@ impl Application for App {
|
|||
))
|
||||
}
|
||||
|
||||
fn nav_context_menu(
|
||||
&self,
|
||||
) -> Option<Vec<widget::menu::Tree<cosmic::Action<Self::Message>>>> {
|
||||
fn nav_context_menu(&self) -> Option<Vec<widget::menu::Tree<cosmic::Action<Self::Message>>>> {
|
||||
let items = self.nav_model.iter().map(|entity| {
|
||||
let favorite_index_opt = self.nav_model.data::<FavoriteIndex>(entity);
|
||||
let location_opt = self.nav_model.data::<Location>(entity);
|
||||
|
||||
let mut items = Vec::with_capacity(7);
|
||||
let mut items: Vec<widget::menu::Item<NavMenuAction, String>> = Vec::with_capacity(7);
|
||||
|
||||
if location_opt
|
||||
.and_then(Location::path_opt)
|
||||
|
|
@ -2982,10 +2992,14 @@ impl Application for App {
|
|||
})
|
||||
&& let Some(mounter) = MOUNTERS.get(&key)
|
||||
{
|
||||
return mounter.network_drive(uri.clone()).map(move |()| {
|
||||
cosmic::Action::App(Message::NetworkDriveOpenEntityAfterMount {
|
||||
entity,
|
||||
})
|
||||
return mounter.network_drive(uri.clone()).map(move |mounted| {
|
||||
if mounted {
|
||||
cosmic::Action::App(Message::NetworkDriveOpenEntityAfterMount {
|
||||
entity,
|
||||
})
|
||||
} else {
|
||||
cosmic::action::none()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -3896,7 +3910,7 @@ impl Application for App {
|
|||
Some((*mounter_key, self.network_drive_input.clone()));
|
||||
return mounter
|
||||
.network_drive(self.network_drive_input.clone())
|
||||
.map(|()| cosmic::action::none());
|
||||
.map(|_| cosmic::action::none());
|
||||
}
|
||||
log::warn!(
|
||||
"no mounter found for connecting to {:?}",
|
||||
|
|
@ -4909,9 +4923,10 @@ impl Application for App {
|
|||
use cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{
|
||||
Anchor, Gravity,
|
||||
};
|
||||
use cosmic::iced::runtime::platform_specific::wayland::popup::{
|
||||
use cosmic::{iced::runtime::platform_specific::wayland::popup::{
|
||||
SctkPopupSettings, SctkPositioner,
|
||||
};
|
||||
}, widget::menu::StyleSheet as _};
|
||||
|
||||
let window_id = WindowId::unique();
|
||||
self.windows.insert(
|
||||
window_id,
|
||||
|
|
@ -4921,10 +4936,24 @@ impl Application for App {
|
|||
)),
|
||||
);
|
||||
commands.push(self.update(Message::CheckClipboard));
|
||||
let t = self.core.system_theme();
|
||||
let styling = t.appearance(
|
||||
&cosmic::theme::menu_bar::MenuBarStyle::Default,
|
||||
false,
|
||||
);
|
||||
let rad = styling.menu_border_radius;
|
||||
|
||||
commands.push(self.update(Message::Surface(
|
||||
cosmic::surface::action::app_popup(
|
||||
|_: &Self| cosmic::surface::action::LiveSettings::default(),
|
||||
move |app: &mut Self| -> SctkPopupSettings {
|
||||
move |_| cosmic::surface::action::LiveSettings {
|
||||
corners: Some(iced::runtime::platform_specific::wayland::CornerRadius {
|
||||
top_left: rad[0] as u32,
|
||||
top_right: rad[1] as u32,
|
||||
bottom_left: rad[2] as u32,
|
||||
bottom_right: rad[3] as u32,
|
||||
}),
|
||||
..Default::default()
|
||||
}, move |app: &mut Self| -> SctkPopupSettings {
|
||||
let anchor_rect = Rectangle {
|
||||
x: point.x as i32,
|
||||
y: point.y as i32,
|
||||
|
|
@ -5694,24 +5723,37 @@ impl Application for App {
|
|||
.insert(surface_id, Window::new(WindowKind::Desktop(entity)));
|
||||
return Task::batch([
|
||||
command,
|
||||
get_layer_surface(SctkLayerSurfaceSettings {
|
||||
id: surface_id,
|
||||
layer: Layer::Bottom,
|
||||
keyboard_interactivity: KeyboardInteractivity::OnDemand,
|
||||
input_zone: None,
|
||||
anchor: Anchor::TOP | Anchor::BOTTOM | Anchor::LEFT | Anchor::RIGHT,
|
||||
output: IcedOutput::Output(output),
|
||||
namespace: "cosmic-files-applet".into(),
|
||||
size: Some((None, None)),
|
||||
margin: IcedMargin {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
exclusive_zone: 0,
|
||||
size_limits: Limits::NONE.min_width(1.0).min_height(1.0),
|
||||
}),
|
||||
cosmic::task::message(cosmic::action::cosmic(
|
||||
cosmic::app::Action::Surface(
|
||||
cosmic::surface::action::app_layer_shell(
|
||||
|_| Default::default(),
|
||||
move |_: &mut App| SctkLayerSurfaceSettings {
|
||||
id: surface_id,
|
||||
layer: Layer::Bottom,
|
||||
keyboard_interactivity: KeyboardInteractivity::OnDemand,
|
||||
input_zone: None,
|
||||
anchor: Anchor::TOP
|
||||
| Anchor::BOTTOM
|
||||
| Anchor::LEFT
|
||||
| Anchor::RIGHT,
|
||||
output: IcedOutput::Output(output.clone()),
|
||||
namespace: "cosmic-files-applet".into(),
|
||||
size: Some((None, None)),
|
||||
margin: IcedMargin {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
exclusive_zone: 0,
|
||||
size_limits: Limits::NONE
|
||||
.min_width(1.0)
|
||||
.min_height(1.0),
|
||||
},
|
||||
None,
|
||||
),
|
||||
),
|
||||
)),
|
||||
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
||||
overlap_notify(surface_id, true),
|
||||
]);
|
||||
|
|
@ -6898,7 +6940,6 @@ impl Application for App {
|
|||
})
|
||||
.drag_id(self.tab_drag_id),
|
||||
)
|
||||
.class(style::Container::Background)
|
||||
.width(Length::Fill)
|
||||
.padding([0, space_s]),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue