mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 06:54:58 +02:00
Cleanup previous PR
This commit is contained in:
@@ -55,6 +55,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- A new option, :opt:`window_logo_scale` to specify how window logo are scaled with respect to the size of the window containing the logo (:pull:`7534`)
|
- A new option, :opt:`window_logo_scale` to specify how window logo are scaled with respect to the size of the window containing the logo (:pull:`7534`)
|
||||||
|
|
||||||
|
- A new option, :opt:`cursor_shape_unfocused` to specify the shape of the text cursor in unfocused OS windows (:pull:`7544`)
|
||||||
|
|
||||||
0.35.1 [2024-05-31]
|
0.35.1 [2024-05-31]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -330,6 +330,12 @@ cursor shape to :code:`beam` at shell prompts. You can avoid this by setting
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
opt('cursor_shape_unfocused', 'hollow', option_type='to_cursor_unfocused_shape', ctype='int', long_text='''
|
||||||
|
Defines the text cursor shape when the OS window is not focused. The unfocused
|
||||||
|
cursor shape can be one of :code:`block`, :code:`beam`, :code:`underline`,
|
||||||
|
:code:`hollow`.
|
||||||
|
''')
|
||||||
|
|
||||||
opt('cursor_beam_thickness', '1.5',
|
opt('cursor_beam_thickness', '1.5',
|
||||||
option_type='positive_float', ctype='float',
|
option_type='positive_float', ctype='float',
|
||||||
long_text='The thickness of the beam cursor (in pts).'
|
long_text='The thickness of the beam cursor (in pts).'
|
||||||
@@ -357,14 +363,6 @@ inactivity. Set to zero to never stop blinking.
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
opt('cursor_unfocused_shape', 'hollow',
|
|
||||||
option_type='to_cursor_unfocused_shape', ctype='int',
|
|
||||||
long_text='''
|
|
||||||
Defines the cursor shape when the terminal window is not focused. The unfocused
|
|
||||||
cursor shape can be one of :code:`block`, :code:`beam`, :code:`underline`,
|
|
||||||
:code:`hollow`.
|
|
||||||
'''
|
|
||||||
)
|
|
||||||
egr() # }}}
|
egr() # }}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
kitty/options/parse.py
generated
6
kitty/options/parse.py
generated
@@ -920,6 +920,9 @@ class Parser:
|
|||||||
def cursor_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def cursor_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['cursor_shape'] = to_cursor_shape(val)
|
ans['cursor_shape'] = to_cursor_shape(val)
|
||||||
|
|
||||||
|
def cursor_shape_unfocused(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
|
ans['cursor_shape_unfocused'] = to_cursor_unfocused_shape(val)
|
||||||
|
|
||||||
def cursor_stop_blinking_after(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def cursor_stop_blinking_after(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['cursor_stop_blinking_after'] = positive_float(val)
|
ans['cursor_stop_blinking_after'] = positive_float(val)
|
||||||
|
|
||||||
@@ -929,9 +932,6 @@ class Parser:
|
|||||||
def cursor_underline_thickness(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def cursor_underline_thickness(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['cursor_underline_thickness'] = positive_float(val)
|
ans['cursor_underline_thickness'] = positive_float(val)
|
||||||
|
|
||||||
def cursor_unfocused_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
|
||||||
ans['cursor_unfocused_shape'] = to_cursor_unfocused_shape(val)
|
|
||||||
|
|
||||||
def default_pointer_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def default_pointer_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
val = val.lower()
|
val = val.lower()
|
||||||
if val not in self.choices_for_default_pointer_shape:
|
if val not in self.choices_for_default_pointer_shape:
|
||||||
|
|||||||
30
kitty/options/to-c-generated.h
generated
30
kitty/options/to-c-generated.h
generated
@@ -83,6 +83,19 @@ convert_from_opts_cursor_shape(PyObject *py_opts, Options *opts) {
|
|||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_python_cursor_shape_unfocused(PyObject *val, Options *opts) {
|
||||||
|
opts->cursor_shape_unfocused = PyLong_AsLong(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_opts_cursor_shape_unfocused(PyObject *py_opts, Options *opts) {
|
||||||
|
PyObject *ret = PyObject_GetAttrString(py_opts, "cursor_shape_unfocused");
|
||||||
|
if (ret == NULL) return;
|
||||||
|
convert_from_python_cursor_shape_unfocused(ret, opts);
|
||||||
|
Py_DECREF(ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_from_python_cursor_beam_thickness(PyObject *val, Options *opts) {
|
convert_from_python_cursor_beam_thickness(PyObject *val, Options *opts) {
|
||||||
opts->cursor_beam_thickness = PyFloat_AsFloat(val);
|
opts->cursor_beam_thickness = PyFloat_AsFloat(val);
|
||||||
@@ -135,19 +148,6 @@ convert_from_opts_cursor_stop_blinking_after(PyObject *py_opts, Options *opts) {
|
|||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
convert_from_python_cursor_unfocused_shape(PyObject *val, Options *opts) {
|
|
||||||
opts->cursor_unfocused_shape = PyLong_AsLong(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
convert_from_opts_cursor_unfocused_shape(PyObject *py_opts, Options *opts) {
|
|
||||||
PyObject *ret = PyObject_GetAttrString(py_opts, "cursor_unfocused_shape");
|
|
||||||
if (ret == NULL) return;
|
|
||||||
convert_from_python_cursor_unfocused_shape(ret, opts);
|
|
||||||
Py_DECREF(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_from_python_scrollback_indicator_opacity(PyObject *val, Options *opts) {
|
convert_from_python_scrollback_indicator_opacity(PyObject *val, Options *opts) {
|
||||||
opts->scrollback_indicator_opacity = PyFloat_AsFloat(val);
|
opts->scrollback_indicator_opacity = PyFloat_AsFloat(val);
|
||||||
@@ -1176,6 +1176,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_cursor_shape(py_opts, opts);
|
convert_from_opts_cursor_shape(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
|
convert_from_opts_cursor_shape_unfocused(py_opts, opts);
|
||||||
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_cursor_beam_thickness(py_opts, opts);
|
convert_from_opts_cursor_beam_thickness(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_cursor_underline_thickness(py_opts, opts);
|
convert_from_opts_cursor_underline_thickness(py_opts, opts);
|
||||||
@@ -1184,8 +1186,6 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_cursor_stop_blinking_after(py_opts, opts);
|
convert_from_opts_cursor_stop_blinking_after(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_cursor_unfocused_shape(py_opts, opts);
|
|
||||||
if (PyErr_Occurred()) return false;
|
|
||||||
convert_from_opts_scrollback_indicator_opacity(py_opts, opts);
|
convert_from_opts_scrollback_indicator_opacity(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_scrollback_pager_history_size(py_opts, opts);
|
convert_from_opts_scrollback_pager_history_size(py_opts, opts);
|
||||||
|
|||||||
4
kitty/options/types.py
generated
4
kitty/options/types.py
generated
@@ -330,10 +330,10 @@ option_names = ( # {{{
|
|||||||
'cursor_beam_thickness',
|
'cursor_beam_thickness',
|
||||||
'cursor_blink_interval',
|
'cursor_blink_interval',
|
||||||
'cursor_shape',
|
'cursor_shape',
|
||||||
|
'cursor_shape_unfocused',
|
||||||
'cursor_stop_blinking_after',
|
'cursor_stop_blinking_after',
|
||||||
'cursor_text_color',
|
'cursor_text_color',
|
||||||
'cursor_underline_thickness',
|
'cursor_underline_thickness',
|
||||||
'cursor_unfocused_shape',
|
|
||||||
'default_pointer_shape',
|
'default_pointer_shape',
|
||||||
'detect_urls',
|
'detect_urls',
|
||||||
'dim_opacity',
|
'dim_opacity',
|
||||||
@@ -504,10 +504,10 @@ class Options:
|
|||||||
cursor_beam_thickness: float = 1.5
|
cursor_beam_thickness: float = 1.5
|
||||||
cursor_blink_interval: float = -1.0
|
cursor_blink_interval: float = -1.0
|
||||||
cursor_shape: int = 1
|
cursor_shape: int = 1
|
||||||
|
cursor_shape_unfocused: int = 0
|
||||||
cursor_stop_blinking_after: float = 15.0
|
cursor_stop_blinking_after: float = 15.0
|
||||||
cursor_text_color: typing.Optional[kitty.fast_data_types.Color] = Color(17, 17, 17)
|
cursor_text_color: typing.Optional[kitty.fast_data_types.Color] = Color(17, 17, 17)
|
||||||
cursor_underline_thickness: float = 2.0
|
cursor_underline_thickness: float = 2.0
|
||||||
cursor_unfocused_shape: int = 0
|
|
||||||
default_pointer_shape: choices_for_default_pointer_shape = 'beam'
|
default_pointer_shape: choices_for_default_pointer_shape = 'beam'
|
||||||
detect_urls: bool = True
|
detect_urls: bool = True
|
||||||
dim_opacity: float = 0.4
|
dim_opacity: float = 0.4
|
||||||
|
|||||||
@@ -524,6 +524,13 @@ cshapes = {
|
|||||||
'beam': CURSOR_BEAM,
|
'beam': CURSOR_BEAM,
|
||||||
'underline': CURSOR_UNDERLINE
|
'underline': CURSOR_UNDERLINE
|
||||||
}
|
}
|
||||||
|
cshapes_unfocused = {
|
||||||
|
'block': CURSOR_BLOCK,
|
||||||
|
'beam': CURSOR_BEAM,
|
||||||
|
'underline': CURSOR_UNDERLINE,
|
||||||
|
'hollow': NO_CURSOR_SHAPE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def to_cursor_shape(x: str) -> int:
|
def to_cursor_shape(x: str) -> int:
|
||||||
try:
|
try:
|
||||||
@@ -536,19 +543,12 @@ def to_cursor_shape(x: str) -> int:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
cshapes_unfocused = {
|
|
||||||
'block': CURSOR_BLOCK,
|
|
||||||
'beam': CURSOR_BEAM,
|
|
||||||
'underline': CURSOR_UNDERLINE,
|
|
||||||
'hollow': NO_CURSOR_SHAPE
|
|
||||||
}
|
|
||||||
|
|
||||||
def to_cursor_unfocused_shape(x: str) -> int:
|
def to_cursor_unfocused_shape(x: str) -> int:
|
||||||
try:
|
try:
|
||||||
return cshapes_unfocused[x.lower()]
|
return cshapes_unfocused[x.lower()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Invalid inactive cursor shape: {} allowed values are {}'.format(
|
'Invalid unfocused cursor shape: {} allowed values are {}'.format(
|
||||||
x, ', '.join(cshapes_unfocused)
|
x, ', '.join(cshapes_unfocused)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
|
|||||||
rd->cursor_fg_sprite_idx = UNDERLINE_IDX; break;
|
rd->cursor_fg_sprite_idx = UNDERLINE_IDX; break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(OPT(cursor_unfocused_shape)) {
|
switch(OPT(cursor_shape_unfocused)) {
|
||||||
default:
|
default:
|
||||||
rd->cursor_fg_sprite_idx = UNFOCUSED_IDX; break;
|
rd->cursor_fg_sprite_idx = UNFOCUSED_IDX; break;
|
||||||
case CURSOR_BEAM:
|
case CURSOR_BEAM:
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ typedef struct {
|
|||||||
double wheel_scroll_multiplier, touch_scroll_multiplier;
|
double wheel_scroll_multiplier, touch_scroll_multiplier;
|
||||||
int wheel_scroll_min_lines;
|
int wheel_scroll_min_lines;
|
||||||
bool enable_audio_bell;
|
bool enable_audio_bell;
|
||||||
CursorShape cursor_shape;
|
CursorShape cursor_shape, cursor_shape_unfocused;
|
||||||
CursorShape cursor_unfocused_shape;
|
|
||||||
float cursor_beam_thickness;
|
float cursor_beam_thickness;
|
||||||
float cursor_underline_thickness;
|
float cursor_underline_thickness;
|
||||||
unsigned int url_style;
|
unsigned int url_style;
|
||||||
|
|||||||
Reference in New Issue
Block a user