diff --git a/.gitignore b/.gitignore index ea8c4bf..2d5df85 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.direnv diff --git a/Cargo.lock b/Cargo.lock index 4baaff9..8737f09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1138,6 +1138,7 @@ dependencies = [ "iced_style", "log", "raw-window-handle", + "sysinfo", "thiserror", "web-sys", "winapi", @@ -1626,6 +1627,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -2387,6 +2397,21 @@ dependencies = [ "libc", ] +[[package]] +name = "sysinfo" +version = "0.28.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "winapi", +] + [[package]] name = "termcolor" version = "1.3.0" diff --git a/Cargo.toml b/Cargo.toml index 09ff4cb..e016fae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -iced = { version = "0.10.0", features = ["image", "debug"] } +iced = { version = "0.10.0", features = ["image", "debug", "system"] } iced_aw = "0.7.0" iced_winit = "0.10.0" diff --git a/shell.nix b/shell.nix index 94dc6cb..f7c235c 100644 --- a/shell.nix +++ b/shell.nix @@ -6,6 +6,11 @@ mkShell rec { nativeBuildInputs = [ gtk-layer-shell gtk3 + vulkan-loader + wayland + wayland-protocols + libxkbcommon + pkg-config ]; buildInputs = [ @@ -13,13 +18,12 @@ mkShell rec { stdenv gnumake gdb - pkg-config makeWrapper - + vulkan-headers vulkan-loader - wayland - wayland-protocols - libxkbcommon + vulkan-tools + libGL + # podofo mpv ffmpeg_5-full diff --git a/src/main.rs b/src/main.rs index 667004b..3ad7aac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,31 +1,91 @@ -use iced::executor; +use iced::widget::{button, column, row, Button, Column, Container, Row, Text}; +use iced::{executor, Alignment, Length, Rectangle, Renderer}; use iced::{Application, Command, Element, Settings, Theme}; +use iced_aw::native::TabBar; +use iced_aw::split::Axis; +use iced_aw::{split, Split}; fn main() -> iced::Result { + std::env::set_var("WINIT_UNIX_BACKEND", "wayland"); App::run(Settings::default()) } -struct App; +struct App { + divider_position: Option, +} + +#[derive(Debug, Clone)] +enum Message { + OnVerResize(u16), +} impl Application for App { type Executor = executor::Default; type Flags = (); - type Message = (); + type Message = Message; type Theme = Theme; fn new(_flags: ()) -> (App, Command) { - (App, Command::none()) + ( + App { + divider_position: None, + }, + Command::none(), + ) } fn title(&self) -> String { String::from("A cool application") } - fn update(&mut self, _message: Self::Message) -> Command { + fn update(&mut self, message: Message) -> Command { + match message { + Message::OnVerResize(position) => self.divider_position = Some(position), + }; Command::none() } - fn view(&self) -> Element { - "Hello, world!".into() + fn view(&self) -> Element { + let top: _ = Container::new( + row(vec![ + Button::::new("Edit") + .height(Length::Fill) + .padding(10) + .into(), + Button::new("Present") + .height(Length::Fill) + .padding(10) + .into(), + Button::new("Close Library") + .height(Length::Fill) + .padding(10) + .into(), + ]) + .width(Length::Fill) + .height(Length::Fill) + .align_items(Alignment::End), + ); + let first = Container::new(Text::new("First")) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y(); + let second = Container::new(Text::new("Second")) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y(); + Split::new( + first, + second, + self.divider_position, + Axis::Vertical, + Message::OnVerResize, + ) + .into() + } + + fn theme(&self) -> Self::Theme { + Theme::Dark } }