Add panel-wide styles and the Morph hub (#26)

Panel appearance now applies to the whole panel, with seven styles: Floating, Capsules, Notch, Edge to edge, Fused islands, Adaptive and Morph.

- Share composition, geometry, and motion through the renderer-independent `ferese-panel` crate, including native materials, input regions, and Settings previews.
- Add the Morph hub with media, calendar, notifications, controls, workspace previews, hover feedback, and attached mode. Keep recording and low-battery status visible and respect window clearance.
- Cache workspace preview geometry, draw thumbnails directly, centralize Morph transitions, and keep rendering settings local to each shell instance.
- Put Record Screen in the Morph header and show the display control only when an external monitor is connected. Update panel documentation, the desktop screenshot, and native check style names.

Local validation included 660 compositor tests, 191 shell tests, isolated preview-cache checks, GPU Morph captures at 1×/1.25×/1.5×, formatting, and Clippy with warnings denied. The final header change passed all 23 Morph tests. Release workflow jobs are skipped for this PR.
This commit is contained in:
Samuel Onoja authored and GitHub committed 2026-10-12 01:31:34 +01:00
1 parent 42c3b290dd
commit e22f0ebef9
131 files changed
+12562 -1634

No files matched your search

+43 -19
View File
@@ -94,6 +94,8 @@ enum InitialPage {
#[derive(Clone, Debug)]
enum Message {
ReadRenderScale(cosmic::iced::window::Id),
RenderScale(f32),
Connections(connections::Input),
ConnectionsReady(Result<std::sync::Arc<connections::Client>, String>),
ConnectionsRefreshed(Box<connections::Snapshot>),
@@ -114,9 +116,9 @@ enum Message {
Change(Edit),
PanelClearSelection,
PanelPage(panel_controls::PanelPage),
PanelSelect(ferese_config::panel::ItemId),
PanelGroupSelect(ferese_config::panel::GroupId),
PanelPreviewResolved(ferese_config::panel::layout::Resolution),
PanelSelect(ferese_panel::ItemId),
PanelGroupSelect(ferese_panel::GroupId),
PanelPreviewResolved(ferese_panel::layout::Resolution),
PanelPreviewOverflow,
PanelEdit(panel_edit::Action),
Draft(String, String),
@@ -159,6 +161,7 @@ struct App {
display_selection: Option<String>,
display_error: Option<String>,
core: Core,
render_scale: f64,
path: PathBuf,
current: Snapshot,
draft: Snapshot,
@@ -187,10 +190,10 @@ struct App {
undo_revision: u64,
auto_details: bool,
advanced_theme: bool,
panel_selection: Option<ferese_config::panel::ItemId>,
panel_selection: Option<ferese_panel::ItemId>,
panel_page: panel_controls::PanelPage,
panel_group_selection: Option<ferese_config::panel::GroupId>,
panel_preview_resolution: ferese_config::panel::layout::Resolution,
panel_group_selection: Option<ferese_panel::GroupId>,
panel_preview_resolution: ferese_panel::layout::Resolution,
panel_preview_overflow: bool,
theme_file_target: usize,
wallpaper: wallpaper_controls::State,
@@ -263,6 +266,7 @@ impl cosmic::Application for App {
display_selection: None,
display_error: None,
core,
render_scale: 1.,
path,
draft: current.clone(),
current,
@@ -326,6 +330,13 @@ impl cosmic::Application for App {
fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::ReadRenderScale(id) => {
return cosmic::iced::window::scale_factor(id)
.map(|scale| cosmic::Action::App(Message::RenderScale(scale)));
}
Message::RenderScale(scale) if scale.is_finite() && scale > 0. && scale <= 16. => {
self.render_scale = f64::from(scale);
}
Message::Connections(input) => return self.connections_input(input),
Message::ConnectionsReady(result) => return self.connections_ready(result),
Message::ConnectionsRefreshed(snapshot) => self.connections_refreshed(*snapshot),
@@ -889,6 +900,21 @@ impl cosmic::Application for App {
fn subscription(&self) -> cosmic::iced::Subscription<Message> {
cosmic::iced::Subscription::batch([
cosmic::iced::event::listen_with(|event, _, id| match event {
cosmic::iced::Event::Window(cosmic::iced::window::Event::Opened { .. }) => {
Some(Message::ReadRenderScale(id))
}
cosmic::iced::Event::Window(cosmic::iced::window::Event::Rescaled(scale)) => {
Some(Message::RenderScale(scale))
}
cosmic::iced::Event::PlatformSpecific(cosmic::iced::event::PlatformSpecific::Wayland(
cosmic::iced::event::wayland::Event::Output(
cosmic::iced::event::wayland::OutputEvent::InfoUpdate(_),
_,
),
)) => Some(Message::ReadRenderScale(id)),
_ => None,
}),
if self.sidebar_open {
cosmic::iced::event::listen_with(|event, _, _| match event {
cosmic::iced::Event::Keyboard(cosmic::iced::keyboard::Event::KeyPressed {
@@ -1102,7 +1128,7 @@ mod tests {
let _ = app.update(Message::Range(field.clone(), 23.));
assert_eq!(app.draft.source, before);
let _ = app.update(Message::Release(field));
let radii: ferese_config::panel::CornerRadii =
let radii: ferese_panel::CornerRadii =
serde_json::from_value(app.draft.item("panels.0.corner_radius").unwrap().clone()).unwrap();
assert_eq!(radii.0, [4., 8., 23., 16.]);
assert!(app.ranges.is_empty());
@@ -1111,7 +1137,7 @@ mod tests {
#[test]
fn pending_panel_moves_save_both_groups_together_and_keep_the_selected_instance() {
use ferese_config::panel::{GroupId, ItemId};
use ferese_panel::{GroupId, ItemId};
let mut app = app();
let mut initial = Snapshot::parse(String::new()).unwrap();
initial.edit(&panel_controls::initialize(&initial).unwrap()).unwrap();
@@ -1139,13 +1165,13 @@ mod tests {
assert!(app.saving, "the complete queued draft is saved once");
assert!(app.pending.is_empty());
assert_eq!(app.draft.doc.value(), &expected);
let panels: Vec<ferese_config::panel::Panel> =
let panels: Vec<ferese_panel::Panel> =
serde_json::from_value(app.draft.item("panels").unwrap().clone()).unwrap();
ferese_config::panel::validate(&panels).unwrap();
ferese_panel::validate(&panels).unwrap();
assert_eq!(panels[0].start.groups[1].items[1].id, id);
assert_eq!(
panels[0].start.groups[1].items[1].overflow,
ferese_config::panel::OverflowPolicy::Always
ferese_panel::OverflowPolicy::Always
);
assert!(!panels[0].end.groups[0].items.iter().any(|item| item.id == id));
}
@@ -1181,7 +1207,7 @@ mod tests {
};
app.panel_page = panel_controls::PanelPage::Arrange;
let collapsed = nodes(&app);
let id = ferese_config::panel::ItemId("clock".into());
let id = ferese_panel::ItemId("clock".into());
let _ = app.update(Message::PanelSelect(id.clone()));
let expanded = nodes(&app);
assert!(expanded > collapsed);
@@ -1193,7 +1219,7 @@ mod tests {
#[test]
fn pending_group_moves_and_style_changes_save_one_coherent_draft() {
use ferese_config::panel::GroupId;
use ferese_panel::GroupId;
let mut app = app();
let mut initial = Snapshot::parse(String::new()).unwrap();
initial.edit(&panel_controls::initialize(&initial).unwrap()).unwrap();
@@ -1225,7 +1251,7 @@ mod tests {
fn selecting_a_generated_preview_item_does_not_save_the_composition() {
let mut app = app();
app.saving = true;
let id = ferese_config::panel::ItemId("clock".into());
let id = ferese_panel::ItemId("clock".into());
let _ = app.update(Message::PanelSelect(id.clone()));
assert_eq!(app.panel_selection, Some(id));
assert!(app.draft.item("panels").is_none());
@@ -1244,19 +1270,17 @@ mod tests {
assert!(app.draft.item("panels").is_none());
}
app.saving = true;
let _ = app.update(Message::PanelSelect(ferese_config::panel::ItemId("clock".into())));
let _ = app.update(Message::PanelSelect(ferese_panel::ItemId("clock".into())));
assert_eq!(app.panel_page, panel_controls::PanelPage::Arrange);
assert!(app.panel_group_selection.is_none());
let _ = app.update(Message::PanelGroupSelect(ferese_config::panel::GroupId(
"status".into(),
)));
let _ = app.update(Message::PanelGroupSelect(ferese_panel::GroupId("status".into())));
assert!(app.panel_selection.is_none());
assert_eq!(app.panel_page, panel_controls::PanelPage::Arrange);
}
#[test]
fn dropped_items_follow_queued_group_moves_and_are_saved_once() {
use ferese_config::panel::{GroupId, ItemId};
use ferese_panel::{GroupId, ItemId};
let mut app = app();
let mut initial = Snapshot::parse(String::new()).unwrap();
initial.edit(&panel_controls::initialize(&initial).unwrap()).unwrap();