1
0
Fork 0
forked from wry/wry

theme: add bar-position setting

This commit is contained in:
Stipe Kotarac 2025-11-28 21:26:15 +01:00
parent 3ea687a5c8
commit 2500c05f70
15 changed files with 178 additions and 32 deletions

View file

@ -25,7 +25,7 @@ use {
},
logging::LogLevel,
tasks::{JoinHandle, JoinSlot},
theme::{Color, colors::Colorable, sized::Resizable},
theme::{BarPosition, Color, colors::Colorable, sized::Resizable},
timer::Timer,
video::{
BlendSpace, ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, Mode, TearingMode,
@ -1016,6 +1016,16 @@ impl ConfigClient {
show
}
pub fn set_bar_position(&self, position: BarPosition) {
self.send(&ClientMessage::SetBarPosition { position });
}
pub fn get_bar_position(&self) -> BarPosition {
let res = self.send_with_response(&ClientMessage::GetBarPosition);
get_response!(res, BarPosition::Top, GetBarPosition { position });
position
}
pub fn set_middle_click_paste_enabled(&self, enabled: bool) {
self.send(&ClientMessage::SetMiddleClickPasteEnabled { enabled });
}

View file

@ -9,7 +9,7 @@ use {
},
keyboard::{Keymap, mods::Modifiers, syms::KeySym},
logging::LogLevel,
theme::{Color, colors::Colorable, sized::Resizable},
theme::{BarPosition, Color, colors::Colorable, sized::Resizable},
timer::Timer,
video::{
BlendSpace, ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, TearingMode,
@ -812,6 +812,10 @@ pub enum ClientMessage<'a> {
connector: Connector,
direction: Direction,
},
SetBarPosition {
position: BarPosition,
},
GetBarPosition,
}
#[derive(Serialize, Deserialize, Debug)]
@ -1056,6 +1060,9 @@ pub enum Response {
GetConnectorInDirection {
connector: Connector,
},
GetBarPosition {
position: BarPosition,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -177,6 +177,26 @@ pub fn reset_font() {
get!().reset_font()
}
#[non_exhaustive]
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Default)]
pub enum BarPosition {
#[default]
Top,
Bottom,
}
/// Sets the position of the bar.
///
/// Default: `Top`.
pub fn set_bar_position(position: BarPosition) {
get!().set_bar_position(position);
}
/// Gets the position of the bar.
pub fn get_bar_position() -> BarPosition {
get!(BarPosition::Top).get_bar_position()
}
/// Elements of the compositor whose color can be changed.
pub mod colors {
use {