From a1a9933640980034783f5070d16d781f0f7cbee9 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Fri, 9 Aug 2024 21:02:22 +0300 Subject: config: add layer option --- src/config.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 72ebd5f..0863e1d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,5 @@ use crate::color::Color; -use crate::protocol::zwlr_layer_surface_v1; +use crate::protocol::{zwlr_layer_shell_v1, zwlr_layer_surface_v1}; use anyhow::{Context, Result}; use pangocairo::pango::FontDescription; use serde::{de, Deserialize}; @@ -41,6 +41,7 @@ pub struct Config { pub blocks_overlap: f64, // misc pub position: Position, + pub layer: Layer, pub hide_inactive_tags: bool, pub invert_touchpad_scrolling: bool, pub show_layout_name: bool, @@ -84,6 +85,7 @@ impl Default for Config { blocks_overlap: 0.0, position: Position::Top, + layer: Layer::Top, hide_inactive_tags: true, invert_touchpad_scrolling: true, show_layout_name: true, @@ -161,6 +163,26 @@ impl From for zwlr_layer_surface_v1::Anchor { } } +#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq)] +#[serde(rename_all = "lowercase")] +pub enum Layer { + Background, + Bottom, + Top, + Overlay, +} + +impl From for zwlr_layer_shell_v1::Layer { + fn from(layer: Layer) -> Self { + match layer { + Layer::Background => Self::Background, + Layer::Bottom => Self::Bottom, + Layer::Top => Self::Top, + Layer::Overlay => Self::Overlay, + } + } +} + #[derive(Debug, Deserialize)] pub struct WmConfig { pub river: RiverConfig, -- cgit v1.3.1