chore: cleanup, upgrade to latest iced and deps
This commit is contained in:
parent
fd064d6743
commit
b8a5ccbd8f
3 changed files with 1396 additions and 926 deletions
2251
Cargo.lock
generated
2251
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "honeycomb-bg"
|
||||
name = "honeycomb-home"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.13.1", features = [ "image" ] }
|
||||
iced_layershell = "0.13.7"
|
||||
iced = { version = "0.14.0", features = [ "image" ] }
|
||||
iced_layershell = "0.14.2"
|
||||
|
|
|
|||
65
src/main.rs
65
src/main.rs
|
|
@ -1,20 +1,31 @@
|
|||
use iced::ContentFit;
|
||||
use iced::widget::image::Handle;
|
||||
use iced::widget::{button, column, row, stack, text, text_input};
|
||||
use iced::{Element, Event, Length, Task as Command, Theme, event, widget::image};
|
||||
use iced_layershell::Application;
|
||||
use iced_layershell::reexport::{Anchor, Layer};
|
||||
use iced_layershell::settings::{LayerShellSettings, Settings, StartMode};
|
||||
use iced_layershell::to_layer_message;
|
||||
use iced::{
|
||||
ContentFit, Element, Task as Command,
|
||||
widget::{
|
||||
image::{self, Handle},
|
||||
stack, text,
|
||||
},
|
||||
};
|
||||
use iced_layershell::{
|
||||
Settings, application,
|
||||
reexport::{Anchor, Layer},
|
||||
settings::{LayerShellSettings, StartMode},
|
||||
to_layer_message,
|
||||
};
|
||||
|
||||
pub fn main() -> Result<(), iced_layershell::Error> {
|
||||
let binded_output_name = std::env::args().nth(1);
|
||||
let start_mode = match binded_output_name {
|
||||
let bound_output_name = std::env::args().nth(1);
|
||||
let start_mode = match bound_output_name {
|
||||
Some(output) => StartMode::TargetScreen(output),
|
||||
None => StartMode::Active,
|
||||
};
|
||||
|
||||
Counter::run(Settings {
|
||||
application(
|
||||
|| HoneycombHome {},
|
||||
HoneycombHome::namespace,
|
||||
HoneycombHome::update,
|
||||
HoneycombHome::view,
|
||||
)
|
||||
.settings(Settings {
|
||||
layer_settings: LayerShellSettings {
|
||||
size: Some((0, 0)),
|
||||
exclusive_zone: 0,
|
||||
|
|
@ -25,34 +36,20 @@ pub fn main() -> Result<(), iced_layershell::Error> {
|
|||
},
|
||||
..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]
|
||||
#[derive(Debug, Clone)]
|
||||
enum Message {
|
||||
IcedEvent(Event),
|
||||
}
|
||||
enum Message {}
|
||||
|
||||
impl Application for Counter {
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
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)
|
||||
impl HoneycombHome {
|
||||
fn namespace() -> String {
|
||||
String::from("honeycomb home")
|
||||
}
|
||||
|
||||
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!(
|
||||
"res/default_background.png"
|
||||
) as &[u8]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue