Move all mods into lib

For future testing
This commit is contained in:
Ottatop 2024-03-05 23:25:04 -06:00
parent 86eb5f90db
commit f4a5328c2c
3 changed files with 26 additions and 23 deletions

15
src/lib.rs Normal file
View file

@ -0,0 +1,15 @@
pub mod api;
pub mod backend;
pub mod cli;
pub mod config;
pub mod cursor;
pub mod focus;
pub mod grab;
pub mod handlers;
pub mod input;
pub mod layout;
pub mod output;
pub mod render;
pub mod state;
pub mod tag;
pub mod window;

View file

@ -12,29 +12,16 @@
#![warn(clippy::unwrap_used)]
use anyhow::Context;
use cli::Cli;
use nix::unistd::Uid;
use pinnacle::{
backend::{udev::setup_udev, winit::setup_winit},
cli::{self, Cli},
};
use tracing::{info, level_filters::LevelFilter, warn};
use tracing_appender::rolling::Rotation;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer};
use xdg::BaseDirectories;
mod api;
mod backend;
mod cli;
mod config;
mod cursor;
mod focus;
mod grab;
mod handlers;
mod input;
mod layout;
mod output;
mod render;
mod state;
mod tag;
mod window;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let xdg_state_dir = BaseDirectories::with_prefix("pinnacle")?.get_state_home();
@ -101,17 +88,17 @@ async fn main() -> anyhow::Result<()> {
(None, _) => {
if in_graphical_env {
info!("Starting winit backend");
crate::backend::winit::setup_winit(cli.no_config, cli.config_dir)?
setup_winit(cli.no_config, cli.config_dir)?
} else {
info!("Starting udev backend");
crate::backend::udev::setup_udev(cli.no_config, cli.config_dir)?
setup_udev(cli.no_config, cli.config_dir)?
}
}
(Some(cli::Backend::Winit), force) => {
if !in_graphical_env {
if force {
warn!("Starting winit backend with no detected graphical environment");
crate::backend::winit::setup_winit(cli.no_config, cli.config_dir)?
setup_winit(cli.no_config, cli.config_dir)?
} else {
warn!("Both WAYLAND_DISPLAY and DISPLAY are not set.");
warn!("If you are trying to run the winit backend in a tty, it won't work.");
@ -120,14 +107,14 @@ async fn main() -> anyhow::Result<()> {
}
} else {
info!("Starting winit backend");
crate::backend::winit::setup_winit(cli.no_config, cli.config_dir)?
setup_winit(cli.no_config, cli.config_dir)?
}
}
(Some(cli::Backend::Udev), force) => {
if in_graphical_env {
if force {
warn!("Starting udev backend with a detected graphical environment");
crate::backend::udev::setup_udev(cli.no_config, cli.config_dir)?
setup_udev(cli.no_config, cli.config_dir)?
} else {
warn!("WAYLAND_DISPLAY and/or DISPLAY are set.");
warn!("If you are trying to run the udev backend in a graphical environment,");
@ -137,7 +124,7 @@ async fn main() -> anyhow::Result<()> {
}
} else {
info!("Starting udev backend");
crate::backend::udev::setup_udev(cli.no_config, cli.config_dir)?
setup_udev(cli.no_config, cli.config_dir)?
}
}
};

View file

@ -286,6 +286,7 @@ impl FullscreenOrMaximized {
}
impl WindowElementState {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {
id: WindowId::next(),