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