renderer: add support for floating-titlebars (#4)
Reviewed-on: https://git.kosslan.dev/wry/jay/pulls/4
This commit is contained in:
parent
4d803360dd
commit
6dba659978
13 changed files with 316 additions and 158 deletions
|
|
@ -80,6 +80,8 @@ pub enum SimpleCommand {
|
|||
ToggleBar,
|
||||
ShowTitles(bool),
|
||||
ToggleTitles,
|
||||
FloatTitles(bool),
|
||||
ToggleFloatTitles,
|
||||
FocusHistory(Timeline),
|
||||
FocusLayerRel(LayerDirection),
|
||||
FocusTiles,
|
||||
|
|
@ -224,6 +226,8 @@ pub struct Theme {
|
|||
pub bar_position: Option<BarPosition>,
|
||||
pub bar_separator_width: Option<i32>,
|
||||
pub gap: Option<i32>,
|
||||
pub floating_titles: Option<bool>,
|
||||
pub title_gap: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@ impl ActionParser<'_> {
|
|||
"show-titles" => ShowTitles(true),
|
||||
"hide-titles" => ShowTitles(false),
|
||||
"toggle-titles" => ToggleTitles,
|
||||
"float-titles" => FloatTitles(true),
|
||||
"unfloat-titles" => FloatTitles(false),
|
||||
"toggle-float-titles" => ToggleFloatTitles,
|
||||
"focus-prev" => FocusHistory(Timeline::Older),
|
||||
"focus-next" => FocusHistory(Timeline::Newer),
|
||||
"focus-below" => FocusLayerRel(LayerDirection::Below),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use {
|
|||
config::{
|
||||
Theme,
|
||||
context::Context,
|
||||
extractor::{Extractor, ExtractorError, opt, recover, s32, str, val},
|
||||
extractor::{Extractor, ExtractorError, bol, opt, recover, s32, str, val},
|
||||
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
|
||||
parsers::color::ColorParser,
|
||||
},
|
||||
|
|
@ -63,7 +63,7 @@ impl Parser for ThemeParser<'_> {
|
|||
font,
|
||||
title_font,
|
||||
),
|
||||
(bar_font, bar_position_val, bar_separator_width, gap),
|
||||
(bar_font, bar_position_val, bar_separator_width, gap, floating_titles),
|
||||
) = ext.extract((
|
||||
(
|
||||
opt(val("attention-requested-bg-color")),
|
||||
|
|
@ -94,8 +94,10 @@ impl Parser for ThemeParser<'_> {
|
|||
recover(opt(str("bar-position"))),
|
||||
recover(opt(s32("bar-separator-width"))),
|
||||
recover(opt(s32("gap"))),
|
||||
recover(opt(bol("floating-titles"))),
|
||||
),
|
||||
))?;
|
||||
let (title_gap,) = ext.extract((recover(opt(s32("title-gap"))),))?;
|
||||
macro_rules! color {
|
||||
($e:expr) => {
|
||||
match $e {
|
||||
|
|
@ -148,6 +150,8 @@ impl Parser for ThemeParser<'_> {
|
|||
bar_position,
|
||||
bar_separator_width: bar_separator_width.despan(),
|
||||
gap: gap.despan(),
|
||||
floating_titles: floating_titles.despan(),
|
||||
title_gap: title_gap.despan(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ use {
|
|||
on_devices_enumerated, on_idle, on_unload, quit, reload,
|
||||
set_color_management_enabled, set_default_workspace_capture, set_explicit_sync_enabled,
|
||||
set_float_above_fullscreen, set_idle, set_idle_grace_period,
|
||||
set_middle_click_paste_enabled, set_show_bar, set_show_float_pin_icon, set_show_titles,
|
||||
set_floating_titles, set_middle_click_paste_enabled, set_show_bar, set_show_float_pin_icon,
|
||||
set_show_titles,
|
||||
set_ui_drag_enabled, set_ui_drag_threshold,
|
||||
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
|
||||
switch_to_vt,
|
||||
|
|
@ -48,7 +49,7 @@ use {
|
|||
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,
|
||||
toggle_float_above_fullscreen, toggle_floating_titles, toggle_show_bar, toggle_show_titles,
|
||||
video::{
|
||||
ColorSpace, Connector, DrmDevice, Eotf, connectors, create_virtual_output, drm_devices,
|
||||
on_connector_connected, on_connector_disconnected, on_graphics_initialized,
|
||||
|
|
@ -206,6 +207,10 @@ impl Action {
|
|||
SimpleCommand::ToggleBar => b.new(toggle_show_bar),
|
||||
SimpleCommand::ShowTitles(show) => b.new(move || set_show_titles(show)),
|
||||
SimpleCommand::ToggleTitles => b.new(toggle_show_titles),
|
||||
SimpleCommand::FloatTitles(floating) => {
|
||||
b.new(move || set_floating_titles(floating))
|
||||
}
|
||||
SimpleCommand::ToggleFloatTitles => b.new(toggle_floating_titles),
|
||||
SimpleCommand::FocusHistory(timeline) => {
|
||||
let persistent = state.persistent.clone();
|
||||
b.new(move || persistent.seat.focus_history(timeline))
|
||||
|
|
@ -1004,6 +1009,7 @@ impl State {
|
|||
size!(BAR_HEIGHT, bar_height);
|
||||
size!(BAR_SEPARATOR_WIDTH, bar_separator_width);
|
||||
size!(GAP, gap);
|
||||
size!(TITLE_GAP, title_gap);
|
||||
macro_rules! font {
|
||||
($fun:ident, $field:ident) => {
|
||||
if let Some(font) = &theme.$field {
|
||||
|
|
@ -1637,6 +1643,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.floating_titles {
|
||||
set_floating_titles(v);
|
||||
}
|
||||
if let Some(v) = config.theme.bar_position {
|
||||
set_bar_position(v);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue