Allow setting :opt:active_border_color to `none` to not draw a border around the active window
Fixes #805 Fixes #1491
This commit is contained in:
parent
cb095be0cc
commit
fcedc9f5c3
@ -98,6 +98,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- Only update the selected text to clipboard when the selection is finished,
|
- Only update the selected text to clipboard when the selection is finished,
|
||||||
not continuously as it is updated. (:iss:`1460`)
|
not continuously as it is updated. (:iss:`1460`)
|
||||||
|
|
||||||
|
- Allow setting :opt:`active_border_color` to ``none`` to not draw a border
|
||||||
|
around the active window (:iss:`805`)
|
||||||
|
|
||||||
|
|
||||||
0.13.3 [2019-01-19]
|
0.13.3 [2019-01-19]
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class Borders:
|
|||||||
self.tab_id = tab_id
|
self.tab_id = tab_id
|
||||||
self.border_width = border_width
|
self.border_width = border_width
|
||||||
self.padding_width = padding_width
|
self.padding_width = padding_width
|
||||||
|
self.draw_active_borders = opts.active_border_color is not None
|
||||||
|
|
||||||
def __call__(
|
def __call__(
|
||||||
self,
|
self,
|
||||||
@ -77,7 +78,7 @@ class Borders:
|
|||||||
window_bg = (window_bg << 8) | BorderColor.window_bg
|
window_bg = (window_bg << 8) | BorderColor.window_bg
|
||||||
if draw_borders:
|
if draw_borders:
|
||||||
# Draw the border rectangles
|
# Draw the border rectangles
|
||||||
if w is active_window:
|
if w is active_window and self.draw_active_borders:
|
||||||
color = BorderColor.active
|
color = BorderColor.active
|
||||||
else:
|
else:
|
||||||
color = BorderColor.bell if w.needs_attention else BorderColor.inactive
|
color = BorderColor.bell if w.needs_attention else BorderColor.inactive
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from .fast_data_types import (
|
|||||||
set_clipboard_string, set_in_sequence_mode, toggle_fullscreen
|
set_clipboard_string, set_in_sequence_mode, toggle_fullscreen
|
||||||
)
|
)
|
||||||
from .keys import get_shortcut, shortcut_matches
|
from .keys import get_shortcut, shortcut_matches
|
||||||
from .layout import set_draw_minimal_borders
|
from .layout import set_draw_borders_options
|
||||||
from .remote_control import handle_cmd
|
from .remote_control import handle_cmd
|
||||||
from .rgb import Color, color_from_int
|
from .rgb import Color, color_from_int
|
||||||
from .session import create_session
|
from .session import create_session
|
||||||
@ -104,7 +104,7 @@ class DumpCommands: # {{{
|
|||||||
class Boss:
|
class Boss:
|
||||||
|
|
||||||
def __init__(self, os_window_id, opts, args, cached_values, new_os_window_trigger):
|
def __init__(self, os_window_id, opts, args, cached_values, new_os_window_trigger):
|
||||||
set_draw_minimal_borders(opts)
|
set_draw_borders_options(opts)
|
||||||
self.clipboard_buffers = {}
|
self.clipboard_buffers = {}
|
||||||
self.update_check_process = None
|
self.update_check_process = None
|
||||||
self.window_id_map = WeakValueDictionary()
|
self.window_id_map = WeakValueDictionary()
|
||||||
|
|||||||
@ -16,6 +16,12 @@ def to_color(x):
|
|||||||
return as_color(x, validate=True)
|
return as_color(x, validate=True)
|
||||||
|
|
||||||
|
|
||||||
|
def to_color_or_none(x):
|
||||||
|
if x.lower() == 'none':
|
||||||
|
return
|
||||||
|
return to_color(x)
|
||||||
|
|
||||||
|
|
||||||
def positive_int(x):
|
def positive_int(x):
|
||||||
return max(0, int(x))
|
return max(0, int(x))
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from . import fast_data_types as defines
|
|||||||
from .conf.definition import option_func
|
from .conf.definition import option_func
|
||||||
from .conf.utils import (
|
from .conf.utils import (
|
||||||
choices, positive_float, positive_int, to_bool, to_cmdline, to_color,
|
choices, positive_float, positive_int, to_bool, to_cmdline, to_color,
|
||||||
unit_float
|
to_color_or_none, unit_float
|
||||||
)
|
)
|
||||||
from .constants import config_dir, is_macos
|
from .constants import config_dir, is_macos
|
||||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||||
@ -567,8 +567,9 @@ Negative values will cause the value of :opt:`window_margin_width` to be used in
|
|||||||
o('window_padding_width', 0.0, option_type=positive_float, long_text=_('''
|
o('window_padding_width', 0.0, option_type=positive_float, long_text=_('''
|
||||||
The window padding (in pts) (blank area between the text and the window border)'''))
|
The window padding (in pts) (blank area between the text and the window border)'''))
|
||||||
|
|
||||||
o('active_border_color', '#00ff00', option_type=to_color, long_text=_('''
|
o('active_border_color', '#00ff00', option_type=to_color_or_none, long_text=_('''
|
||||||
The color for the border of the active window'''))
|
The color for the border of the active window. Set this to none to not draw borders
|
||||||
|
around the active window.'''))
|
||||||
|
|
||||||
o('inactive_border_color', '#cccccc', option_type=to_color, long_text=_('''
|
o('inactive_border_color', '#cccccc', option_type=to_color, long_text=_('''
|
||||||
The color for the border of inactive windows'''))
|
The color for the border of inactive windows'''))
|
||||||
|
|||||||
@ -17,6 +17,7 @@ cell_width = cell_height = 20
|
|||||||
all_borders = True, True, True, True
|
all_borders = True, True, True, True
|
||||||
no_borders = False, False, False, False
|
no_borders = False, False, False, False
|
||||||
draw_minimal_borders = False
|
draw_minimal_borders = False
|
||||||
|
draw_active_borders = True
|
||||||
|
|
||||||
|
|
||||||
def idx_for_id(win_id, windows):
|
def idx_for_id(win_id, windows):
|
||||||
@ -25,9 +26,10 @@ def idx_for_id(win_id, windows):
|
|||||||
return i
|
return i
|
||||||
|
|
||||||
|
|
||||||
def set_draw_minimal_borders(opts):
|
def set_draw_borders_options(opts):
|
||||||
global draw_minimal_borders
|
global draw_minimal_borders, draw_active_borders
|
||||||
draw_minimal_borders = opts.draw_minimal_borders and opts.window_margin_width == 0
|
draw_minimal_borders = opts.draw_minimal_borders and opts.window_margin_width == 0
|
||||||
|
draw_active_borders = opts.active_border_color is not None
|
||||||
|
|
||||||
|
|
||||||
def layout_dimension(start_at, length, cell_length, decoration_pairs, left_align=False, bias=None):
|
def layout_dimension(start_at, length, cell_length, decoration_pairs, left_align=False, bias=None):
|
||||||
@ -392,14 +394,17 @@ class Layout: # {{{
|
|||||||
|
|
||||||
def resolve_borders(self, windows, active_window):
|
def resolve_borders(self, windows, active_window):
|
||||||
if draw_minimal_borders:
|
if draw_minimal_borders:
|
||||||
needs_borders_map = {w.id: (w is active_window or w.needs_attention) for w in windows}
|
needs_borders_map = {w.id: ((w is active_window and draw_active_borders) or w.needs_attention) for w in windows}
|
||||||
yield from self.minimal_borders(windows, active_window, needs_borders_map)
|
yield from self.minimal_borders(windows, active_window, needs_borders_map)
|
||||||
else:
|
else:
|
||||||
yield from Layout.minimal_borders(self, windows, active_window, None)
|
yield from Layout.minimal_borders(self, windows, active_window, None)
|
||||||
|
|
||||||
def minimal_borders(self, windows, active_window, needs_borders_map):
|
def minimal_borders(self, windows, active_window, needs_borders_map):
|
||||||
for w in windows:
|
for w in windows:
|
||||||
yield all_borders
|
if w is active_window and not draw_active_borders and not w.needs_attention:
|
||||||
|
yield no_borders
|
||||||
|
else:
|
||||||
|
yield all_borders
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -291,8 +291,11 @@ os_window_regions(OSWindow *os_window, Region *central, Region *tab_bar) {
|
|||||||
#define KK5I(name) PYWRAP1(name) { id_type a, b; unsigned int c, d, e, f, g; PA("KKIIIII", &a, &b, &c, &d, &e, &f, &g); name(a, b, c, d, e, f, g); Py_RETURN_NONE; }
|
#define KK5I(name) PYWRAP1(name) { id_type a, b; unsigned int c, d, e, f, g; PA("KKIIIII", &a, &b, &c, &d, &e, &f, &g); name(a, b, c, d, e, f, g); Py_RETURN_NONE; }
|
||||||
#define BOOL_SET(name) PYWRAP1(set_##name) { global_state.name = PyObject_IsTrue(args); Py_RETURN_NONE; }
|
#define BOOL_SET(name) PYWRAP1(set_##name) { global_state.name = PyObject_IsTrue(args); Py_RETURN_NONE; }
|
||||||
|
|
||||||
|
static color_type default_color = 0;
|
||||||
|
|
||||||
static inline color_type
|
static inline color_type
|
||||||
color_as_int(PyObject *color) {
|
color_as_int(PyObject *color) {
|
||||||
|
if (color == Py_None && default_color) return default_color;
|
||||||
if (!PyTuple_Check(color)) { PyErr_SetString(PyExc_TypeError, "Not a color tuple"); return 0; }
|
if (!PyTuple_Check(color)) { PyErr_SetString(PyExc_TypeError, "Not a color tuple"); return 0; }
|
||||||
#define I(n, s) ((PyLong_AsUnsignedLong(PyTuple_GET_ITEM(color, n)) & 0xff) << s)
|
#define I(n, s) ((PyLong_AsUnsignedLong(PyTuple_GET_ITEM(color, n)) & 0xff) << s)
|
||||||
return (I(0, 16) | I(1, 8) | I(2, 0)) & 0xffffff;
|
return (I(0, 16) | I(1, 8) | I(2, 0)) & 0xffffff;
|
||||||
@ -387,7 +390,9 @@ PYWRAP1(set_options) {
|
|||||||
S(url_color, color_as_int);
|
S(url_color, color_as_int);
|
||||||
S(background, color_as_int);
|
S(background, color_as_int);
|
||||||
S(foreground, color_as_int);
|
S(foreground, color_as_int);
|
||||||
|
default_color = 0x00ff00;
|
||||||
S(active_border_color, color_as_int);
|
S(active_border_color, color_as_int);
|
||||||
|
default_color = 0;
|
||||||
S(inactive_border_color, color_as_int);
|
S(inactive_border_color, color_as_int);
|
||||||
S(bell_border_color, color_as_int);
|
S(bell_border_color, color_as_int);
|
||||||
S(repaint_delay, repaint_delay);
|
S(repaint_delay, repaint_delay);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user