init: initial commit
This commit is contained in:
commit
3b2ce2cba1
6 changed files with 4548 additions and 0 deletions
3
.cargo/config.toml
Normal file
3
.cargo/config.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[target.x86_64-unknown-linux-musl]
|
||||
rustflags = [ "-C", "target-feature=-crt-static" ]
|
||||
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
4459
Cargo.lock
generated
Normal file
4459
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "honeycomb-bg"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.13.1", features = [ "image" ] }
|
||||
iced_layershell = "0.13.7"
|
||||
77
src/main.rs
Normal file
77
src/main.rs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
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;
|
||||
|
||||
pub fn main() -> Result<(), iced_layershell::Error> {
|
||||
let binded_output_name = std::env::args().nth(1);
|
||||
let start_mode = match binded_output_name {
|
||||
Some(output) => StartMode::TargetScreen(output),
|
||||
None => StartMode::Active,
|
||||
};
|
||||
|
||||
Counter::run(Settings {
|
||||
layer_settings: LayerShellSettings {
|
||||
size: Some((0, 0)),
|
||||
exclusive_zone: 0,
|
||||
anchor: Anchor::all(),
|
||||
start_mode,
|
||||
layer: Layer::Background,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
struct Counter {}
|
||||
|
||||
// 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),
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Message) -> Command<Message> {
|
||||
match message {
|
||||
Message::IcedEvent(event) => {
|
||||
println!("hello {event:?}");
|
||||
Command::none()
|
||||
}
|
||||
|
||||
_ => Command::none(),
|
||||
}
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Message> {
|
||||
let background = image::Image::new(Handle::from_bytes(include_bytes!(
|
||||
"res/default_background.png"
|
||||
) as &[u8]))
|
||||
.content_fit(ContentFit::Cover);
|
||||
|
||||
stack!(background).push(text("hi :)")).into()
|
||||
}
|
||||
}
|
||||
BIN
src/res/default_background.png
Normal file
BIN
src/res/default_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
Loading…
Add table
Add a link
Reference in a new issue