Add a setting to control the margins to the left and right of the tab bar

Fixes #584
This commit is contained in:
Kovid Goyal
2018-05-28 21:59:45 +05:30
parent dab57f3819
commit 9eb113802d
3 changed files with 7 additions and 2 deletions

View File

@@ -389,6 +389,7 @@ type_map = {
'close_on_child_death': to_bool,
'window_border_width': positive_float,
'window_margin_width': positive_float,
'tab_bar_margin_width': positive_float,
'window_padding_width': positive_float,
'wheel_scroll_multiplier': float,
'visual_bell_duration': positive_float,

View File

@@ -223,6 +223,9 @@ inactive_text_alpha 1.0
# Which edge to show the tab bar on, top or bottom
tab_bar_edge bottom
# The margin to the left and right of the tab bar (in pts)
tab_bar_margin_width 0
# The separator between tabs in the tab bar
tab_separator " ┇"

View File

@@ -307,6 +307,7 @@ class TabBar: # {{{
self.os_window_id = os_window_id
self.opts = opts
self.num_tabs = 1
self.margin_width = pt_to_px(self.opts.tab_bar_margin_width, self.os_window_id)
self.cell_width, cell_height = cell_size_for_window(self.os_window_id)
self.data_buffer_size = 0
self.laid_out_once = False
@@ -353,12 +354,12 @@ class TabBar: # {{{
return
self.cell_width = cell_width
s = self.screen
viewport_width = tab_bar.width
viewport_width = tab_bar.width - 2 * self.margin_width
ncells = viewport_width // cell_width
s.resize(1, ncells)
s.reset_mode(DECAWM)
self.laid_out_once = True
margin = (viewport_width - ncells * cell_width) // 2
margin = (viewport_width - ncells * cell_width) // 2 + self.margin_width
self.window_geometry = g = WindowGeometry(
margin, tab_bar.top, viewport_width - margin, tab_bar.bottom, s.columns, s.lines)
if margin > 0: