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

@ -33,7 +33,7 @@ use {
keyboard::{Keymap, ModifiedKeySym, mods::Modifiers, syms::KeySym},
logging::LogLevel,
status::MessageFormat,
theme::Color,
theme::{BarPosition, Color},
video::{BlendSpace, ColorSpace, Eotf, Format, GfxApi, TearingMode, Transform, VrrMode},
window::{ContentType, TileState, WindowType},
workspace::WorkspaceDisplayOrder,
@ -208,6 +208,7 @@ pub struct Theme {
pub font: Option<String>,
pub title_font: Option<String>,
pub bar_font: Option<String>,
pub bar_position: Option<BarPosition>,
}
#[derive(Debug, Clone)]

View file

@ -13,6 +13,7 @@ use {
},
},
indexmap::IndexMap,
jay_config::theme::BarPosition,
thiserror::Error,
};
@ -62,7 +63,7 @@ impl Parser for ThemeParser<'_> {
font,
title_font,
),
(bar_font,),
(bar_font, bar_position_val),
) = ext.extract((
(
opt(val("attention-requested-bg-color")),
@ -88,7 +89,10 @@ impl Parser for ThemeParser<'_> {
recover(opt(str("font"))),
recover(opt(str("title-font"))),
),
(recover(opt(str("bar-font"))),),
(
recover(opt(str("bar-font"))),
recover(opt(str("bar-position"))),
),
))?;
macro_rules! color {
($e:expr) => {
@ -104,6 +108,19 @@ impl Parser for ThemeParser<'_> {
}
};
}
let bar_position =
bar_position_val.and_then(|value| match value.value.to_lowercase().as_str() {
"top" => Some(BarPosition::Top),
"bottom" => Some(BarPosition::Bottom),
_ => {
log::warn!(
"Unknown bar position '{}': {}",
value.value,
self.0.error3(value.span)
);
None
}
});
Ok(Theme {
attention_requested_bg_color: color!(attention_requested_bg_color),
bg_color: color!(bg_color),
@ -126,6 +143,7 @@ impl Parser for ThemeParser<'_> {
font: font.map(|f| f.value.to_string()),
title_font: title_font.map(|f| f.value.to_string()),
bar_font: bar_font.map(|f| f.value.to_string()),
bar_position,
})
}
}

View file

@ -43,7 +43,10 @@ use {
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
switch_to_vt,
tasks::{self, JoinHandle},
theme::{reset_colors, reset_font, reset_sizes, set_bar_font, set_font, set_title_font},
theme::{
reset_colors, reset_font, reset_sizes, set_bar_font, set_bar_position, set_font,
set_title_font,
},
toggle_float_above_fullscreen, toggle_show_bar, toggle_show_titles,
video::{
ColorSpace, Connector, DrmDevice, Eotf, connectors, drm_devices,
@ -1598,6 +1601,9 @@ fn load_config(initial_load: bool, auto_reload: bool, persistent: &Rc<Persistent
if let Some(v) = config.show_titles {
set_show_titles(v);
}
if let Some(v) = config.theme.bar_position {
set_bar_position(v);
}
if let Some(v) = config.focus_history {
if let Some(v) = v.only_visible {
persistent.seat.focus_history_set_only_visible(v);