chore: cleanup, upgrade to latest iced and deps
This commit is contained in:
parent
fd064d6743
commit
23672cfc72
3 changed files with 1394 additions and 924 deletions
2251
Cargo.lock
generated
2251
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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"
|
||||||
|
|
|
||||||
61
src/main.rs
61
src/main.rs
|
|
@ -1,11 +1,16 @@
|
||||||
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 binded_output_name = std::env::args().nth(1);
|
||||||
|
|
@ -14,7 +19,13 @@ pub fn main() -> Result<(), iced_layershell::Error> {
|
||||||
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]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue