pinnacle/src/layout.rs

32 lines
714 B
Rust
Raw Normal View History

use std::{error::Error, fmt::Display};
2023-05-29 19:45:04 +02:00
use smithay::desktop::Window;
2023-06-02 23:01:48 +02:00
use crate::{backend::Backend, state::State};
2023-05-29 19:45:04 +02:00
pub mod automatic;
pub mod manual;
2023-06-02 03:23:37 +02:00
pub trait Layout<B: Backend> {
fn layout_windows(&self, state: &mut State<B>, windows: Vec<Window>);
fn add_window(&mut self, state: &mut State<B>, window: Window);
fn remove_window(
&mut self,
state: &mut State<B>,
window: Window,
) -> Result<(), RemoveWindowError>;
}
#[derive(Debug)]
pub enum RemoveWindowError {
NotFound,
2023-05-29 19:45:04 +02:00
}
impl Display for RemoveWindowError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl Error for RemoveWindowError {}