tabs: hy3 tab styling, with corresponding config options.
tab-bar-height = 22 tab-bar-padding = 5 tab-bar-radius = 6 tab-bar-border-width = 2 tab-bar-text-padding = 3 tab-bar-gap = 6 tab-title-align = "center" tab-active-bg-color = "#33ccff40" tab-active-border-color = "#33ccffee" tab-active-text-color = "#ffffffff" tab-focused-bg-color = "#60606040" tab-focused-border-color = "#808080ee" tab-focused-text-color = "#ffffffff" tab-inactive-bg-color = "#30303020" tab-inactive-border-color = "#606060aa" tab-inactive-text-color = "#ffffffff" tab-urgent-bg-color = "#ff223340" tab-urgent-border-color = "#ff2233ee" tab-urgent-text-color = "#ffffffff"
This commit is contained in:
parent
e35dce433a
commit
e8f86dae8a
28 changed files with 920 additions and 242 deletions
|
|
@ -241,10 +241,16 @@ pub struct Theme {
|
|||
pub corner_radius: Option<f32>,
|
||||
pub tab_active_bg_color: Option<Color>,
|
||||
pub tab_active_border_color: Option<Color>,
|
||||
pub tab_focused_bg_color: Option<Color>,
|
||||
pub tab_focused_border_color: Option<Color>,
|
||||
pub tab_inactive_bg_color: Option<Color>,
|
||||
pub tab_inactive_border_color: Option<Color>,
|
||||
pub tab_urgent_bg_color: Option<Color>,
|
||||
pub tab_urgent_border_color: Option<Color>,
|
||||
pub tab_active_text_color: Option<Color>,
|
||||
pub tab_focused_text_color: Option<Color>,
|
||||
pub tab_inactive_text_color: Option<Color>,
|
||||
pub tab_urgent_text_color: Option<Color>,
|
||||
pub tab_bar_bg_color: Option<Color>,
|
||||
pub tab_attention_bg_color: Option<Color>,
|
||||
pub tab_bar_height: Option<i32>,
|
||||
|
|
@ -253,7 +259,10 @@ pub struct Theme {
|
|||
pub tab_bar_border_width: Option<i32>,
|
||||
pub tab_bar_text_padding: Option<i32>,
|
||||
pub tab_bar_gap: Option<i32>,
|
||||
pub tab_opacity: Option<i32>,
|
||||
pub tab_title_align: Option<String>,
|
||||
pub tab_from_top: Option<bool>,
|
||||
pub tab_render_text: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -398,6 +407,7 @@ pub enum AnimationCurve {
|
|||
Linear,
|
||||
EaseOut,
|
||||
EaseInOut,
|
||||
#[allow(dead_code)]
|
||||
Bezier { x1: f32, y1: f32, x2: f32, y2: f32 },
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,41 +105,58 @@ impl Parser for ThemeParser<'_> {
|
|||
(
|
||||
tab_active_bg_color,
|
||||
tab_active_border_color,
|
||||
tab_focused_bg_color,
|
||||
tab_focused_border_color,
|
||||
tab_inactive_bg_color,
|
||||
tab_inactive_border_color,
|
||||
tab_urgent_bg_color,
|
||||
tab_urgent_border_color,
|
||||
tab_active_text_color,
|
||||
tab_focused_text_color,
|
||||
),
|
||||
(
|
||||
tab_inactive_text_color,
|
||||
tab_urgent_text_color,
|
||||
tab_bar_bg_color,
|
||||
tab_attention_bg_color,
|
||||
tab_bar_height,
|
||||
tab_bar_padding,
|
||||
),
|
||||
(
|
||||
tab_bar_radius,
|
||||
tab_bar_border_width,
|
||||
tab_bar_text_padding,
|
||||
tab_bar_gap,
|
||||
tab_title_align_val,
|
||||
),
|
||||
(tab_opacity, tab_title_align_val, tab_from_top, tab_render_text),
|
||||
) = ext.extract((
|
||||
(
|
||||
opt(val("tab-active-bg-color")),
|
||||
opt(val("tab-active-border-color")),
|
||||
opt(val("tab-focused-bg-color")),
|
||||
opt(val("tab-focused-border-color")),
|
||||
opt(val("tab-inactive-bg-color")),
|
||||
opt(val("tab-inactive-border-color")),
|
||||
opt(val("tab-urgent-bg-color")),
|
||||
opt(val("tab-urgent-border-color")),
|
||||
opt(val("tab-active-text-color")),
|
||||
opt(val("tab-focused-text-color")),
|
||||
),
|
||||
(
|
||||
opt(val("tab-inactive-text-color")),
|
||||
opt(val("tab-urgent-text-color")),
|
||||
opt(val("tab-bar-bg-color")),
|
||||
opt(val("tab-attention-bg-color")),
|
||||
recover(opt(s32("tab-bar-height"))),
|
||||
recover(opt(s32("tab-bar-padding"))),
|
||||
),
|
||||
(
|
||||
recover(opt(s32("tab-bar-radius"))),
|
||||
recover(opt(s32("tab-bar-border-width"))),
|
||||
recover(opt(s32("tab-bar-text-padding"))),
|
||||
recover(opt(s32("tab-bar-gap"))),
|
||||
),
|
||||
(
|
||||
recover(opt(s32("tab-opacity"))),
|
||||
recover(opt(str("tab-title-align"))),
|
||||
recover(opt(bol("tab-from-top"))),
|
||||
recover(opt(bol("tab-render-text"))),
|
||||
),
|
||||
))?;
|
||||
macro_rules! color {
|
||||
|
|
@ -199,10 +216,16 @@ impl Parser for ThemeParser<'_> {
|
|||
corner_radius: corner_radius.map(|v| v.value as f32),
|
||||
tab_active_bg_color: color!(tab_active_bg_color),
|
||||
tab_active_border_color: color!(tab_active_border_color),
|
||||
tab_focused_bg_color: color!(tab_focused_bg_color),
|
||||
tab_focused_border_color: color!(tab_focused_border_color),
|
||||
tab_inactive_bg_color: color!(tab_inactive_bg_color),
|
||||
tab_inactive_border_color: color!(tab_inactive_border_color),
|
||||
tab_urgent_bg_color: color!(tab_urgent_bg_color),
|
||||
tab_urgent_border_color: color!(tab_urgent_border_color),
|
||||
tab_active_text_color: color!(tab_active_text_color),
|
||||
tab_focused_text_color: color!(tab_focused_text_color),
|
||||
tab_inactive_text_color: color!(tab_inactive_text_color),
|
||||
tab_urgent_text_color: color!(tab_urgent_text_color),
|
||||
tab_bar_bg_color: color!(tab_bar_bg_color),
|
||||
tab_attention_bg_color: color!(tab_attention_bg_color),
|
||||
tab_bar_height: tab_bar_height.despan(),
|
||||
|
|
@ -211,7 +234,10 @@ impl Parser for ThemeParser<'_> {
|
|||
tab_bar_border_width: tab_bar_border_width.despan(),
|
||||
tab_bar_text_padding: tab_bar_text_padding.despan(),
|
||||
tab_bar_gap: tab_bar_gap.despan(),
|
||||
tab_opacity: tab_opacity.despan(),
|
||||
tab_title_align: tab_title_align_val.map(|v| v.value.to_string()),
|
||||
tab_from_top: tab_from_top.despan(),
|
||||
tab_render_text: tab_render_text.despan(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ use {
|
|||
crate::{
|
||||
config::{
|
||||
Action, AnimationCurve, AnimationsConfig, BlurConfig, ClientRule, Config,
|
||||
ConfigConnector, ConfigDrmDevice, ConfigKeymap,
|
||||
ConnectorMatch, DrmDeviceMatch, Exec, Input, InputMatch, LayerKind, LayerRule, Output,
|
||||
OutputMatch, SimpleCommand, Status, Theme, WindowRule, parse_config,
|
||||
ConfigConnector, ConfigDrmDevice, ConfigKeymap, ConnectorMatch, DrmDeviceMatch, Exec,
|
||||
Input, InputMatch, LayerKind, LayerRule, Output, OutputMatch, SimpleCommand, Status,
|
||||
Theme, WindowRule, parse_config,
|
||||
},
|
||||
rules::{MatcherTemp, RuleMapper},
|
||||
shortcuts::ModeState,
|
||||
|
|
@ -47,8 +47,8 @@ use {
|
|||
set_color_management_enabled, set_corner_radius, set_default_workspace_capture,
|
||||
set_explicit_sync_enabled, set_float_above_fullscreen, set_floating_titles, set_idle,
|
||||
set_idle_grace_period, set_middle_click_paste_enabled, set_show_bar,
|
||||
set_show_float_pin_icon, set_show_titles, set_tab_title_align, set_ui_drag_enabled,
|
||||
set_ui_drag_threshold,
|
||||
set_show_float_pin_icon, set_show_titles, set_tab_from_top, set_tab_render_text,
|
||||
set_tab_title_align, set_ui_drag_enabled, set_ui_drag_threshold,
|
||||
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
|
||||
switch_to_vt,
|
||||
tasks::{self, JoinHandle},
|
||||
|
|
@ -1023,10 +1023,16 @@ impl State {
|
|||
color!(HIGHLIGHT_COLOR, highlight_color);
|
||||
color!(TAB_ACTIVE_BACKGROUND_COLOR, tab_active_bg_color);
|
||||
color!(TAB_ACTIVE_BORDER_COLOR, tab_active_border_color);
|
||||
color!(TAB_FOCUSED_BACKGROUND_COLOR, tab_focused_bg_color);
|
||||
color!(TAB_FOCUSED_BORDER_COLOR, tab_focused_border_color);
|
||||
color!(TAB_INACTIVE_BACKGROUND_COLOR, tab_inactive_bg_color);
|
||||
color!(TAB_INACTIVE_BORDER_COLOR, tab_inactive_border_color);
|
||||
color!(TAB_URGENT_BACKGROUND_COLOR, tab_urgent_bg_color);
|
||||
color!(TAB_URGENT_BORDER_COLOR, tab_urgent_border_color);
|
||||
color!(TAB_ACTIVE_TEXT_COLOR, tab_active_text_color);
|
||||
color!(TAB_FOCUSED_TEXT_COLOR, tab_focused_text_color);
|
||||
color!(TAB_INACTIVE_TEXT_COLOR, tab_inactive_text_color);
|
||||
color!(TAB_URGENT_TEXT_COLOR, tab_urgent_text_color);
|
||||
color!(TAB_BAR_BACKGROUND_COLOR, tab_bar_bg_color);
|
||||
color!(TAB_ATTENTION_BACKGROUND_COLOR, tab_attention_bg_color);
|
||||
macro_rules! size {
|
||||
|
|
@ -1048,6 +1054,7 @@ impl State {
|
|||
size!(TAB_BAR_BORDER_WIDTH, tab_bar_border_width);
|
||||
size!(TAB_BAR_TEXT_PADDING, tab_bar_text_padding);
|
||||
size!(TAB_BAR_GAP, tab_bar_gap);
|
||||
size!(TAB_OPACITY, tab_opacity);
|
||||
macro_rules! font {
|
||||
($fun:ident, $field:ident) => {
|
||||
if let Some(font) = &theme.$field {
|
||||
|
|
@ -1064,6 +1071,12 @@ impl State {
|
|||
if let Some(ref align) = theme.tab_title_align {
|
||||
set_tab_title_align(align);
|
||||
}
|
||||
if let Some(from_top) = theme.tab_from_top {
|
||||
set_tab_from_top(from_top);
|
||||
}
|
||||
if let Some(render_text) = theme.tab_render_text {
|
||||
set_tab_render_text(render_text);
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_switch_device(self: &Rc<Self>, dev: InputDevice, actions: &Rc<SwitchActions>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue