Merge branch 'background-tint-gaps' of https://github.com/page-down/kitty

This commit is contained in:
Kovid Goyal 2022-11-21 10:17:36 +05:30
commit 03dc24f913
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 47 additions and 3 deletions

View File

@ -49,6 +49,9 @@ Detailed list of changes
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`) - Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
0.26.5 [2022-11-07] 0.26.5 [2022-11-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -70,6 +73,7 @@ Detailed list of changes
- Remote control: When matching window by `state:focused` and no window currently has keyboard focus, match the window belonging to the OS window that was last focused (:iss:`5602`) - Remote control: When matching window by `state:focused` and no window currently has keyboard focus, match the window belonging to the OS window that was last focused (:iss:`5602`)
0.26.4 [2022-10-17] 0.26.4 [2022-10-17]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -142,6 +146,7 @@ Detailed list of changes
code execution if the user clicked on a notification popup from a malicious code execution if the user clicked on a notification popup from a malicious
source. Thanks to Carter Sande for discovering this vulnerability. source. Thanks to Carter Sande for discovering this vulnerability.
0.26.1 [2022-08-30] 0.26.1 [2022-08-30]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -151,6 +156,7 @@ Detailed list of changes
- Allow specifying a title when using the :ac:`set_tab_title` action (:iss:`5441`) - Allow specifying a title when using the :ac:`set_tab_title` action (:iss:`5441`)
0.26.0 [2022-08-29] 0.26.0 [2022-08-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1637,6 +1643,7 @@ Detailed list of changes
- Fix :option:`--title` not being applied at window creation time (:iss:`2570`) - Fix :option:`--title` not being applied at window creation time (:iss:`2570`)
0.17.2 [2020-03-29] 0.17.2 [2020-03-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1821,6 +1828,7 @@ Detailed list of changes
- When windows are semi-transparent and all contain graphics, correctly render - When windows are semi-transparent and all contain graphics, correctly render
them. (:iss:`2310`) them. (:iss:`2310`)
0.15.1 [2019-12-21] 0.15.1 [2019-12-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1929,6 +1937,7 @@ Detailed list of changes
- Use selection foreground color for underlines as well (:iss:`1982`) - Use selection foreground color for underlines as well (:iss:`1982`)
0.14.4 [2019-08-31] 0.14.4 [2019-08-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2235,6 +2244,7 @@ Detailed list of changes
- Mouse selection: When extending by word, fix extending selection to non-word - Mouse selection: When extending by word, fix extending selection to non-word
characters not working well (:iss:`1616`) characters not working well (:iss:`1616`)
0.13.3 [2019-01-19] 0.13.3 [2019-01-19]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2328,6 +2338,7 @@ Detailed list of changes
- Fix resizing window smaller and then restoring causing some wrapped lines to not - Fix resizing window smaller and then restoring causing some wrapped lines to not
be properly unwrapped (:iss:`1206`) be properly unwrapped (:iss:`1206`)
0.13.0 [2018-12-05] 0.13.0 [2018-12-05]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2425,6 +2436,7 @@ Detailed list of changes
- Fix hover detection of URLs not working when hovering over the first colon - Fix hover detection of URLs not working when hovering over the first colon
and slash characters in short URLs (:iss:`1201`) and slash characters in short URLs (:iss:`1201`)
0.12.3 [2018-09-29] 0.12.3 [2018-09-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2501,6 +2513,7 @@ Detailed list of changes
- Fix using :opt:`focus_follows_mouse` causing text selection with the - Fix using :opt:`focus_follows_mouse` causing text selection with the
mouse to malfunction when using multiple kitty windows (:iss:`1002`) mouse to malfunction when using multiple kitty windows (:iss:`1002`)
0.12.1 [2018-09-08] 0.12.1 [2018-09-08]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2544,6 +2557,7 @@ Detailed list of changes
- macOS: Diff kitten: Fix syntax highlighting not working because of - macOS: Diff kitten: Fix syntax highlighting not working because of
a bug in the 0.12.0 macOS package a bug in the 0.12.0 macOS package
0.12.0 [2018-09-01] 0.12.0 [2018-09-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -3054,6 +3068,7 @@ Detailed list of changes
- Fix a crash when getting the contents of the scrollback buffer as text - Fix a crash when getting the contents of the scrollback buffer as text
0.8.1 [2018-03-09] 0.8.1 [2018-03-09]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -3131,6 +3146,7 @@ Detailed list of changes
- Browsing the scrollback buffer now happens in an overlay window instead of a - Browsing the scrollback buffer now happens in an overlay window instead of a
new window/tab. new window/tab.
0.7.1 [2018-01-31] 0.7.1 [2018-01-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1320,6 +1320,14 @@ set and transparent windows are supported or :opt:`background_image` is set.
''' '''
) )
opt('background_tint_gaps', '1.0',
option_type='unit_float', ctype='float',
long_text='''
How much to tint the background image at the window gaps by the background
color, after applying :opt:`background_tint`.
'''
)
opt('dim_opacity', '0.75', opt('dim_opacity', '0.75',
option_type='unit_float', ctype='float', option_type='unit_float', ctype='float',
long_text=''' long_text='''

View File

@ -84,6 +84,9 @@ class Parser:
def background_tint(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: def background_tint(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['background_tint'] = unit_float(val) ans['background_tint'] = unit_float(val)
def background_tint_gaps(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['background_tint_gaps'] = unit_float(val)
def bell_border_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: def bell_border_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['bell_border_color'] = to_color(val) ans['bell_border_color'] = to_color(val)

View File

@ -772,6 +772,19 @@ convert_from_opts_background_tint(PyObject *py_opts, Options *opts) {
Py_DECREF(ret); Py_DECREF(ret);
} }
static void
convert_from_python_background_tint_gaps(PyObject *val, Options *opts) {
opts->background_tint_gaps = PyFloat_AsFloat(val);
}
static void
convert_from_opts_background_tint_gaps(PyObject *py_opts, Options *opts) {
PyObject *ret = PyObject_GetAttrString(py_opts, "background_tint_gaps");
if (ret == NULL) return;
convert_from_python_background_tint_gaps(ret, opts);
Py_DECREF(ret);
}
static void static void
convert_from_python_dim_opacity(PyObject *val, Options *opts) { convert_from_python_dim_opacity(PyObject *val, Options *opts) {
opts->dim_opacity = PyFloat_AsFloat(val); opts->dim_opacity = PyFloat_AsFloat(val);
@ -1126,6 +1139,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_background_tint(py_opts, opts); convert_from_opts_background_tint(py_opts, opts);
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_background_tint_gaps(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_dim_opacity(py_opts, opts); convert_from_opts_dim_opacity(py_opts, opts);
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_mark1_foreground(py_opts, opts); convert_from_opts_mark1_foreground(py_opts, opts);

View File

@ -63,6 +63,7 @@ option_names = ( # {{{
'background_image_linear', 'background_image_linear',
'background_opacity', 'background_opacity',
'background_tint', 'background_tint',
'background_tint_gaps',
'bell_border_color', 'bell_border_color',
'bell_on_tab', 'bell_on_tab',
'bell_path', 'bell_path',
@ -476,6 +477,7 @@ class Options:
background_image_linear: bool = False background_image_linear: bool = False
background_opacity: float = 1.0 background_opacity: float = 1.0
background_tint: float = 0 background_tint: float = 0
background_tint_gaps: float = 1.0
bell_border_color: Color = Color(255, 90, 0) bell_border_color: Color = Color(255, 90, 0)
bell_on_tab: str = '🔔 ' bell_on_tab: str = '🔔 '
bell_path: typing.Optional[str] = None bell_path: typing.Optional[str] = None

View File

@ -980,7 +980,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
draw_bg(w); draw_bg(w);
BLEND_ONTO_OPAQUE; BLEND_ONTO_OPAQUE;
background_opacity = 1.0f; background_opacity = 1.0f;
tint_opacity = OPT(background_tint); tint_opacity = OPT(background_tint) * OPT(background_tint_gaps);
tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f; tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f;
} }

View File

@ -52,7 +52,7 @@ typedef struct {
BackgroundImageLayout background_image_layout; BackgroundImageLayout background_image_layout;
ImageAnchorPosition window_logo_position; ImageAnchorPosition window_logo_position;
bool background_image_linear; bool background_image_linear;
float background_tint, window_logo_alpha; float background_tint, background_tint_gaps, window_logo_alpha;
bool dynamic_background_opacity; bool dynamic_background_opacity;
float inactive_text_alpha; float inactive_text_alpha;