Allow X11 and Wayland per default

This commit is contained in:
Fabian Stamm 2024-08-18 23:50:48 +02:00
parent c970c1dfbd
commit 3c44286570
4 changed files with 45 additions and 4 deletions

25
Cargo.lock generated
View File

@ -196,6 +196,12 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "as-raw-xcb-connection"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
[[package]]
name = "ash"
version = "0.37.3+1.3.251"
@ -2699,6 +2705,7 @@ dependencies = [
"android-activity",
"atomic-waker",
"bitflags 2.6.0",
"bytemuck",
"calloop 0.12.4",
"cfg_aliases",
"core-foundation",
@ -2714,6 +2721,7 @@ dependencies = [
"objc2 0.4.1",
"once_cell",
"orbclient",
"percent-encoding",
"raw-window-handle",
"redox_syscall 0.3.5",
"rustix",
@ -2729,6 +2737,8 @@ dependencies = [
"web-sys",
"web-time",
"windows-sys 0.48.0",
"x11-dl",
"x11rb",
"xkbcommon-dl",
]
@ -2741,13 +2751,28 @@ dependencies = [
"memchr",
]
[[package]]
name = "x11-dl"
version = "2.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
dependencies = [
"libc",
"once_cell",
"pkg-config",
]
[[package]]
name = "x11rb"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12"
dependencies = [
"as-raw-xcb-connection",
"gethostname",
"libc",
"libloading 0.8.5",
"once_cell",
"rustix",
"x11rb-protocol",
]

View File

@ -3,10 +3,15 @@ name = "ACL_Editor"
version = "0.1.0"
edition = "2021"
[features]
default = ["wayland", "x11"]
wayland = ["eframe/wayland"]
x11 = ["eframe/x11"]
[dependencies]
anyhow = "1"
eframe = { version = "0.28.1", features = [
"wayland",
"wgpu",
"default_fonts",
], default-features = false }

View File

@ -32,8 +32,16 @@ impl App {
ctx.set_fonts(fonts);
// first argument is the initial path or the current working directory
let initial_path = if let Some(path) = std::env::args().nth(1) {
std::path::PathBuf::from(path)
} else {
std::env::current_dir().unwrap()
};
App {
tree: Tree::new(),
tree: Tree::new(initial_path),
editor: ACLEditor::new(),
}
}

View File

@ -13,9 +13,12 @@ pub struct Tree {
}
impl Tree {
pub fn new() -> Self {
pub fn new(initial_path: impl Into<PathBuf>) -> Self {
let path: PathBuf = initial_path.into();
let name = path.to_string_lossy().to_string();
Self {
root: Folder::new("./tmp", "./tmp"),
root: Folder::new(name, path),
selected: PathBuf::new(),
}
}