chore: cleanup, upgrade to latest iced and deps
All checks were successful
build / test-debian (push) Successful in 1m43s
build / test-alpine (push) Successful in 5m24s

This commit is contained in:
user0-07161 2026-02-10 23:08:12 +01:00
parent fd064d6743
commit b8a5ccbd8f
3 changed files with 1396 additions and 926 deletions

2251
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
[package] [package]
name = "honeycomb-bg" name = "honeycomb-home"
version = "0.1.0" version = "0.1.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
iced = { version = "0.13.1", features = [ "image" ] } iced = { version = "0.14.0", features = [ "image" ] }
iced_layershell = "0.13.7" iced_layershell = "0.14.2"

View file

@ -1,20 +1,31 @@
use iced::ContentFit; use iced::{
use iced::widget::image::Handle; ContentFit, Element, Task as Command,
use iced::widget::{button, column, row, stack, text, text_input}; widget::{
use iced::{Element, Event, Length, Task as Command, Theme, event, widget::image}; image::{self, Handle},
use iced_layershell::Application; stack, text,
use iced_layershell::reexport::{Anchor, Layer}; },
use iced_layershell::settings::{LayerShellSettings, Settings, StartMode}; };
use iced_layershell::to_layer_message; use iced_layershell::{
Settings, application,
reexport::{Anchor, Layer},
settings::{LayerShellSettings, StartMode},
to_layer_message,
};
pub fn main() -> Result<(), iced_layershell::Error> { pub fn main() -> Result<(), iced_layershell::Error> {
let binded_output_name = std::env::args().nth(1); let bound_output_name = std::env::args().nth(1);
let start_mode = match binded_output_name { let start_mode = match bound_output_name {
Some(output) => StartMode::TargetScreen(output), Some(output) => StartMode::TargetScreen(output),
None => StartMode::Active, None => StartMode::Active,
}; };
Counter::run(Settings { application(
|| HoneycombHome {},
HoneycombHome::namespace,
HoneycombHome::update,
HoneycombHome::view,
)
.settings(Settings {
layer_settings: LayerShellSettings { layer_settings: LayerShellSettings {
size: Some((0, 0)), size: Some((0, 0)),
exclusive_zone: 0, exclusive_zone: 0,
@ -25,34 +36,20 @@ pub fn main() -> Result<(), iced_layershell::Error> {
}, },
..Default::default() ..Default::default()
}) })
.run()?;
Ok(())
} }
struct Counter {} struct HoneycombHome {}
// Because new iced delete the custom command, so now we make a macro crate to generate
// the Command
#[to_layer_message] #[to_layer_message]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum Message { enum Message {}
IcedEvent(Event),
}
impl Application for Counter { impl HoneycombHome {
type Message = Message; fn namespace() -> String {
type Flags = (); String::from("honeycomb home")
type Theme = Theme;
type Executor = iced::executor::Default;
fn new(_flags: ()) -> (Self, Command<Message>) {
(Self {}, Command::none())
}
fn namespace(&self) -> String {
String::from("project honeycomb home")
}
fn subscription(&self) -> iced::Subscription<Self::Message> {
event::listen().map(Message::IcedEvent)
} }
fn update(&mut self, message: Message) -> Command<Message> { fn update(&mut self, message: Message) -> Command<Message> {
@ -61,7 +58,7 @@ impl Application for Counter {
} }
} }
fn view(&self) -> Element<Message> { fn view(&self) -> Element<'_, Message> {
let background = image::Image::new(Handle::from_bytes(include_bytes!( let background = image::Image::new(Handle::from_bytes(include_bytes!(
"res/default_background.png" "res/default_background.png"
) as &[u8])) ) as &[u8]))