Skip to content

Commit d3f0def

Browse files
committed
chore: updates after iced rebase
1 parent a91fc32 commit d3f0def

File tree

41 files changed

+1701
-2297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1701
-2297
lines changed

Cargo.lock

Lines changed: 1058 additions & 1516 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ cosmic-applets-config = { path = "cosmic-applets-config" }
3030
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = [
3131
"client",
3232
], rev = "d0e95be" }
33-
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", default-features = false }
34-
# cosmic-time = { path = "../cosmic-time", default-features = false ] }
3533

3634
futures = "0.3"
3735
futures-util = "0.3"
@@ -59,24 +57,26 @@ tracing = "0.1"
5957
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
6058
tracing-log = "0.2.0"
6159
tokio = { version = "1.49.0", features = ["full"] }
60+
# cosmic-config = { path = "../libcosmic/cosmic-config" }
6261
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
6362
serde = { version = "1.0.228", features = ["derive"] }
6463

6564
[profile.release]
66-
opt-level = 3
67-
panic = "abort"
68-
lto = "thin"
65+
# opt-level = 3
66+
# panic = "abort"
67+
# lto = "thin"
68+
opt-level = 1
6969

7070
[workspace.metadata.cargo-machete]
7171
ignored = ["libcosmic"]
7272

7373
# [patch."https://github.com/pop-os/libcosmic"]
74-
# cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "" }
75-
# libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "" }
76-
# iced_futures = { git = "https://github.com/pop-os/libcosmic//", branch = "" }
7774
# cosmic-config = { path = "../libcosmic/cosmic-config" }
7875
# libcosmic = { path = "../libcosmic" }
7976
# iced_futures = { path = "../libcosmic/iced/futures" }
77+
# cosmic-config = { git = "https://github.com/pop-os/libcosmic//" }
78+
# libcosmic = { git = "https://github.com/pop-os/libcosmic//" }
79+
# iced_futures = { git = "https://github.com/pop-os/libcosmic//" }
8080

8181
# [patch."https://github.com/pop-os/winit.git"]
8282
# winit = { git = "https://github.com/rust-windowing/winit.git", rev = "241b7a80bba96c91fa3901729cd5dec66abb9be4" }

cosmic-app-list/src/app.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use cctk::{
1919
workspace::v1::client::ext_workspace_handle_v1::ExtWorkspaceHandleV1,
2020
},
2121
};
22-
use cosmic::desktop::fde::{self, DesktopEntry, get_languages_from_env, unicase::Ascii};
2322
use cosmic::{
2423
Apply, Element, Task, app,
2524
applet::{
@@ -34,20 +33,27 @@ use cosmic::{
3433
clipboard::mime::{AllowedMimeTypes, AsMimeTypes},
3534
event::listen_with,
3635
platform_specific::shell::commands::popup::{destroy_popup, get_popup},
37-
widget::{Column, Row, column, mouse_area, row, stack, vertical_rule, vertical_space},
36+
widget::{
37+
Column, Row, column, mouse_area, row, rule::vertical as vertical_rule,
38+
space::horizontal as horizontal_space, space::vertical as vertical_space, stack,
39+
},
3840
window,
3941
},
4042
iced_runtime::{core::event, dnd::peek_dnd},
4143
surface,
4244
theme::{self, Button, Container},
4345
widget::{
44-
DndDestination, Image, button, container, divider, dnd_source, horizontal_space,
46+
DndDestination, Image, button, container, divider, dnd_source,
4547
icon::{self, from_name},
4648
image::Handle,
4749
rectangle_tracker::{RectangleTracker, RectangleUpdate, rectangle_tracker_subscription},
4850
svg, text,
4951
},
5052
};
53+
use cosmic::{
54+
desktop::fde::{self, DesktopEntry, get_languages_from_env, unicase::Ascii},
55+
widget::DndSource,
56+
};
5157
use cosmic_app_list_config::{APP_ID, AppListConfig};
5258
use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::State;
5359
use futures::future::pending;
@@ -295,7 +301,7 @@ impl DockItem {
295301

296302
let path = desktop_info.path.clone();
297303
let icon_button = if dnd_source_enabled && interaction_enabled {
298-
dnd_source(icon_button)
304+
DndSource::with_id(icon_button, cosmic::widget::Id::new("asdfasdfadfs"))
299305
.window(window_id)
300306
.drag_icon(move |_| {
301307
(
@@ -2409,7 +2415,7 @@ impl cosmic::Application for CosmicAppList {
24092415
])
24102416
}
24112417

2412-
fn style(&self) -> Option<cosmic::iced_runtime::Appearance> {
2418+
fn style(&self) -> Option<iced::theme::Style> {
24132419
Some(cosmic::applet::style())
24142420
}
24152421

cosmic-app-list/src/wayland_subscription.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use cctk::{
1313
};
1414
use cosmic::{
1515
iced::{self, Subscription, stream},
16-
iced_core::image::Bytes,
16+
iced_core::Bytes,
1717
};
1818
use image::EncodableLayout;
1919

@@ -31,16 +31,15 @@ pub static WAYLAND_RX: LazyLock<Mutex<Option<UnboundedReceiver<WaylandUpdate>>>>
3131
LazyLock::new(|| Mutex::new(None));
3232

3333
pub fn wayland_subscription() -> iced::Subscription<WaylandUpdate> {
34-
Subscription::run_with_id(
35-
std::any::TypeId::of::<WaylandUpdate>(),
34+
Subscription::run_with(std::any::TypeId::of::<WaylandUpdate>(), |_| {
3635
stream::channel(50, move |mut output| async move {
3736
let mut state = State::Waiting;
3837

3938
loop {
4039
state = start_listening(state, &mut output).await;
4140
}
42-
}),
43-
)
41+
})
42+
})
4443
}
4544

4645
pub enum State {

cosmic-applet-a11y/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2024"
77
anyhow.workspace = true
88
cctk.workspace = true
99
cosmic-protocols.workspace = true
10-
cosmic-time.workspace = true
1110
i18n-embed-fl.workspace = true
1211
i18n-embed.workspace = true
1312
libcosmic.workspace = true
@@ -19,6 +18,8 @@ tracing.workspace = true
1918

2019
[dependencies.cosmic-settings-a11y-manager-subscription]
2120
git = "https://github.com/pop-os/cosmic-settings"
21+
# path = "../../cosmic-settings/subscriptions/a11y-manager"
2222

2323
[dependencies.cosmic-settings-accessibility-subscription]
2424
git = "https://github.com/pop-os/cosmic-settings"
25+
# path = "../../cosmic-settings/subscriptions/accessibility"

cosmic-applet-a11y/src/app.rs

Lines changed: 36 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,16 @@ use cosmic::{
2222
},
2323
surface,
2424
theme::{self, CosmicTheme},
25-
widget::{Column, divider, text},
25+
widget::{Column, divider, text, toggler},
2626
};
2727

2828
use cosmic_settings_a11y_manager_subscription::{
2929
self as cosmic_a11y_manager, AccessibilityEvent, AccessibilityRequest, ColorFilter,
3030
};
3131
use cosmic_settings_accessibility_subscription::{self as accessibility};
32-
use cosmic_time::{Instant, Timeline, anim, chain, id};
3332
use std::sync::LazyLock;
3433
use tokio::sync::mpsc::UnboundedSender;
3534

36-
static READER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
37-
static FILTER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
38-
static HC_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
39-
static MAGNIFIER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
40-
static INVERT_COLORS_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
41-
4235
pub fn run() -> cosmic::iced::Result {
4336
cosmic::applet::run::<CosmicA11yApplet>(())
4437
}
@@ -54,7 +47,6 @@ struct CosmicA11yApplet {
5447
dbus_sender: Option<UnboundedSender<accessibility::Request>>,
5548
wayland_sender: Option<calloop::channel::Sender<AccessibilityRequest>>,
5649
wayland_protocol_version: Option<u32>,
57-
timeline: Timeline,
5850
token_tx: Option<channel::Sender<TokenRequest>>,
5951
screen_filter_active: bool,
6052
}
@@ -63,12 +55,11 @@ struct CosmicA11yApplet {
6355
enum Message {
6456
TogglePopup,
6557
CloseRequested(window::Id),
66-
HighContrastEnabled(chain::Toggler, bool),
67-
ScreenReaderEnabled(chain::Toggler, bool),
68-
MagnifierEnabled(chain::Toggler, bool),
69-
InvertedColorsEnabled(chain::Toggler, bool),
70-
FilterColorsEnabled(chain::Toggler, bool),
71-
Frame(Instant),
58+
HighContrastEnabled(bool),
59+
ScreenReaderEnabled(bool),
60+
MagnifierEnabled(bool),
61+
InvertedColorsEnabled(bool),
62+
FilterColorsEnabled(bool),
7263
Token(TokenUpdate),
7364
OpenSettings,
7465
DBusUpdate(accessibility::Response),
@@ -104,28 +95,24 @@ impl cosmic::Application for CosmicA11yApplet {
10495

10596
fn update(&mut self, message: Self::Message) -> app::Task<Self::Message> {
10697
match message {
107-
Message::Frame(now) => self.timeline.now(now),
108-
Message::ScreenReaderEnabled(chain, enabled) => {
98+
Message::ScreenReaderEnabled(enabled) => {
10999
if let Some(tx) = &self.dbus_sender {
110-
self.timeline.set_chain(chain).start();
111100
self.reader_enabled = enabled;
112101
let _ = tx.send(accessibility::Request::ScreenReader(enabled));
113102
} else {
114103
self.reader_enabled = false;
115104
}
116105
}
117-
Message::MagnifierEnabled(chain, enabled) => {
106+
Message::MagnifierEnabled(enabled) => {
118107
if let Some(tx) = &self.wayland_sender {
119-
self.timeline.set_chain(chain).start();
120108
self.magnifier_enabled = enabled;
121109
let _ = tx.send(AccessibilityRequest::Magnifier(enabled));
122110
} else {
123111
self.magnifier_enabled = false;
124112
}
125113
}
126-
Message::InvertedColorsEnabled(chain, enabled) => {
114+
Message::InvertedColorsEnabled(enabled) => {
127115
if let Some(tx) = &self.wayland_sender {
128-
self.timeline.set_chain(chain).start();
129116
self.inverted_colors_enabled = enabled;
130117
let _ = tx.send(AccessibilityRequest::ScreenFilter {
131118
inverted: enabled,
@@ -135,9 +122,8 @@ impl cosmic::Application for CosmicA11yApplet {
135122
self.inverted_colors_enabled = false;
136123
}
137124
}
138-
Message::FilterColorsEnabled(chain, enabled) => {
125+
Message::FilterColorsEnabled(enabled) => {
139126
if let Some(sender) = self.wayland_sender.as_ref() {
140-
self.timeline.set_chain(chain).start();
141127
self.screen_filter_active = enabled;
142128
let _ = sender.send(AccessibilityRequest::ScreenFilter {
143129
inverted: self.inverted_colors_enabled,
@@ -149,8 +135,6 @@ impl cosmic::Application for CosmicA11yApplet {
149135
if let Some(p) = self.popup.take() {
150136
return destroy_popup(p);
151137
} else {
152-
self.timeline = Timeline::new();
153-
154138
let new_id = window::Id::unique();
155139
self.popup.replace(new_id);
156140

@@ -170,13 +154,13 @@ impl cosmic::Application for CosmicA11yApplet {
170154
self.popup = None;
171155
}
172156
}
173-
Message::HighContrastEnabled(chain, enabled) => {
157+
Message::HighContrastEnabled(enabled) => {
174158
if self.core.system_theme().cosmic().is_high_contrast == enabled
175159
|| self.high_contrast.is_some_and(|hc| hc == enabled)
176160
{
177161
return Task::none();
178162
}
179-
self.timeline.set_chain(chain).start();
163+
180164
self.high_contrast = Some(enabled);
181165

182166
_ = std::thread::spawn(move || {
@@ -319,62 +303,44 @@ impl cosmic::Application for CosmicA11yApplet {
319303
} = theme::active().cosmic().spacing;
320304

321305
let reader_toggle = padded_control(
322-
anim!(
323-
READER_TOGGLE,
324-
&self.timeline,
325-
fl!("screen-reader"),
326-
self.reader_enabled,
327-
Message::ScreenReaderEnabled,
328-
)
329-
.text_size(14)
330-
.width(Length::Fill),
306+
toggler(self.reader_enabled)
307+
.on_toggle(Message::ScreenReaderEnabled)
308+
.text_size(14)
309+
.width(Length::Fill)
310+
.label(fl!("screen-reader")),
331311
);
332312
let magnifier_toggle = padded_control(
333-
anim!(
334-
MAGNIFIER_TOGGLE,
335-
&self.timeline,
336-
fl!("magnifier"),
337-
self.magnifier_enabled,
338-
Message::MagnifierEnabled,
339-
)
340-
.text_size(14)
341-
.width(Length::Fill),
313+
toggler(self.magnifier_enabled)
314+
.on_toggle(Message::MagnifierEnabled)
315+
.text_size(14)
316+
.width(Length::Fill)
317+
.label(fl!("magnifier")),
342318
);
343319
let invert_colors_toggle = padded_control(
344-
anim!(
345-
INVERT_COLORS_TOGGLE,
346-
&self.timeline,
347-
fl!("invert-colors"),
348-
self.inverted_colors_enabled,
349-
Message::InvertedColorsEnabled,
350-
)
351-
.text_size(14)
352-
.width(Length::Fill),
320+
toggler(self.inverted_colors_enabled)
321+
.on_toggle(Message::InvertedColorsEnabled)
322+
.text_size(14)
323+
.width(Length::Fill)
324+
.label(fl!("invert-colors")),
353325
);
354326

355327
let hc_colors_toggle = padded_control(
356-
anim!(
357-
HC_TOGGLE,
358-
&self.timeline,
359-
fl!("high-contrast"),
328+
toggler(
360329
self.high_contrast
361330
.unwrap_or(self.core.system_theme().cosmic().is_high_contrast),
362-
Message::HighContrastEnabled,
363331
)
332+
.on_toggle(Message::HighContrastEnabled)
333+
.label(fl!("high-contrast"))
364334
.text_size(14)
365335
.width(Length::Fill),
366336
);
367337

368338
let filter_colors_toggle = padded_control(
369-
anim!(
370-
FILTER_TOGGLE,
371-
&self.timeline,
372-
fl!("filter-colors"),
373-
self.screen_filter_active,
374-
Message::FilterColorsEnabled,
375-
)
376-
.text_size(14)
377-
.width(Length::Fill),
339+
toggler(self.screen_filter_active)
340+
.on_toggle(Message::FilterColorsEnabled)
341+
.label(fl!("filter-colors"))
342+
.width(Length::Fill)
343+
.text_size(14),
378344
);
379345

380346
let content_list = Column::with_capacity(5)
@@ -406,9 +372,6 @@ impl cosmic::Application for CosmicA11yApplet {
406372
Subscription::batch([
407373
accessibility::subscription().map(Message::DBusUpdate),
408374
backend::wayland::a11y_subscription().map(Message::WaylandUpdate),
409-
self.timeline
410-
.as_subscription()
411-
.map(|(_, now)| Message::Frame(now)),
412375
activation_token_subscription(0).map(Message::Token),
413376
])
414377
}
@@ -417,7 +380,7 @@ impl cosmic::Application for CosmicA11yApplet {
417380
Some(Message::CloseRequested(id))
418381
}
419382

420-
fn style(&self) -> Option<cosmic::iced_runtime::Appearance> {
383+
fn style(&self) -> Option<cosmic::iced::theme::Style> {
421384
Some(cosmic::applet::style())
422385
}
423386
}

cosmic-applet-a11y/src/backend/wayland/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ pub enum WaylandUpdate {
2626
}
2727

2828
pub fn a11y_subscription() -> iced::Subscription<WaylandUpdate> {
29-
Subscription::run_with_id(
30-
std::any::TypeId::of::<WaylandUpdate>(),
29+
Subscription::run_with(std::any::TypeId::of::<WaylandUpdate>(), |_| {
3130
stream::channel(50, move |mut output| async move {
3231
let mut state = State::Waiting;
3332

3433
loop {
3534
state = start_listening(state, &mut output).await;
3635
}
37-
}),
38-
)
36+
})
37+
})
3938
}
4039

4140
async fn start_listening(

0 commit comments

Comments
 (0)