pinnacle/src/main.rs

69 lines
1.9 KiB
Rust
Raw Normal View History

2023-06-26 00:18:50 +02:00
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
2023-06-26 00:49:06 +02:00
//
// SPDX-License-Identifier: MPL-2.0
2023-06-22 01:58:49 +02:00
//! A very, VERY WIP Smithay-based Wayland compositor.
//!
//! Pinnacle is heavily inspired by the [Awesome Window Manager](https://awesomewm.org),
//! and this is an attempt to make something akin to it for Wayland.
//!
2023-06-22 02:08:29 +02:00
//! While Pinnacle is not a library, this documentation serves to guide those who want to
2023-06-22 01:58:49 +02:00
//! contribute or learn how building something like this works.
2023-06-29 19:29:00 +02:00
#![deny(unused_imports)] // gonna force myself to keep stuff clean
#![warn(clippy::unwrap_used)]
2023-06-29 19:29:00 +02:00
2023-06-18 01:55:04 +02:00
mod api;
mod backend;
mod cursor;
2023-06-18 04:02:58 +02:00
mod focus;
mod grab;
mod handlers;
mod input;
mod layout;
2023-06-26 03:26:52 +02:00
mod output;
mod pointer;
mod render;
mod state;
2023-07-01 04:34:07 +02:00
mod tag;
mod window;
mod xdg;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
2023-06-15 19:42:34 +02:00
match tracing_subscriber::EnvFilter::try_from_default_env() {
Ok(env_filter) => {
tracing_subscriber::fmt()
.compact()
.with_env_filter(env_filter)
.init();
}
Err(_) => {
tracing_subscriber::fmt().compact().init();
}
}
2023-06-19 19:42:49 +02:00
let mut args = std::env::args().skip(1);
match args.next().as_deref() {
Some("--winit") => {
tracing::info!("Starting winit backend");
crate::backend::winit::run_winit()?;
}
Some("--udev") => {
tracing::info!("Starting udev backend");
crate::backend::udev::run_udev()?;
}
Some(arg) => tracing::error!("Unknown argument {}", arg),
None => {
println!(
2023-06-25 00:39:40 +02:00
"Specify a backend:\n\t--udev to launch Pinnacle in a tty, or\n\t--winit to launch Pinnacle as a window in your graphical environment."
);
}
2023-06-19 19:42:49 +02:00
}
Ok(())
}