Option to place tab bar at the top edge

Fixes #288
This commit is contained in:
Kovid Goyal 2018-01-19 17:04:58 +05:30
parent aff1abdb26
commit 213768b6e0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 30 additions and 6 deletions

View File

@ -234,6 +234,10 @@ def tab_font_style(x):
return {'bold-italic': (True, True), 'bold': (True, False), 'italic': (False, True)}.get(x.lower().replace('_', '-'), (False, False))
def tab_bar_edge(x):
return {'top': 1, 'bottom': 3}.get(x.lower(), 3)
def url_style(x):
return url_style.map.get(x, url_style.map['curly'])
@ -282,6 +286,7 @@ type_map = {
'url_style': url_style,
'prefer_color_emoji': to_bool,
'copy_on_select': to_bool,
'tab_bar_edge': tab_bar_edge,
}
for name in (

View File

@ -196,14 +196,19 @@ inactive_border_color #cccccc
# zero and one, with 0 being fully faded).
inactive_text_alpha 1.0
# Tab-bar customization
# Which edge to show the tab bar on, top or bottom
tab_bar_edge bottom
# The separator between tabs in the tab bar
tab_separator " ┇"
# Tab bar colors and styles
active_tab_foreground #000
active_tab_background #eee
active_tab_font_style bold-italic
inactive_tab_foreground #444
inactive_tab_background #999
inactive_tab_font_style normal
tab_separator " ┇"
# The 16 terminal colors. There are 8 basic colors, each color has a dull and

View File

@ -245,10 +245,20 @@ add_borders_rect(id_type os_window_id, id_type tab_id, uint32_t left, uint32_t t
void
os_window_regions(OSWindow *os_window, Region *central, Region *tab_bar) {
if (os_window->num_tabs > 1) {
central->left = 0; central->top = 0; central->right = os_window->viewport_width - 1;
central->bottom = os_window->viewport_height - global_state.cell_height - 1;
tab_bar->left = central->left; tab_bar->right = central->right; tab_bar->top = central->bottom + 1;
tab_bar->bottom = os_window->viewport_height - 1;
switch(OPT(tab_bar_edge)) {
case TOP_EDGE:
central->left = 0; central->top = global_state.cell_height; central->right = os_window->viewport_width - 1;
central->bottom = os_window->viewport_height - 1;
tab_bar->left = central->left; tab_bar->right = central->right; tab_bar->top = 0;
tab_bar->bottom = central->top - 1;
break;
default:
central->left = 0; central->top = 0; central->right = os_window->viewport_width - 1;
central->bottom = os_window->viewport_height - global_state.cell_height - 1;
tab_bar->left = central->left; tab_bar->right = central->right; tab_bar->top = central->bottom + 1;
tab_bar->bottom = os_window->viewport_height - 1;
break;
}
} else {
memset(tab_bar, 0, sizeof(Region));
central->left = 0; central->top = 0; central->right = os_window->viewport_width - 1;
@ -330,6 +340,7 @@ PYWRAP1(set_options) {
S(cursor_shape, PyLong_AsLong);
S(url_style, PyLong_AsUnsignedLong);
S(x11_bell_volume, PyLong_AsLong);
S(tab_bar_edge, PyLong_AsLong);
S(mouse_hide_wait, PyFloat_AsDouble);
S(wheel_scroll_multiplier, PyFloat_AsDouble);
S(open_url_modifiers, PyLong_AsUnsignedLong);

View File

@ -10,6 +10,8 @@
#define OPT(name) global_state.opts.name
typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge;
typedef struct {
double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier;
bool enable_audio_bell;
@ -28,6 +30,7 @@ typedef struct {
float adjust_line_height_frac;
float background_opacity;
float inactive_text_alpha;
Edge tab_bar_edge;
} Options;
typedef struct {