trying to get a basic wayland setup
This commit is contained in:
parent
1af939a901
commit
c8a4642827
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
.direnv
|
||||||
|
|
25
Cargo.lock
generated
25
Cargo.lock
generated
|
@ -1138,6 +1138,7 @@ dependencies = [
|
||||||
"iced_style",
|
"iced_style",
|
||||||
"log",
|
"log",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
"sysinfo",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"winapi",
|
"winapi",
|
||||||
|
@ -1626,6 +1627,15 @@ dependencies = [
|
||||||
"minimal-lexical",
|
"minimal-lexical",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ntapi"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.45"
|
version = "0.1.45"
|
||||||
|
@ -2387,6 +2397,21 @@ dependencies = [
|
||||||
"libc",
|
"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]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.3.0"
|
version = "1.3.0"
|
||||||
|
|
|
@ -6,6 +6,6 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
iced = { version = "0.10.0", features = ["image", "debug"] }
|
iced = { version = "0.10.0", features = ["image", "debug", "system"] }
|
||||||
iced_aw = "0.7.0"
|
iced_aw = "0.7.0"
|
||||||
iced_winit = "0.10.0"
|
iced_winit = "0.10.0"
|
||||||
|
|
14
shell.nix
14
shell.nix
|
@ -6,6 +6,11 @@ mkShell rec {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
gtk-layer-shell
|
gtk-layer-shell
|
||||||
gtk3
|
gtk3
|
||||||
|
vulkan-loader
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
libxkbcommon
|
||||||
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
@ -13,13 +18,12 @@ mkShell rec {
|
||||||
stdenv
|
stdenv
|
||||||
gnumake
|
gnumake
|
||||||
gdb
|
gdb
|
||||||
pkg-config
|
|
||||||
makeWrapper
|
makeWrapper
|
||||||
|
vulkan-headers
|
||||||
vulkan-loader
|
vulkan-loader
|
||||||
wayland
|
vulkan-tools
|
||||||
wayland-protocols
|
libGL
|
||||||
libxkbcommon
|
|
||||||
# podofo
|
# podofo
|
||||||
mpv
|
mpv
|
||||||
ffmpeg_5-full
|
ffmpeg_5-full
|
||||||
|
|
74
src/main.rs
74
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::{Application, Command, Element, Settings, Theme};
|
||||||
|
use iced_aw::native::TabBar;
|
||||||
|
use iced_aw::split::Axis;
|
||||||
|
use iced_aw::{split, Split};
|
||||||
|
|
||||||
fn main() -> iced::Result {
|
fn main() -> iced::Result {
|
||||||
|
std::env::set_var("WINIT_UNIX_BACKEND", "wayland");
|
||||||
App::run(Settings::default())
|
App::run(Settings::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
struct App;
|
struct App {
|
||||||
|
divider_position: Option<u16>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
enum Message {
|
||||||
|
OnVerResize(u16),
|
||||||
|
}
|
||||||
|
|
||||||
impl Application for App {
|
impl Application for App {
|
||||||
type Executor = executor::Default;
|
type Executor = executor::Default;
|
||||||
type Flags = ();
|
type Flags = ();
|
||||||
type Message = ();
|
type Message = Message;
|
||||||
type Theme = Theme;
|
type Theme = Theme;
|
||||||
|
|
||||||
fn new(_flags: ()) -> (App, Command<Self::Message>) {
|
fn new(_flags: ()) -> (App, Command<Self::Message>) {
|
||||||
(App, Command::none())
|
(
|
||||||
|
App {
|
||||||
|
divider_position: None,
|
||||||
|
},
|
||||||
|
Command::none(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn title(&self) -> String {
|
fn title(&self) -> String {
|
||||||
String::from("A cool application")
|
String::from("A cool application")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _message: Self::Message) -> Command<Self::Message> {
|
fn update(&mut self, message: Message) -> Command<Message> {
|
||||||
|
match message {
|
||||||
|
Message::OnVerResize(position) => self.divider_position = Some(position),
|
||||||
|
};
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Self::Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
"Hello, world!".into()
|
let top: _ = Container::new(
|
||||||
|
row(vec![
|
||||||
|
Button::<Message, Renderer>::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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue