Compare commits

..

38 Commits

Author SHA1 Message Date
Kovid Goyal
b65119b8a9 Color separators in the tab bar using inactive bg except for the last one 2020-03-29 09:20:17 +05:30
Kovid Goyal
86703da917 version 0.17.2 2020-03-29 09:09:16 +05:30
Kovid Goyal
610e9afdf0 Add completion of conf filenames to kitty @ set-colors 2020-03-29 08:41:27 +05:30
Kovid Goyal
e3af9f68d3 Linux: Fix selection of fonts with multiple width variants not preferring the normal width faces
Fixes #2491
2020-03-29 01:52:33 +05:30
Kovid Goyal
747ac85e7c Add an :option:launch --watcher option that allows defining callbacks that are called for various events in the window's life-cycle
Fixes #2440
2020-03-28 12:13:42 +05:30
Kovid Goyal
8c23f9e526 DRYer 2020-03-28 09:20:28 +05:30
Kovid Goyal
e6e339fcd3 ... 2020-03-28 08:44:48 +05:30
Kovid Goyal
f04680ac47 Fix a regression in 0.17 that broke the kitty @ launch remote command and also broke the --tab-title option when creating a new tab.
Fixes #2488
2020-03-28 08:43:32 +05:30
Kovid Goyal
90985cc846 Merge branch 'hints-copy-to-primary-selection' of https://github.com/trygveaa/kitty 2020-03-28 08:21:08 +05:30
Trygve Aaberge
63917944f2 Add an option to hints for copying to the primary selection 2020-03-27 20:23:02 +01:00
Kovid Goyal
793605f80f Update changelog 2020-03-26 22:06:13 +05:30
Kovid Goyal
93a281c7e3 Add a new mappable action `close_other_windows_in_tab` to close all but the active window
Fixes #2484
2020-03-26 22:05:00 +05:30
Kovid Goyal
8f1c6c4d74 Fix #2482 2020-03-26 00:53:19 +05:30
Kovid Goyal
1610dba7ab patch tab bar colors correctly 2020-03-26 00:46:30 +05:30
Kovid Goyal
d9d419991c Respect tab_bar_background again 2020-03-26 00:41:19 +05:30
Kovid Goyal
f9e86b19aa Fix #2480 2020-03-26 00:20:10 +05:30
Kovid Goyal
fffb976e43 Fix blank space at the start of tab bar in powerline style when first tab is inactive
Fix #2478
2020-03-25 19:20:35 +05:30
Kovid Goyal
0da566b49f Hints kitten: Adjust the default regex used to detect line numbers to handle line+column numbers
See #2268
2020-03-25 10:03:25 +05:30
Kovid Goyal
da55717d20 The splits layout needs its own draw_minimal_borders implementation 2020-03-25 09:54:06 +05:30
Kovid Goyal
254836902c Merge branch 'fix/window-border' of https://github.com/pyrho/kitty 2020-03-25 09:35:46 +05:30
Damien Rajon
d01f8d1865 fix(window): inactive window border fix
Fixes #2474.
2020-03-25 00:09:10 +01:00
Kovid Goyal
a46c3f7007 Replace use of cast() 2020-03-24 22:03:10 +05:30
Kovid Goyal
4e58062025 Improve rendering of :option: in cli docs 2020-03-24 22:03:00 +05:30
Kovid Goyal
aa3be0535f version 0.17.1 2020-03-24 19:45:19 +05:30
Kovid Goyal
8ebf5e007c Fix rc setting cursor_text_color to background not working 2020-03-24 19:43:31 +05:30
Kovid Goyal
c2957e7f12 Fix a regression in 0.17 that caused kitty @ set-colors to require setting cursor_text_color
Fixes #2470
2020-03-24 19:29:25 +05:30
Kovid Goyal
bf7c26d357 CoreText: Prefer less bold variants over heavier variants when auto-selecting the bold face 2020-03-24 19:27:14 +05:30
Kovid Goyal
0547102bdd Fix #2468 2020-03-24 18:33:32 +05:30
Kovid Goyal
a07369ce69 Update changelog 2020-03-24 18:14:14 +05:30
Kovid Goyal
21c5610431 ... 2020-03-24 18:02:44 +05:30
Kovid Goyal
6dbdf72f40 CoreText: When matching fonts prefer non-expanded/condensed variants 2020-03-24 17:55:38 +05:30
Kovid Goyal
76a6bba643 Fix #2466 2020-03-24 17:07:37 +05:30
Kovid Goyal
b0b8222a96 ... 2020-03-24 17:04:17 +05:30
Kovid Goyal
0d87b8fac5 Fix a regression in 0.17 that caused tab bar background to be rendered after the last tab as well
Fixes #2464
2020-03-24 16:05:02 +05:30
Kovid Goyal
5227b1f98b Fix :opt:cursor_underline_thickness not working
Fixes #2465
2020-03-24 15:53:13 +05:30
Kovid Goyal
c4f7c5c1cd More explanation for OSC 52 extension 2020-03-24 11:58:30 +05:30
Kovid Goyal
33a84a609c ... 2020-03-24 11:35:34 +05:30
Kovid Goyal
037111715a ... 2020-03-24 11:34:29 +05:30
27 changed files with 409 additions and 194 deletions

View File

@@ -4,10 +4,56 @@ Changelog
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
To update |kitty|, :doc:`follow the instructions <binary>`.
0.17.2 [2020-03-29]
--------------------
- Add a :option:`launch --watcher` option that allows defining callbacks
that are called for various events in the window's life-cycle (:iss:`2440`)
- Fix a regression in 0.17 that broke drawing of borders with non-minimal
borders (:iss:`2474`)
- Hints kitten: Allow copying to primary selection as well as clipboard
(:pull:`2487`)
- Add a new mappable action ``close_other_windows_in_tab`` to close all but the
active window (:iss:`2484`)
- Hints kitten: Adjust the default regex used to detect line numbers to handle
line+column numbers (:iss:`2268`)
- Fix blank space at the start of tab bar in the powerline style when first tab is
inactive (:iss:`2478`)
- Fix regression causing incorrect rendering of separators in tab bar when
defining a tab bar background color (:pull:`2480`)
- Fix a regression in 0.17 that broke the kitty @ launch remote command and
also broke the --tab-title option when creating a new tab. (:iss:`2488`)
- Linux: Fix selection of fonts with multiple width variants not preferring
the normal width faces (:iss:`2491`)
0.17.1 [2020-03-24]
--------------------
- Fix :opt:`cursor_underline_thickness` not working (:iss:`2465`)
- Fix a regression in 0.17 that caused tab bar background to be rendered after
the last tab as well (:iss:`2464`)
- macOS: Fix a regression in 0.17 that caused incorrect variants to be
automatically selected for some fonts (:iss:`2462`)
- Fix a regression in 0.17 that caused kitty @ set-colors to require setting
cursor_text_color (:iss:`2470`)
0.17.0 [2020-03-24]
--------------------
- A new :ref:`splits_layout` to arrange windows in arbitrary splits
- :ref:`splits_layout` to arrange windows in arbitrary splits
(:iss:`2308`)
- Add support for specifying a background image, see :opt:`background_image`

View File

@@ -192,6 +192,12 @@ Similarly, you can detach the current tab, with::
# asks which OS Window to move the tab into
map ctrl+f4 detach_tab ask
Finally, you can define a shortcut to close all windows in a tab other than
the currently active window::
map f9 close_other_windows_in_tab
Other keyboard shortcuts
----------------------------------

View File

@@ -61,6 +61,35 @@ currently active kitty window. For example::
map f1 launch my-program @active-kitty-window-id
Watching launched windows
---------------------------
The :option:`launch --watcher` option allows you to specify python functions
that will be called at specific events, such as when the window is resized or
closed. Simply specify the path to a python module that specifies callback
functions for the events you are interested in, for example:
.. code-block:: python
def on_resize(boss, window, data):
# Here data will contain old_geometry and new_geometry
def on_close(boss, window, data):
# called when window is closed, typically when the program running in
# it exits.
Every callback is passed a reference to the global ``Boss`` object as well as
the ``Window`` object the action is occurring on. The ``data`` object is
mapping that contains event dependent data. Some useful methods and attributes
for the ``Window`` object are: ``as_text(as_ans=False, add_history=False,
add_wrap_markers=False, alternate_screen=False)`` with which you can get the
contents of the window and its scrollback buffer. Similarly,
``window.child.pid`` is the PID of the processes that was launched
in the window and ``window.id`` is the internal kitty ``id`` of the
window.
Syntax reference
------------------

View File

@@ -24,7 +24,7 @@ other in arbitrary arrangements, based on *Layouts*, see below for examples:
There are many different layouts available. They are all enabled by default,
you can switch layouts using :sc:`next_layout`. To control which layouts
are available use :opt:`enabled_layouts` the first listed layout becomes
are available use :opt:`enabled_layouts`, the first listed layout becomes
the default. Individual layouts and how to use them are described below.
.. contents::

View File

@@ -219,6 +219,11 @@ first, for example::
<ESC>]52;c;!<ESC>\
Here ``!`` is not valid base64 encoded text, so it clears the clipboard.
Further, since it is invalid, it should be ignored by terminal emulators
that do not support this extension, thereby making it safe to use, simply
always send it before starting a new OSC 52 paste, even if you aren't chunking
up large pastes, that way kitty wont concatenate your paste, and it will have
no ill-effects in other terminal emulators.
In case you're using software that can't be easily adapted to this
protocol extension, it can be disabled by specifying ``no-append`` to the

View File

@@ -165,7 +165,7 @@ class Function:
self.args = [Arg('void v')]
def declaration(self) -> str:
return 'typedef {restype} (*{name}_func)({args});\n{name}_func {name}_impl;\n#define {name} {name}_impl'.format(
return 'typedef {restype} (*{name}_func)({args});\nGFW_EXTERN {name}_func {name}_impl;\n#define {name} {name}_impl'.format(
restype=self.restype,
name=self.name,
args=', '.join(a.type for a in self.args)
@@ -233,6 +233,9 @@ const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callbac
#include <stdint.h>
#include "monotonic.h"
#ifndef GFW_EXTERN
#define GFW_EXTERN extern
#endif
{}
typedef int (* GLFWcocoatextinputfilterfun)(int,int,unsigned int,unsigned long);
@@ -251,6 +254,7 @@ const char* load_glfw(const char* path);
f.write(header)
code = '''
#define GFW_EXTERN
#include "data-types.h"
#include "glfw-wrapper.h"
#include <dlfcn.h>

View File

@@ -48,6 +48,9 @@ try:
except ImportError:
has_highlighter = False
def highlight_collection(collection: 'Collection', aliases: Optional[Dict[str, str]] = None) -> Union[str, Dict[str, 'DiffHighlight']]:
return ''
INITIALIZING, COLLECTED, DIFFED, COMMAND, MESSAGE = range(5)
ESCAPE = K['ESCAPE']

View File

@@ -21,7 +21,7 @@ from kitty.key_encoding import (
KeyEvent, backspace_key, enter_key, key_defs as K
)
from kitty.typing import BossType, KittyCommonOpts
from kitty.utils import ScreenSize, screen_size_function
from kitty.utils import ScreenSize, screen_size_function, set_primary_selection
from ..tui.handler import Handler, result_handler
from ..tui.loop import Loop
@@ -349,7 +349,7 @@ def parse_input(text: str) -> str:
def linenum_marks(text: str, args: HintsCLIOptions, Mark: Type[Mark], extra_cli_args: Sequence[str], *a: Any) -> Generator[Mark, None, None]:
regex = args.regex
if regex == DEFAULT_REGEX:
regex = r'(?P<path>(?:\S*/\S+)|(?:\S+[.][a-zA-Z0-9]{2,7})):(?P<line>\d+)'
regex = r'(?P<path>(?:\S*/\S+?)|(?:\S+[.][a-zA-Z0-9]{2,7})):(?P<line>\d+)'
yield from mark(regex, [brackets, quotes], text, args)
@@ -360,12 +360,8 @@ def load_custom_processor(customize_processing: str) -> Any:
return {k: getattr(m, k) for k in dir(m)}
if customize_processing == '::linenum::':
return {'mark': linenum_marks, 'handle_result': linenum_handle_result}
from kitty.constants import config_dir
customize_processing = os.path.expandvars(os.path.expanduser(customize_processing))
if os.path.isabs(customize_processing):
custom_path = customize_processing
else:
custom_path = os.path.join(config_dir, customize_processing)
from kitty.constants import resolve_custom_file
custom_path = resolve_custom_file(customize_processing)
import runpy
return runpy.run_path(custom_path, run_name='__main__')
@@ -413,9 +409,11 @@ OPTIONS = r'''
type=list
What program to use to open matched text. Defaults to the default open program
for the operating system. Use a value of :file:`-` to paste the match into the
terminal window instead. A value of :file:`@` will copy the match to the clipboard.
A value of :file:`default` will run the default open program. Can be specified
multiple times to run multiple programs.
terminal window instead. A value of :file:`@` will copy the match to the
clipboard. A value of :file:`*` will copy the match to the primary selection
(on systems that support primary selections). A value of :file:`default` will
run the default open program. Can be specified multiple times to run multiple
programs.
--type
@@ -629,6 +627,8 @@ def handle_result(args: List[str], data: Dict[str, Any], target_window_id: int,
w.paste(joined_text())
elif program == '@':
set_clipboard_string(joined_text())
elif program == '*':
set_primary_selection(joined_text())
else:
cwd = None
w = boss.window_id_map.get(target_window_id)

View File

@@ -96,7 +96,9 @@ def opt(text: str) -> str:
def option(x: str) -> str:
idx = x.find('-')
idx = x.rfind('--')
if idx < 0:
idx = x.find('-')
if idx > -1:
x = x[idx:]
parts = map(bold, x.split())
@@ -119,6 +121,10 @@ def file(x: str) -> str:
return italic(x)
def doc(x: str) -> str:
return f'https://sw.kovidgoyal.net/kitty/{x}.html'
OptionSpecSeq = List[Union[str, OptionDict]]

View File

@@ -6,7 +6,7 @@ import re
from functools import partial
from typing import (
Any, Callable, Dict, Generator, Iterable, List, Match, Optional, Sequence,
Set, Tuple, Union, cast, get_type_hints
Set, Tuple, Union, get_type_hints
)
from .utils import to_bool
@@ -156,7 +156,7 @@ def remove_markup(text: str) -> str:
'layouts': 'https://sw.kovidgoyal.net/kitty/index.html#layouts',
'sessions': 'https://sw.kovidgoyal.net/kitty/index.html#sessions',
}[m.group(2)]
return cast(str, m.group(2))
return str(m.group(2))
return re.sub(r':([a-zA-Z0-9]+):`(.+?)`', sub, text, flags=re.DOTALL)

View File

@@ -20,7 +20,7 @@ class Version(NamedTuple):
appname: str = 'kitty'
version: Version = Version(0, 17, 0)
version: Version = Version(0, 17, 2)
str_version: str = '.'.join(map(str, version))
_plat = sys.platform.lower()
is_macos: bool = 'darwin' in _plat
@@ -198,3 +198,10 @@ def running_in_kitty(set_val: Optional[bool] = None) -> bool:
if set_val is not None:
setattr(running_in_kitty, 'ans', set_val)
return bool(getattr(running_in_kitty, 'ans', False))
def resolve_custom_file(path: str) -> str:
path = os.path.expandvars(os.path.expanduser(path))
if not os.path.isabs(path):
path = os.path.join(config_dir, path)
return path

View File

@@ -92,10 +92,10 @@ font_descriptor_to_python(CTFontDescriptorRef descriptor) {
NSString *style = (NSString *) CTFontDescriptorCopyAttribute(descriptor, kCTFontStyleNameAttribute);
NSDictionary *traits = (NSDictionary *) CTFontDescriptorCopyAttribute(descriptor, kCTFontTraitsAttribute);
unsigned int straits = [traits[(id)kCTFontSymbolicTrait] unsignedIntValue];
NSNumber *weightVal = traits[(id)kCTFontWeightTrait];
NSNumber *widthVal = traits[(id)kCTFontWidthTrait];
float weightVal = [traits[(id)kCTFontWeightTrait] floatValue];
float widthVal = [traits[(id)kCTFontWidthTrait] floatValue];
PyObject *ans = Py_BuildValue("{ssssssss sOsOsO sfsfsI}",
PyObject *ans = Py_BuildValue("{ssssssss sOsOsOsOsOsO sfsfsI}",
"path", [[url path] UTF8String],
"postscript_name", [psName UTF8String],
"family", [family UTF8String],
@@ -104,9 +104,12 @@ font_descriptor_to_python(CTFontDescriptorRef descriptor) {
"bold", (straits & kCTFontBoldTrait) != 0 ? Py_True : Py_False,
"italic", (straits & kCTFontItalicTrait) != 0 ? Py_True : Py_False,
"monospace", (straits & kCTFontMonoSpaceTrait) != 0 ? Py_True : Py_False,
"expanded", (straits & kCTFontExpandedTrait) != 0 ? Py_True : Py_False,
"condensed", (straits & kCTFontCondensedTrait) != 0 ? Py_True : Py_False,
"color_glyphs", (straits & kCTFontColorGlyphsTrait) != 0 ? Py_True : Py_False,
"weight", [weightVal floatValue],
"width", [widthVal floatValue],
"weight", weightVal,
"width", widthVal,
"traits", straits
);
[url release];

View File

@@ -323,6 +323,7 @@ FC_MONO: int = 100
FC_DUAL: int
FC_WEIGHT_REGULAR: int
FC_WEIGHT_BOLD: int
FC_WIDTH_NORMAL: int
FC_SLANT_ROMAN: int
FC_SLANT_ITALIC: int
BORDERS_PROGRAM: int
@@ -402,6 +403,7 @@ class FontConfigPattern(TypedDict):
style: str
spacing: str
weight: int
width: int
slant: int
hint_style: int
subpixel: int
@@ -438,6 +440,9 @@ class CoreTextFont(TypedDict):
style: str
bold: bool
italic: bool
expanded: bool
condensed: bool
color_glyphs: bool
monospace: bool
weight: float
width: float

View File

@@ -47,6 +47,7 @@ pattern_as_dict(FcPattern *pat) {
S(FC_FULLNAME, full_name);
S(FC_POSTSCRIPT_NAME, postscript_name);
I(FC_WEIGHT, weight);
I(FC_WIDTH, width)
I(FC_SLANT, slant);
I(FC_HINT_STYLE, hint_style);
I(FC_INDEX, index);
@@ -247,5 +248,7 @@ init_fontconfig_library(PyObject *module) {
PyModule_AddIntMacro(module, FC_DUAL);
PyModule_AddIntMacro(module, FC_MONO);
PyModule_AddIntMacro(module, FC_CHARCELL);
PyModule_AddIntMacro(module, FC_WIDTH_NORMAL);
return true;
}

View File

@@ -1243,7 +1243,7 @@ send_prerendered_sprites(FontGroup *fg) {
current_send_sprite_to_gpu((FONTS_DATA_HANDLE)fg, x, y, z, fg->canvas);
do_increment(fg, &error);
if (error != 0) { sprite_map_set_error(error); PyErr_Print(); fatal("Failed"); }
PyObject *args = PyObject_CallFunction(prerender_function, "IIIIIffdd", fg->cell_width, fg->cell_height, fg->baseline, fg->underline_position, fg->underline_thickness, OPT(cursor_beam_thickness), fg->logical_dpi_x, fg->logical_dpi_y);
PyObject *args = PyObject_CallFunction(prerender_function, "IIIIIffdd", fg->cell_width, fg->cell_height, fg->baseline, fg->underline_position, fg->underline_thickness, OPT(cursor_beam_thickness), OPT(cursor_underline_thickness), fg->logical_dpi_x, fg->logical_dpi_y);
if (args == NULL) { PyErr_Print(); fatal("Failed to pre-render cells"); }
for (ssize_t i = 0; i < PyTuple_GET_SIZE(args) - 1; i++) {
x = fg->sprite_tracker.x; y = fg->sprite_tracker.y; z = fg->sprite_tracker.z;

View File

@@ -54,12 +54,16 @@ def find_best_match(family: str, bold: bool = False, italic: bool = False) -> Co
q = re.sub(r'\s+', ' ', family.lower())
font_map = all_fonts_map()
def score(candidate: CoreTextFont) -> Tuple[int, int]:
def score(candidate: CoreTextFont) -> Tuple[int, int, int, float]:
style_match = 1 if candidate['bold'] == bold and candidate[
'italic'
] == italic else 0
monospace_match = 1 if candidate['monospace'] else 0
return style_match, monospace_match
is_regular_width = not candidate['expanded'] and not candidate['condensed']
# prefer demi-bold to bold to heavy, less bold means less chance of
# overflow
weight_distance_from_medium = abs(candidate['weight'])
return style_match, monospace_match, 1 if is_regular_width else 0, 1 - weight_distance_from_medium
# First look for an exact match
for selector in ('ps_map', 'full_map'):

View File

@@ -8,7 +8,7 @@ from typing import Dict, Generator, List, Optional, Tuple, cast
from kitty.fast_data_types import (
FC_DUAL, FC_MONO, FC_SLANT_ITALIC, FC_SLANT_ROMAN, FC_WEIGHT_BOLD,
FC_WEIGHT_REGULAR, fc_list, fc_match as fc_match_impl
FC_WEIGHT_REGULAR, FC_WIDTH_NORMAL, fc_list, fc_match as fc_match_impl
)
from kitty.options_stub import Options
from kitty.typing import FontConfigPattern
@@ -73,11 +73,13 @@ def find_best_match(family: str, bold: bool = False, italic: bool = False, monos
q = family_name_to_key(family)
font_map = all_fonts_map(monospaced)
def score(candidate: FontConfigPattern) -> Tuple[int, int]:
def score(candidate: FontConfigPattern) -> Tuple[int, int, int]:
bold_score = abs((FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR) - candidate.get('weight', 0))
italic_score = abs((FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN) - candidate.get('slant', 0))
monospace_match = 0 if candidate.get('spacing') == 'MONO' else 1
return bold_score + italic_score, monospace_match
width_score = abs(candidate.get('width', FC_WIDTH_NORMAL) - FC_WIDTH_NORMAL)
return bold_score + italic_score, monospace_match, width_score
# First look for an exact match
for selector in ('ps_map', 'full_map', 'family_map'):

1
kitty/glfw-wrapper.c generated
View File

@@ -1,4 +1,5 @@
#define GFW_EXTERN
#include "data-types.h"
#include "glfw-wrapper.h"
#include <dlfcn.h>

275
kitty/glfw-wrapper.h generated
View File

@@ -9,6 +9,9 @@
#include <stdint.h>
#include "monotonic.h"
#ifndef GFW_EXTERN
#define GFW_EXTERN extern
#endif
/*! @name GLFW version macros
@@ -1587,547 +1590,547 @@ typedef void (*GLFWwaylandframecallbackfunc)(unsigned long long id);
typedef void (*GLFWDBusnotificationcreatedfun)(unsigned long long, uint32_t, void*);
typedef void (*GLFWDBusnotificationactivatedfun)(uint32_t, const char*);
typedef int (*glfwInit_func)(monotonic_t);
glfwInit_func glfwInit_impl;
GFW_EXTERN glfwInit_func glfwInit_impl;
#define glfwInit glfwInit_impl
typedef void (*glfwRunMainLoop_func)(GLFWtickcallback, void*);
glfwRunMainLoop_func glfwRunMainLoop_impl;
GFW_EXTERN glfwRunMainLoop_func glfwRunMainLoop_impl;
#define glfwRunMainLoop glfwRunMainLoop_impl
typedef void (*glfwStopMainLoop_func)(void);
glfwStopMainLoop_func glfwStopMainLoop_impl;
GFW_EXTERN glfwStopMainLoop_func glfwStopMainLoop_impl;
#define glfwStopMainLoop glfwStopMainLoop_impl
typedef unsigned long long (*glfwAddTimer_func)(monotonic_t, bool, GLFWuserdatafun, void *, GLFWuserdatafun);
glfwAddTimer_func glfwAddTimer_impl;
GFW_EXTERN glfwAddTimer_func glfwAddTimer_impl;
#define glfwAddTimer glfwAddTimer_impl
typedef void (*glfwUpdateTimer_func)(unsigned long long, monotonic_t, bool);
glfwUpdateTimer_func glfwUpdateTimer_impl;
GFW_EXTERN glfwUpdateTimer_func glfwUpdateTimer_impl;
#define glfwUpdateTimer glfwUpdateTimer_impl
typedef void (*glfwRemoveTimer_func)(unsigned long);
glfwRemoveTimer_func glfwRemoveTimer_impl;
GFW_EXTERN glfwRemoveTimer_func glfwRemoveTimer_impl;
#define glfwRemoveTimer glfwRemoveTimer_impl
typedef void (*glfwTerminate_func)(void);
glfwTerminate_func glfwTerminate_impl;
GFW_EXTERN glfwTerminate_func glfwTerminate_impl;
#define glfwTerminate glfwTerminate_impl
typedef void (*glfwInitHint_func)(int, int);
glfwInitHint_func glfwInitHint_impl;
GFW_EXTERN glfwInitHint_func glfwInitHint_impl;
#define glfwInitHint glfwInitHint_impl
typedef void (*glfwGetVersion_func)(int*, int*, int*);
glfwGetVersion_func glfwGetVersion_impl;
GFW_EXTERN glfwGetVersion_func glfwGetVersion_impl;
#define glfwGetVersion glfwGetVersion_impl
typedef const char* (*glfwGetVersionString_func)(void);
glfwGetVersionString_func glfwGetVersionString_impl;
GFW_EXTERN glfwGetVersionString_func glfwGetVersionString_impl;
#define glfwGetVersionString glfwGetVersionString_impl
typedef int (*glfwGetError_func)(const char**);
glfwGetError_func glfwGetError_impl;
GFW_EXTERN glfwGetError_func glfwGetError_impl;
#define glfwGetError glfwGetError_impl
typedef GLFWerrorfun (*glfwSetErrorCallback_func)(GLFWerrorfun);
glfwSetErrorCallback_func glfwSetErrorCallback_impl;
GFW_EXTERN glfwSetErrorCallback_func glfwSetErrorCallback_impl;
#define glfwSetErrorCallback glfwSetErrorCallback_impl
typedef GLFWmonitor** (*glfwGetMonitors_func)(int*);
glfwGetMonitors_func glfwGetMonitors_impl;
GFW_EXTERN glfwGetMonitors_func glfwGetMonitors_impl;
#define glfwGetMonitors glfwGetMonitors_impl
typedef GLFWmonitor* (*glfwGetPrimaryMonitor_func)(void);
glfwGetPrimaryMonitor_func glfwGetPrimaryMonitor_impl;
GFW_EXTERN glfwGetPrimaryMonitor_func glfwGetPrimaryMonitor_impl;
#define glfwGetPrimaryMonitor glfwGetPrimaryMonitor_impl
typedef void (*glfwGetMonitorPos_func)(GLFWmonitor*, int*, int*);
glfwGetMonitorPos_func glfwGetMonitorPos_impl;
GFW_EXTERN glfwGetMonitorPos_func glfwGetMonitorPos_impl;
#define glfwGetMonitorPos glfwGetMonitorPos_impl
typedef void (*glfwGetMonitorWorkarea_func)(GLFWmonitor*, int*, int*, int*, int*);
glfwGetMonitorWorkarea_func glfwGetMonitorWorkarea_impl;
GFW_EXTERN glfwGetMonitorWorkarea_func glfwGetMonitorWorkarea_impl;
#define glfwGetMonitorWorkarea glfwGetMonitorWorkarea_impl
typedef void (*glfwGetMonitorPhysicalSize_func)(GLFWmonitor*, int*, int*);
glfwGetMonitorPhysicalSize_func glfwGetMonitorPhysicalSize_impl;
GFW_EXTERN glfwGetMonitorPhysicalSize_func glfwGetMonitorPhysicalSize_impl;
#define glfwGetMonitorPhysicalSize glfwGetMonitorPhysicalSize_impl
typedef void (*glfwGetMonitorContentScale_func)(GLFWmonitor*, float*, float*);
glfwGetMonitorContentScale_func glfwGetMonitorContentScale_impl;
GFW_EXTERN glfwGetMonitorContentScale_func glfwGetMonitorContentScale_impl;
#define glfwGetMonitorContentScale glfwGetMonitorContentScale_impl
typedef const char* (*glfwGetMonitorName_func)(GLFWmonitor*);
glfwGetMonitorName_func glfwGetMonitorName_impl;
GFW_EXTERN glfwGetMonitorName_func glfwGetMonitorName_impl;
#define glfwGetMonitorName glfwGetMonitorName_impl
typedef void (*glfwSetMonitorUserPointer_func)(GLFWmonitor*, void*);
glfwSetMonitorUserPointer_func glfwSetMonitorUserPointer_impl;
GFW_EXTERN glfwSetMonitorUserPointer_func glfwSetMonitorUserPointer_impl;
#define glfwSetMonitorUserPointer glfwSetMonitorUserPointer_impl
typedef void* (*glfwGetMonitorUserPointer_func)(GLFWmonitor*);
glfwGetMonitorUserPointer_func glfwGetMonitorUserPointer_impl;
GFW_EXTERN glfwGetMonitorUserPointer_func glfwGetMonitorUserPointer_impl;
#define glfwGetMonitorUserPointer glfwGetMonitorUserPointer_impl
typedef GLFWmonitorfun (*glfwSetMonitorCallback_func)(GLFWmonitorfun);
glfwSetMonitorCallback_func glfwSetMonitorCallback_impl;
GFW_EXTERN glfwSetMonitorCallback_func glfwSetMonitorCallback_impl;
#define glfwSetMonitorCallback glfwSetMonitorCallback_impl
typedef const GLFWvidmode* (*glfwGetVideoModes_func)(GLFWmonitor*, int*);
glfwGetVideoModes_func glfwGetVideoModes_impl;
GFW_EXTERN glfwGetVideoModes_func glfwGetVideoModes_impl;
#define glfwGetVideoModes glfwGetVideoModes_impl
typedef const GLFWvidmode* (*glfwGetVideoMode_func)(GLFWmonitor*);
glfwGetVideoMode_func glfwGetVideoMode_impl;
GFW_EXTERN glfwGetVideoMode_func glfwGetVideoMode_impl;
#define glfwGetVideoMode glfwGetVideoMode_impl
typedef void (*glfwSetGamma_func)(GLFWmonitor*, float);
glfwSetGamma_func glfwSetGamma_impl;
GFW_EXTERN glfwSetGamma_func glfwSetGamma_impl;
#define glfwSetGamma glfwSetGamma_impl
typedef const GLFWgammaramp* (*glfwGetGammaRamp_func)(GLFWmonitor*);
glfwGetGammaRamp_func glfwGetGammaRamp_impl;
GFW_EXTERN glfwGetGammaRamp_func glfwGetGammaRamp_impl;
#define glfwGetGammaRamp glfwGetGammaRamp_impl
typedef void (*glfwSetGammaRamp_func)(GLFWmonitor*, const GLFWgammaramp*);
glfwSetGammaRamp_func glfwSetGammaRamp_impl;
GFW_EXTERN glfwSetGammaRamp_func glfwSetGammaRamp_impl;
#define glfwSetGammaRamp glfwSetGammaRamp_impl
typedef void (*glfwDefaultWindowHints_func)(void);
glfwDefaultWindowHints_func glfwDefaultWindowHints_impl;
GFW_EXTERN glfwDefaultWindowHints_func glfwDefaultWindowHints_impl;
#define glfwDefaultWindowHints glfwDefaultWindowHints_impl
typedef void (*glfwWindowHint_func)(int, int);
glfwWindowHint_func glfwWindowHint_impl;
GFW_EXTERN glfwWindowHint_func glfwWindowHint_impl;
#define glfwWindowHint glfwWindowHint_impl
typedef void (*glfwWindowHintString_func)(int, const char*);
glfwWindowHintString_func glfwWindowHintString_impl;
GFW_EXTERN glfwWindowHintString_func glfwWindowHintString_impl;
#define glfwWindowHintString glfwWindowHintString_impl
typedef GLFWwindow* (*glfwCreateWindow_func)(int, int, const char*, GLFWmonitor*, GLFWwindow*);
glfwCreateWindow_func glfwCreateWindow_impl;
GFW_EXTERN glfwCreateWindow_func glfwCreateWindow_impl;
#define glfwCreateWindow glfwCreateWindow_impl
typedef bool (*glfwToggleFullscreen_func)(GLFWwindow*, unsigned int);
glfwToggleFullscreen_func glfwToggleFullscreen_impl;
GFW_EXTERN glfwToggleFullscreen_func glfwToggleFullscreen_impl;
#define glfwToggleFullscreen glfwToggleFullscreen_impl
typedef void (*glfwDestroyWindow_func)(GLFWwindow*);
glfwDestroyWindow_func glfwDestroyWindow_impl;
GFW_EXTERN glfwDestroyWindow_func glfwDestroyWindow_impl;
#define glfwDestroyWindow glfwDestroyWindow_impl
typedef int (*glfwWindowShouldClose_func)(GLFWwindow*);
glfwWindowShouldClose_func glfwWindowShouldClose_impl;
GFW_EXTERN glfwWindowShouldClose_func glfwWindowShouldClose_impl;
#define glfwWindowShouldClose glfwWindowShouldClose_impl
typedef void (*glfwSetWindowShouldClose_func)(GLFWwindow*, int);
glfwSetWindowShouldClose_func glfwSetWindowShouldClose_impl;
GFW_EXTERN glfwSetWindowShouldClose_func glfwSetWindowShouldClose_impl;
#define glfwSetWindowShouldClose glfwSetWindowShouldClose_impl
typedef void (*glfwSetWindowTitle_func)(GLFWwindow*, const char*);
glfwSetWindowTitle_func glfwSetWindowTitle_impl;
GFW_EXTERN glfwSetWindowTitle_func glfwSetWindowTitle_impl;
#define glfwSetWindowTitle glfwSetWindowTitle_impl
typedef void (*glfwSetWindowIcon_func)(GLFWwindow*, int, const GLFWimage*);
glfwSetWindowIcon_func glfwSetWindowIcon_impl;
GFW_EXTERN glfwSetWindowIcon_func glfwSetWindowIcon_impl;
#define glfwSetWindowIcon glfwSetWindowIcon_impl
typedef void (*glfwGetWindowPos_func)(GLFWwindow*, int*, int*);
glfwGetWindowPos_func glfwGetWindowPos_impl;
GFW_EXTERN glfwGetWindowPos_func glfwGetWindowPos_impl;
#define glfwGetWindowPos glfwGetWindowPos_impl
typedef void (*glfwSetWindowPos_func)(GLFWwindow*, int, int);
glfwSetWindowPos_func glfwSetWindowPos_impl;
GFW_EXTERN glfwSetWindowPos_func glfwSetWindowPos_impl;
#define glfwSetWindowPos glfwSetWindowPos_impl
typedef void (*glfwGetWindowSize_func)(GLFWwindow*, int*, int*);
glfwGetWindowSize_func glfwGetWindowSize_impl;
GFW_EXTERN glfwGetWindowSize_func glfwGetWindowSize_impl;
#define glfwGetWindowSize glfwGetWindowSize_impl
typedef void (*glfwSetWindowSizeLimits_func)(GLFWwindow*, int, int, int, int);
glfwSetWindowSizeLimits_func glfwSetWindowSizeLimits_impl;
GFW_EXTERN glfwSetWindowSizeLimits_func glfwSetWindowSizeLimits_impl;
#define glfwSetWindowSizeLimits glfwSetWindowSizeLimits_impl
typedef void (*glfwSetWindowSizeIncrements_func)(GLFWwindow*, int, int);
glfwSetWindowSizeIncrements_func glfwSetWindowSizeIncrements_impl;
GFW_EXTERN glfwSetWindowSizeIncrements_func glfwSetWindowSizeIncrements_impl;
#define glfwSetWindowSizeIncrements glfwSetWindowSizeIncrements_impl
typedef void (*glfwSetWindowAspectRatio_func)(GLFWwindow*, int, int);
glfwSetWindowAspectRatio_func glfwSetWindowAspectRatio_impl;
GFW_EXTERN glfwSetWindowAspectRatio_func glfwSetWindowAspectRatio_impl;
#define glfwSetWindowAspectRatio glfwSetWindowAspectRatio_impl
typedef void (*glfwSetWindowSize_func)(GLFWwindow*, int, int);
glfwSetWindowSize_func glfwSetWindowSize_impl;
GFW_EXTERN glfwSetWindowSize_func glfwSetWindowSize_impl;
#define glfwSetWindowSize glfwSetWindowSize_impl
typedef void (*glfwGetFramebufferSize_func)(GLFWwindow*, int*, int*);
glfwGetFramebufferSize_func glfwGetFramebufferSize_impl;
GFW_EXTERN glfwGetFramebufferSize_func glfwGetFramebufferSize_impl;
#define glfwGetFramebufferSize glfwGetFramebufferSize_impl
typedef void (*glfwGetWindowFrameSize_func)(GLFWwindow*, int*, int*, int*, int*);
glfwGetWindowFrameSize_func glfwGetWindowFrameSize_impl;
GFW_EXTERN glfwGetWindowFrameSize_func glfwGetWindowFrameSize_impl;
#define glfwGetWindowFrameSize glfwGetWindowFrameSize_impl
typedef void (*glfwGetWindowContentScale_func)(GLFWwindow*, float*, float*);
glfwGetWindowContentScale_func glfwGetWindowContentScale_impl;
GFW_EXTERN glfwGetWindowContentScale_func glfwGetWindowContentScale_impl;
#define glfwGetWindowContentScale glfwGetWindowContentScale_impl
typedef monotonic_t (*glfwGetDoubleClickInterval_func)(GLFWwindow*);
glfwGetDoubleClickInterval_func glfwGetDoubleClickInterval_impl;
GFW_EXTERN glfwGetDoubleClickInterval_func glfwGetDoubleClickInterval_impl;
#define glfwGetDoubleClickInterval glfwGetDoubleClickInterval_impl
typedef float (*glfwGetWindowOpacity_func)(GLFWwindow*);
glfwGetWindowOpacity_func glfwGetWindowOpacity_impl;
GFW_EXTERN glfwGetWindowOpacity_func glfwGetWindowOpacity_impl;
#define glfwGetWindowOpacity glfwGetWindowOpacity_impl
typedef void (*glfwSetWindowOpacity_func)(GLFWwindow*, float);
glfwSetWindowOpacity_func glfwSetWindowOpacity_impl;
GFW_EXTERN glfwSetWindowOpacity_func glfwSetWindowOpacity_impl;
#define glfwSetWindowOpacity glfwSetWindowOpacity_impl
typedef void (*glfwIconifyWindow_func)(GLFWwindow*);
glfwIconifyWindow_func glfwIconifyWindow_impl;
GFW_EXTERN glfwIconifyWindow_func glfwIconifyWindow_impl;
#define glfwIconifyWindow glfwIconifyWindow_impl
typedef void (*glfwRestoreWindow_func)(GLFWwindow*);
glfwRestoreWindow_func glfwRestoreWindow_impl;
GFW_EXTERN glfwRestoreWindow_func glfwRestoreWindow_impl;
#define glfwRestoreWindow glfwRestoreWindow_impl
typedef void (*glfwMaximizeWindow_func)(GLFWwindow*);
glfwMaximizeWindow_func glfwMaximizeWindow_impl;
GFW_EXTERN glfwMaximizeWindow_func glfwMaximizeWindow_impl;
#define glfwMaximizeWindow glfwMaximizeWindow_impl
typedef void (*glfwShowWindow_func)(GLFWwindow*);
glfwShowWindow_func glfwShowWindow_impl;
GFW_EXTERN glfwShowWindow_func glfwShowWindow_impl;
#define glfwShowWindow glfwShowWindow_impl
typedef void (*glfwHideWindow_func)(GLFWwindow*);
glfwHideWindow_func glfwHideWindow_impl;
GFW_EXTERN glfwHideWindow_func glfwHideWindow_impl;
#define glfwHideWindow glfwHideWindow_impl
typedef void (*glfwFocusWindow_func)(GLFWwindow*);
glfwFocusWindow_func glfwFocusWindow_impl;
GFW_EXTERN glfwFocusWindow_func glfwFocusWindow_impl;
#define glfwFocusWindow glfwFocusWindow_impl
typedef void (*glfwRequestWindowAttention_func)(GLFWwindow*);
glfwRequestWindowAttention_func glfwRequestWindowAttention_impl;
GFW_EXTERN glfwRequestWindowAttention_func glfwRequestWindowAttention_impl;
#define glfwRequestWindowAttention glfwRequestWindowAttention_impl
typedef int (*glfwWindowBell_func)(GLFWwindow*);
glfwWindowBell_func glfwWindowBell_impl;
GFW_EXTERN glfwWindowBell_func glfwWindowBell_impl;
#define glfwWindowBell glfwWindowBell_impl
typedef GLFWmonitor* (*glfwGetWindowMonitor_func)(GLFWwindow*);
glfwGetWindowMonitor_func glfwGetWindowMonitor_impl;
GFW_EXTERN glfwGetWindowMonitor_func glfwGetWindowMonitor_impl;
#define glfwGetWindowMonitor glfwGetWindowMonitor_impl
typedef void (*glfwSetWindowMonitor_func)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int);
glfwSetWindowMonitor_func glfwSetWindowMonitor_impl;
GFW_EXTERN glfwSetWindowMonitor_func glfwSetWindowMonitor_impl;
#define glfwSetWindowMonitor glfwSetWindowMonitor_impl
typedef int (*glfwGetWindowAttrib_func)(GLFWwindow*, int);
glfwGetWindowAttrib_func glfwGetWindowAttrib_impl;
GFW_EXTERN glfwGetWindowAttrib_func glfwGetWindowAttrib_impl;
#define glfwGetWindowAttrib glfwGetWindowAttrib_impl
typedef void (*glfwSetWindowAttrib_func)(GLFWwindow*, int, int);
glfwSetWindowAttrib_func glfwSetWindowAttrib_impl;
GFW_EXTERN glfwSetWindowAttrib_func glfwSetWindowAttrib_impl;
#define glfwSetWindowAttrib glfwSetWindowAttrib_impl
typedef void (*glfwSetWindowUserPointer_func)(GLFWwindow*, void*);
glfwSetWindowUserPointer_func glfwSetWindowUserPointer_impl;
GFW_EXTERN glfwSetWindowUserPointer_func glfwSetWindowUserPointer_impl;
#define glfwSetWindowUserPointer glfwSetWindowUserPointer_impl
typedef void* (*glfwGetWindowUserPointer_func)(GLFWwindow*);
glfwGetWindowUserPointer_func glfwGetWindowUserPointer_impl;
GFW_EXTERN glfwGetWindowUserPointer_func glfwGetWindowUserPointer_impl;
#define glfwGetWindowUserPointer glfwGetWindowUserPointer_impl
typedef GLFWwindowposfun (*glfwSetWindowPosCallback_func)(GLFWwindow*, GLFWwindowposfun);
glfwSetWindowPosCallback_func glfwSetWindowPosCallback_impl;
GFW_EXTERN glfwSetWindowPosCallback_func glfwSetWindowPosCallback_impl;
#define glfwSetWindowPosCallback glfwSetWindowPosCallback_impl
typedef GLFWwindowsizefun (*glfwSetWindowSizeCallback_func)(GLFWwindow*, GLFWwindowsizefun);
glfwSetWindowSizeCallback_func glfwSetWindowSizeCallback_impl;
GFW_EXTERN glfwSetWindowSizeCallback_func glfwSetWindowSizeCallback_impl;
#define glfwSetWindowSizeCallback glfwSetWindowSizeCallback_impl
typedef GLFWwindowclosefun (*glfwSetWindowCloseCallback_func)(GLFWwindow*, GLFWwindowclosefun);
glfwSetWindowCloseCallback_func glfwSetWindowCloseCallback_impl;
GFW_EXTERN glfwSetWindowCloseCallback_func glfwSetWindowCloseCallback_impl;
#define glfwSetWindowCloseCallback glfwSetWindowCloseCallback_impl
typedef GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback_func)(GLFWwindow*, GLFWwindowrefreshfun);
glfwSetWindowRefreshCallback_func glfwSetWindowRefreshCallback_impl;
GFW_EXTERN glfwSetWindowRefreshCallback_func glfwSetWindowRefreshCallback_impl;
#define glfwSetWindowRefreshCallback glfwSetWindowRefreshCallback_impl
typedef GLFWwindowfocusfun (*glfwSetWindowFocusCallback_func)(GLFWwindow*, GLFWwindowfocusfun);
glfwSetWindowFocusCallback_func glfwSetWindowFocusCallback_impl;
GFW_EXTERN glfwSetWindowFocusCallback_func glfwSetWindowFocusCallback_impl;
#define glfwSetWindowFocusCallback glfwSetWindowFocusCallback_impl
typedef GLFWwindowocclusionfun (*glfwSetWindowOcclusionCallback_func)(GLFWwindow*, GLFWwindowocclusionfun);
glfwSetWindowOcclusionCallback_func glfwSetWindowOcclusionCallback_impl;
GFW_EXTERN glfwSetWindowOcclusionCallback_func glfwSetWindowOcclusionCallback_impl;
#define glfwSetWindowOcclusionCallback glfwSetWindowOcclusionCallback_impl
typedef GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback_func)(GLFWwindow*, GLFWwindowiconifyfun);
glfwSetWindowIconifyCallback_func glfwSetWindowIconifyCallback_impl;
GFW_EXTERN glfwSetWindowIconifyCallback_func glfwSetWindowIconifyCallback_impl;
#define glfwSetWindowIconifyCallback glfwSetWindowIconifyCallback_impl
typedef GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback_func)(GLFWwindow*, GLFWwindowmaximizefun);
glfwSetWindowMaximizeCallback_func glfwSetWindowMaximizeCallback_impl;
GFW_EXTERN glfwSetWindowMaximizeCallback_func glfwSetWindowMaximizeCallback_impl;
#define glfwSetWindowMaximizeCallback glfwSetWindowMaximizeCallback_impl
typedef GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback_func)(GLFWwindow*, GLFWframebuffersizefun);
glfwSetFramebufferSizeCallback_func glfwSetFramebufferSizeCallback_impl;
GFW_EXTERN glfwSetFramebufferSizeCallback_func glfwSetFramebufferSizeCallback_impl;
#define glfwSetFramebufferSizeCallback glfwSetFramebufferSizeCallback_impl
typedef GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback_func)(GLFWwindow*, GLFWwindowcontentscalefun);
glfwSetWindowContentScaleCallback_func glfwSetWindowContentScaleCallback_impl;
GFW_EXTERN glfwSetWindowContentScaleCallback_func glfwSetWindowContentScaleCallback_impl;
#define glfwSetWindowContentScaleCallback glfwSetWindowContentScaleCallback_impl
typedef void (*glfwPostEmptyEvent_func)(void);
glfwPostEmptyEvent_func glfwPostEmptyEvent_impl;
GFW_EXTERN glfwPostEmptyEvent_func glfwPostEmptyEvent_impl;
#define glfwPostEmptyEvent glfwPostEmptyEvent_impl
typedef int (*glfwGetInputMode_func)(GLFWwindow*, int);
glfwGetInputMode_func glfwGetInputMode_impl;
GFW_EXTERN glfwGetInputMode_func glfwGetInputMode_impl;
#define glfwGetInputMode glfwGetInputMode_impl
typedef void (*glfwSetInputMode_func)(GLFWwindow*, int, int);
glfwSetInputMode_func glfwSetInputMode_impl;
GFW_EXTERN glfwSetInputMode_func glfwSetInputMode_impl;
#define glfwSetInputMode glfwSetInputMode_impl
typedef const char* (*glfwGetKeyName_func)(int, int);
glfwGetKeyName_func glfwGetKeyName_impl;
GFW_EXTERN glfwGetKeyName_func glfwGetKeyName_impl;
#define glfwGetKeyName glfwGetKeyName_impl
typedef int (*glfwGetNativeKeyForKey_func)(int);
glfwGetNativeKeyForKey_func glfwGetNativeKeyForKey_impl;
GFW_EXTERN glfwGetNativeKeyForKey_func glfwGetNativeKeyForKey_impl;
#define glfwGetNativeKeyForKey glfwGetNativeKeyForKey_impl
typedef int (*glfwGetKey_func)(GLFWwindow*, int);
glfwGetKey_func glfwGetKey_impl;
GFW_EXTERN glfwGetKey_func glfwGetKey_impl;
#define glfwGetKey glfwGetKey_impl
typedef int (*glfwGetMouseButton_func)(GLFWwindow*, int);
glfwGetMouseButton_func glfwGetMouseButton_impl;
GFW_EXTERN glfwGetMouseButton_func glfwGetMouseButton_impl;
#define glfwGetMouseButton glfwGetMouseButton_impl
typedef void (*glfwGetCursorPos_func)(GLFWwindow*, double*, double*);
glfwGetCursorPos_func glfwGetCursorPos_impl;
GFW_EXTERN glfwGetCursorPos_func glfwGetCursorPos_impl;
#define glfwGetCursorPos glfwGetCursorPos_impl
typedef void (*glfwSetCursorPos_func)(GLFWwindow*, double, double);
glfwSetCursorPos_func glfwSetCursorPos_impl;
GFW_EXTERN glfwSetCursorPos_func glfwSetCursorPos_impl;
#define glfwSetCursorPos glfwSetCursorPos_impl
typedef GLFWcursor* (*glfwCreateCursor_func)(const GLFWimage*, int, int, int);
glfwCreateCursor_func glfwCreateCursor_impl;
GFW_EXTERN glfwCreateCursor_func glfwCreateCursor_impl;
#define glfwCreateCursor glfwCreateCursor_impl
typedef GLFWcursor* (*glfwCreateStandardCursor_func)(GLFWCursorShape);
glfwCreateStandardCursor_func glfwCreateStandardCursor_impl;
GFW_EXTERN glfwCreateStandardCursor_func glfwCreateStandardCursor_impl;
#define glfwCreateStandardCursor glfwCreateStandardCursor_impl
typedef void (*glfwDestroyCursor_func)(GLFWcursor*);
glfwDestroyCursor_func glfwDestroyCursor_impl;
GFW_EXTERN glfwDestroyCursor_func glfwDestroyCursor_impl;
#define glfwDestroyCursor glfwDestroyCursor_impl
typedef void (*glfwSetCursor_func)(GLFWwindow*, GLFWcursor*);
glfwSetCursor_func glfwSetCursor_impl;
GFW_EXTERN glfwSetCursor_func glfwSetCursor_impl;
#define glfwSetCursor glfwSetCursor_impl
typedef GLFWkeyboardfun (*glfwSetKeyboardCallback_func)(GLFWwindow*, GLFWkeyboardfun);
glfwSetKeyboardCallback_func glfwSetKeyboardCallback_impl;
GFW_EXTERN glfwSetKeyboardCallback_func glfwSetKeyboardCallback_impl;
#define glfwSetKeyboardCallback glfwSetKeyboardCallback_impl
typedef void (*glfwUpdateIMEState_func)(GLFWwindow*, int, int, int, int, int);
glfwUpdateIMEState_func glfwUpdateIMEState_impl;
GFW_EXTERN glfwUpdateIMEState_func glfwUpdateIMEState_impl;
#define glfwUpdateIMEState glfwUpdateIMEState_impl
typedef GLFWmousebuttonfun (*glfwSetMouseButtonCallback_func)(GLFWwindow*, GLFWmousebuttonfun);
glfwSetMouseButtonCallback_func glfwSetMouseButtonCallback_impl;
GFW_EXTERN glfwSetMouseButtonCallback_func glfwSetMouseButtonCallback_impl;
#define glfwSetMouseButtonCallback glfwSetMouseButtonCallback_impl
typedef GLFWcursorposfun (*glfwSetCursorPosCallback_func)(GLFWwindow*, GLFWcursorposfun);
glfwSetCursorPosCallback_func glfwSetCursorPosCallback_impl;
GFW_EXTERN glfwSetCursorPosCallback_func glfwSetCursorPosCallback_impl;
#define glfwSetCursorPosCallback glfwSetCursorPosCallback_impl
typedef GLFWcursorenterfun (*glfwSetCursorEnterCallback_func)(GLFWwindow*, GLFWcursorenterfun);
glfwSetCursorEnterCallback_func glfwSetCursorEnterCallback_impl;
GFW_EXTERN glfwSetCursorEnterCallback_func glfwSetCursorEnterCallback_impl;
#define glfwSetCursorEnterCallback glfwSetCursorEnterCallback_impl
typedef GLFWscrollfun (*glfwSetScrollCallback_func)(GLFWwindow*, GLFWscrollfun);
glfwSetScrollCallback_func glfwSetScrollCallback_impl;
GFW_EXTERN glfwSetScrollCallback_func glfwSetScrollCallback_impl;
#define glfwSetScrollCallback glfwSetScrollCallback_impl
typedef GLFWdropfun (*glfwSetDropCallback_func)(GLFWwindow*, GLFWdropfun);
glfwSetDropCallback_func glfwSetDropCallback_impl;
GFW_EXTERN glfwSetDropCallback_func glfwSetDropCallback_impl;
#define glfwSetDropCallback glfwSetDropCallback_impl
typedef GLFWliveresizefun (*glfwSetLiveResizeCallback_func)(GLFWwindow*, GLFWliveresizefun);
glfwSetLiveResizeCallback_func glfwSetLiveResizeCallback_impl;
GFW_EXTERN glfwSetLiveResizeCallback_func glfwSetLiveResizeCallback_impl;
#define glfwSetLiveResizeCallback glfwSetLiveResizeCallback_impl
typedef int (*glfwJoystickPresent_func)(int);
glfwJoystickPresent_func glfwJoystickPresent_impl;
GFW_EXTERN glfwJoystickPresent_func glfwJoystickPresent_impl;
#define glfwJoystickPresent glfwJoystickPresent_impl
typedef const float* (*glfwGetJoystickAxes_func)(int, int*);
glfwGetJoystickAxes_func glfwGetJoystickAxes_impl;
GFW_EXTERN glfwGetJoystickAxes_func glfwGetJoystickAxes_impl;
#define glfwGetJoystickAxes glfwGetJoystickAxes_impl
typedef const unsigned char* (*glfwGetJoystickButtons_func)(int, int*);
glfwGetJoystickButtons_func glfwGetJoystickButtons_impl;
GFW_EXTERN glfwGetJoystickButtons_func glfwGetJoystickButtons_impl;
#define glfwGetJoystickButtons glfwGetJoystickButtons_impl
typedef const unsigned char* (*glfwGetJoystickHats_func)(int, int*);
glfwGetJoystickHats_func glfwGetJoystickHats_impl;
GFW_EXTERN glfwGetJoystickHats_func glfwGetJoystickHats_impl;
#define glfwGetJoystickHats glfwGetJoystickHats_impl
typedef const char* (*glfwGetJoystickName_func)(int);
glfwGetJoystickName_func glfwGetJoystickName_impl;
GFW_EXTERN glfwGetJoystickName_func glfwGetJoystickName_impl;
#define glfwGetJoystickName glfwGetJoystickName_impl
typedef const char* (*glfwGetJoystickGUID_func)(int);
glfwGetJoystickGUID_func glfwGetJoystickGUID_impl;
GFW_EXTERN glfwGetJoystickGUID_func glfwGetJoystickGUID_impl;
#define glfwGetJoystickGUID glfwGetJoystickGUID_impl
typedef void (*glfwSetJoystickUserPointer_func)(int, void*);
glfwSetJoystickUserPointer_func glfwSetJoystickUserPointer_impl;
GFW_EXTERN glfwSetJoystickUserPointer_func glfwSetJoystickUserPointer_impl;
#define glfwSetJoystickUserPointer glfwSetJoystickUserPointer_impl
typedef void* (*glfwGetJoystickUserPointer_func)(int);
glfwGetJoystickUserPointer_func glfwGetJoystickUserPointer_impl;
GFW_EXTERN glfwGetJoystickUserPointer_func glfwGetJoystickUserPointer_impl;
#define glfwGetJoystickUserPointer glfwGetJoystickUserPointer_impl
typedef int (*glfwJoystickIsGamepad_func)(int);
glfwJoystickIsGamepad_func glfwJoystickIsGamepad_impl;
GFW_EXTERN glfwJoystickIsGamepad_func glfwJoystickIsGamepad_impl;
#define glfwJoystickIsGamepad glfwJoystickIsGamepad_impl
typedef GLFWjoystickfun (*glfwSetJoystickCallback_func)(GLFWjoystickfun);
glfwSetJoystickCallback_func glfwSetJoystickCallback_impl;
GFW_EXTERN glfwSetJoystickCallback_func glfwSetJoystickCallback_impl;
#define glfwSetJoystickCallback glfwSetJoystickCallback_impl
typedef int (*glfwUpdateGamepadMappings_func)(const char*);
glfwUpdateGamepadMappings_func glfwUpdateGamepadMappings_impl;
GFW_EXTERN glfwUpdateGamepadMappings_func glfwUpdateGamepadMappings_impl;
#define glfwUpdateGamepadMappings glfwUpdateGamepadMappings_impl
typedef const char* (*glfwGetGamepadName_func)(int);
glfwGetGamepadName_func glfwGetGamepadName_impl;
GFW_EXTERN glfwGetGamepadName_func glfwGetGamepadName_impl;
#define glfwGetGamepadName glfwGetGamepadName_impl
typedef int (*glfwGetGamepadState_func)(int, GLFWgamepadstate*);
glfwGetGamepadState_func glfwGetGamepadState_impl;
GFW_EXTERN glfwGetGamepadState_func glfwGetGamepadState_impl;
#define glfwGetGamepadState glfwGetGamepadState_impl
typedef void (*glfwSetClipboardString_func)(GLFWwindow*, const char*);
glfwSetClipboardString_func glfwSetClipboardString_impl;
GFW_EXTERN glfwSetClipboardString_func glfwSetClipboardString_impl;
#define glfwSetClipboardString glfwSetClipboardString_impl
typedef const char* (*glfwGetClipboardString_func)(GLFWwindow*);
glfwGetClipboardString_func glfwGetClipboardString_impl;
GFW_EXTERN glfwGetClipboardString_func glfwGetClipboardString_impl;
#define glfwGetClipboardString glfwGetClipboardString_impl
typedef monotonic_t (*glfwGetTime_func)(void);
glfwGetTime_func glfwGetTime_impl;
GFW_EXTERN glfwGetTime_func glfwGetTime_impl;
#define glfwGetTime glfwGetTime_impl
typedef void (*glfwMakeContextCurrent_func)(GLFWwindow*);
glfwMakeContextCurrent_func glfwMakeContextCurrent_impl;
GFW_EXTERN glfwMakeContextCurrent_func glfwMakeContextCurrent_impl;
#define glfwMakeContextCurrent glfwMakeContextCurrent_impl
typedef GLFWwindow* (*glfwGetCurrentContext_func)(void);
glfwGetCurrentContext_func glfwGetCurrentContext_impl;
GFW_EXTERN glfwGetCurrentContext_func glfwGetCurrentContext_impl;
#define glfwGetCurrentContext glfwGetCurrentContext_impl
typedef void (*glfwSwapBuffers_func)(GLFWwindow*);
glfwSwapBuffers_func glfwSwapBuffers_impl;
GFW_EXTERN glfwSwapBuffers_func glfwSwapBuffers_impl;
#define glfwSwapBuffers glfwSwapBuffers_impl
typedef void (*glfwSwapInterval_func)(int);
glfwSwapInterval_func glfwSwapInterval_impl;
GFW_EXTERN glfwSwapInterval_func glfwSwapInterval_impl;
#define glfwSwapInterval glfwSwapInterval_impl
typedef int (*glfwExtensionSupported_func)(const char*);
glfwExtensionSupported_func glfwExtensionSupported_impl;
GFW_EXTERN glfwExtensionSupported_func glfwExtensionSupported_impl;
#define glfwExtensionSupported glfwExtensionSupported_impl
typedef GLFWglproc (*glfwGetProcAddress_func)(const char*);
glfwGetProcAddress_func glfwGetProcAddress_impl;
GFW_EXTERN glfwGetProcAddress_func glfwGetProcAddress_impl;
#define glfwGetProcAddress glfwGetProcAddress_impl
typedef int (*glfwVulkanSupported_func)(void);
glfwVulkanSupported_func glfwVulkanSupported_impl;
GFW_EXTERN glfwVulkanSupported_func glfwVulkanSupported_impl;
#define glfwVulkanSupported glfwVulkanSupported_impl
typedef const char** (*glfwGetRequiredInstanceExtensions_func)(uint32_t*);
glfwGetRequiredInstanceExtensions_func glfwGetRequiredInstanceExtensions_impl;
GFW_EXTERN glfwGetRequiredInstanceExtensions_func glfwGetRequiredInstanceExtensions_impl;
#define glfwGetRequiredInstanceExtensions glfwGetRequiredInstanceExtensions_impl
typedef void* (*glfwGetCocoaWindow_func)(GLFWwindow*);
glfwGetCocoaWindow_func glfwGetCocoaWindow_impl;
GFW_EXTERN glfwGetCocoaWindow_func glfwGetCocoaWindow_impl;
#define glfwGetCocoaWindow glfwGetCocoaWindow_impl
typedef void* (*glfwGetNSGLContext_func)(GLFWwindow*);
glfwGetNSGLContext_func glfwGetNSGLContext_impl;
GFW_EXTERN glfwGetNSGLContext_func glfwGetNSGLContext_impl;
#define glfwGetNSGLContext glfwGetNSGLContext_impl
typedef uint32_t (*glfwGetCocoaMonitor_func)(GLFWmonitor*);
glfwGetCocoaMonitor_func glfwGetCocoaMonitor_impl;
GFW_EXTERN glfwGetCocoaMonitor_func glfwGetCocoaMonitor_impl;
#define glfwGetCocoaMonitor glfwGetCocoaMonitor_impl
typedef GLFWcocoatextinputfilterfun (*glfwSetCocoaTextInputFilter_func)(GLFWwindow*, GLFWcocoatextinputfilterfun);
glfwSetCocoaTextInputFilter_func glfwSetCocoaTextInputFilter_impl;
GFW_EXTERN glfwSetCocoaTextInputFilter_func glfwSetCocoaTextInputFilter_impl;
#define glfwSetCocoaTextInputFilter glfwSetCocoaTextInputFilter_impl
typedef GLFWcocoatogglefullscreenfun (*glfwSetCocoaToggleFullscreenIntercept_func)(GLFWwindow*, GLFWcocoatogglefullscreenfun);
glfwSetCocoaToggleFullscreenIntercept_func glfwSetCocoaToggleFullscreenIntercept_impl;
GFW_EXTERN glfwSetCocoaToggleFullscreenIntercept_func glfwSetCocoaToggleFullscreenIntercept_impl;
#define glfwSetCocoaToggleFullscreenIntercept glfwSetCocoaToggleFullscreenIntercept_impl
typedef GLFWapplicationshouldhandlereopenfun (*glfwSetApplicationShouldHandleReopen_func)(GLFWapplicationshouldhandlereopenfun);
glfwSetApplicationShouldHandleReopen_func glfwSetApplicationShouldHandleReopen_impl;
GFW_EXTERN glfwSetApplicationShouldHandleReopen_func glfwSetApplicationShouldHandleReopen_impl;
#define glfwSetApplicationShouldHandleReopen glfwSetApplicationShouldHandleReopen_impl
typedef GLFWapplicationwillfinishlaunchingfun (*glfwSetApplicationWillFinishLaunching_func)(GLFWapplicationwillfinishlaunchingfun);
glfwSetApplicationWillFinishLaunching_func glfwSetApplicationWillFinishLaunching_impl;
GFW_EXTERN glfwSetApplicationWillFinishLaunching_func glfwSetApplicationWillFinishLaunching_impl;
#define glfwSetApplicationWillFinishLaunching glfwSetApplicationWillFinishLaunching_impl
typedef void (*glfwGetCocoaKeyEquivalent_func)(int, int, char*, size_t, int*);
glfwGetCocoaKeyEquivalent_func glfwGetCocoaKeyEquivalent_impl;
GFW_EXTERN glfwGetCocoaKeyEquivalent_func glfwGetCocoaKeyEquivalent_impl;
#define glfwGetCocoaKeyEquivalent glfwGetCocoaKeyEquivalent_impl
typedef void (*glfwCocoaRequestRenderFrame_func)(GLFWwindow*, GLFWcocoarenderframefun);
glfwCocoaRequestRenderFrame_func glfwCocoaRequestRenderFrame_impl;
GFW_EXTERN glfwCocoaRequestRenderFrame_func glfwCocoaRequestRenderFrame_impl;
#define glfwCocoaRequestRenderFrame glfwCocoaRequestRenderFrame_impl
typedef void* (*glfwGetX11Display_func)(void);
glfwGetX11Display_func glfwGetX11Display_impl;
GFW_EXTERN glfwGetX11Display_func glfwGetX11Display_impl;
#define glfwGetX11Display glfwGetX11Display_impl
typedef int32_t (*glfwGetX11Window_func)(GLFWwindow*);
glfwGetX11Window_func glfwGetX11Window_impl;
GFW_EXTERN glfwGetX11Window_func glfwGetX11Window_impl;
#define glfwGetX11Window glfwGetX11Window_impl
typedef void (*glfwSetPrimarySelectionString_func)(GLFWwindow*, const char*);
glfwSetPrimarySelectionString_func glfwSetPrimarySelectionString_impl;
GFW_EXTERN glfwSetPrimarySelectionString_func glfwSetPrimarySelectionString_impl;
#define glfwSetPrimarySelectionString glfwSetPrimarySelectionString_impl
typedef const char* (*glfwGetPrimarySelectionString_func)(GLFWwindow*);
glfwGetPrimarySelectionString_func glfwGetPrimarySelectionString_impl;
GFW_EXTERN glfwGetPrimarySelectionString_func glfwGetPrimarySelectionString_impl;
#define glfwGetPrimarySelectionString glfwGetPrimarySelectionString_impl
typedef int (*glfwGetNativeKeyForName_func)(const char*, int);
glfwGetNativeKeyForName_func glfwGetNativeKeyForName_impl;
GFW_EXTERN glfwGetNativeKeyForName_func glfwGetNativeKeyForName_impl;
#define glfwGetNativeKeyForName glfwGetNativeKeyForName_impl
typedef void (*glfwRequestWaylandFrameEvent_func)(GLFWwindow*, unsigned long long, GLFWwaylandframecallbackfunc);
glfwRequestWaylandFrameEvent_func glfwRequestWaylandFrameEvent_impl;
GFW_EXTERN glfwRequestWaylandFrameEvent_func glfwRequestWaylandFrameEvent_impl;
#define glfwRequestWaylandFrameEvent glfwRequestWaylandFrameEvent_impl
typedef unsigned long long (*glfwDBusUserNotify_func)(const char*, const char*, const char*, const char*, const char*, int32_t, GLFWDBusnotificationcreatedfun, void*);
glfwDBusUserNotify_func glfwDBusUserNotify_impl;
GFW_EXTERN glfwDBusUserNotify_func glfwDBusUserNotify_impl;
#define glfwDBusUserNotify glfwDBusUserNotify_impl
typedef void (*glfwDBusSetUserNotificationHandler_func)(GLFWDBusnotificationactivatedfun);
glfwDBusSetUserNotificationHandler_func glfwDBusSetUserNotificationHandler_impl;
GFW_EXTERN glfwDBusSetUserNotificationHandler_func glfwDBusSetUserNotificationHandler_impl;
#define glfwDBusSetUserNotificationHandler glfwDBusSetUserNotificationHandler_impl
const char* load_glfw(const char* path);

View File

@@ -6,14 +6,15 @@
from functools import lru_cache
from typing import Any, Dict, List, Optional, Sequence, Tuple
from .boss import Boss
from .child import Child
from .cli import parse_args
from .cli_stub import LaunchCLIOptions
from .constants import resolve_custom_file
from .fast_data_types import set_clipboard_string
from .utils import set_primary_selection
from .window import Window
from .boss import Boss
from .tabs import Tab
from .utils import set_primary_selection
from .window import Watchers, Window
try:
from typing import TypedDict
@@ -148,6 +149,14 @@ defaults to :code:`kitty`.
--os-window-name
Set the WM_NAME property on X11 for the newly created OS Window when using
:option:`launch --type`=os-window. Defaults to :option:`launch --os-window-class`.
--watcher -w
type=list
Path to a python file. Appropriately named functions in this file will be called
for various events, such as when the window is resized or closed. See the section
on watchers in the launch command documentation :doc:`launch`. Relative paths are
resolved relative to the kitty config directory.
'''
@@ -176,7 +185,7 @@ def tab_for_window(boss: Boss, opts: LaunchCLIOptions, target_tab: Optional[Tab]
tm = boss.active_tab_manager
if tm:
tab: Optional[Tab] = tm.new_tab(empty_tab=True, location=opts.location)
if opts.tab_title and tab:
if opts.tab_title and tab is not None:
tab.set_title(opts.tab_title)
else:
tab = None
@@ -184,7 +193,7 @@ def tab_for_window(boss: Boss, opts: LaunchCLIOptions, target_tab: Optional[Tab]
oswid = boss.add_os_window(wclass=opts.os_window_class, wname=opts.os_window_name)
tm = boss.os_window_map[oswid]
tab = tm.new_tab(empty_tab=True)
if opts.tab_title:
if opts.tab_title and tab is not None:
tab.set_title(opts.tab_title)
else:
tab = target_tab or boss.active_tab
@@ -192,6 +201,23 @@ def tab_for_window(boss: Boss, opts: LaunchCLIOptions, target_tab: Optional[Tab]
return tab
def load_watch_modules(opts: LaunchCLIOptions) -> Optional[Watchers]:
if not opts.watcher:
return None
import runpy
ans = Watchers()
for path in opts.watcher:
path = resolve_custom_file(path)
m = runpy.run_path(path, run_name='__kitty_watcher__')
w = m.get('on_close')
if callable(w):
ans.on_close.append(w)
w = m.get('on_resize')
if callable(w):
ans.on_resize.append(w)
return ans
class LaunchKwds(TypedDict):
allow_remote_control: bool
@@ -274,7 +300,8 @@ def launch(boss: Boss, opts: LaunchCLIOptions, args: List[str], target_tab: Opti
else:
tab = tab_for_window(boss, opts, target_tab)
if tab is not None:
new_window: Window = tab.new_window(env=env or None, **kw)
watchers = load_watch_modules(opts)
new_window: Window = tab.new_window(env=env or None, watchers=watchers or None, **kw)
if opts.keep_focus and active:
boss.set_active_window(active, switch_os_window_if_needed=True)
return new_window

View File

@@ -549,7 +549,7 @@ class Layout: # {{{
def minimal_borders(self, windows: WindowList, active_window: Optional[WindowType], needs_borders_map: Dict[int, bool]) -> Generator[Borders, None, None]:
for w in windows:
if (w is active_window and draw_active_borders) or w.needs_attention:
if w is not active_window or draw_active_borders or w.needs_attention:
yield all_borders
else:
yield no_borders
@@ -1512,6 +1512,13 @@ class Splits(Layout):
else:
p2.two = w1
def minimal_borders(self, windows: WindowList, active_window: Optional[WindowType], needs_borders_map: Dict[int, bool]) -> Generator[Borders, None, None]:
for w in windows:
if (w is active_window and draw_active_borders) or w.needs_attention:
yield all_borders
else:
yield no_borders
def layout_action(self, action_name: str, args: Sequence[str], all_windows: WindowList, active_window_idx: int) -> Optional[Union[bool, int]]:
if action_name == 'rotate':
args = args or ('90',)

View File

@@ -5,6 +5,7 @@
from typing import TYPE_CHECKING, Optional
from kitty.cli_stub import LaunchCLIOptions
from kitty.launch import (
launch as do_launch, options_spec as launch_options_spec,
parse_launch_args
@@ -16,7 +17,7 @@ from .base import (
)
if TYPE_CHECKING:
from kitty.cli_stub import LaunchRCOptions as CLIOptions, LaunchCLIOptions
from kitty.cli_stub import LaunchRCOptions as CLIOptions
class Launch(RemoteCommand):

View File

@@ -4,7 +4,7 @@
import os
from typing import TYPE_CHECKING, Dict, Optional
from typing import TYPE_CHECKING, Dict, Optional, Union
from kitty.config import parse_config
from kitty.fast_data_types import patch_color_profiles
@@ -23,7 +23,7 @@ class SetColors(RemoteCommand):
'''
colors+: An object mapping names to colors as 24-bit RGB integers
cursor_text_color: A 24-bit color for text under the cursor
cursor_text_color: A 24-bit color for text under the cursor, or null to use background.
match_window: Window to change colors in
match_tab: Tab to change colors in
all: Boolean indicating change colors everywhere or not
@@ -57,10 +57,11 @@ Restore all colors to the values they had at kitty startup. Note that if you spe
this option, any color arguments are ignored and --configured and --all are implied.
''' + '\n\n' + MATCH_WINDOW_OPTION + '\n\n' + MATCH_TAB_OPTION.replace('--match -m', '--match-tab -t')
argspec = 'COLOR_OR_FILE ...'
args_completion = {'files': ('CONF files', ('*.conf',))}
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
final_colors: Dict[str, int] = {}
cursor_text_color: Optional[int] = None
cursor_text_color: Optional[Union[int, bool]] = False
if not opts.reset:
colors: Dict[str, Optional[Color]] = {}
for spec in args:
@@ -69,16 +70,18 @@ this option, any color arguments are ignored and --configured and --all are impl
else:
with open(os.path.expanduser(spec), encoding='utf-8', errors='replace') as f:
colors.update(parse_config(f))
ctc = colors.pop('cursor_text_color')
ctc = colors.pop('cursor_text_color', False)
if isinstance(ctc, Color):
cursor_text_color = color_as_int(ctc)
elif ctc is None:
cursor_text_color = None
final_colors = {k: color_as_int(v) for k, v in colors.items() if isinstance(v, Color)}
ans = {
'match_window': opts.match, 'match_tab': opts.match_tab,
'all': opts.all or opts.reset, 'configured': opts.configured or opts.reset,
'colors': final_colors, 'reset': opts.reset, 'dummy': 0
}
if cursor_text_color is not None:
if cursor_text_color is not False:
ans['cursor_text_color'] = cursor_text_color
del ans['dummy']
return ans
@@ -86,7 +89,7 @@ this option, any color arguments are ignored and --configured and --all are impl
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
windows = self.windows_for_payload(boss, window, payload_get)
colors = payload_get('colors')
cursor_text_color = payload_get('cursor_text_color') or False
cursor_text_color = payload_get('cursor_text_color', missing=False)
if payload_get('reset'):
colors = {k: color_as_int(v) for k, v in boss.startup_colors.items()}
cursor_text_color = boss.startup_cursor_text_color

View File

@@ -66,6 +66,8 @@ def draw_title(draw_data: DrawData, screen: Screen, tab: TabBarData, index: int)
def draw_tab_with_separator(draw_data: DrawData, screen: Screen, tab: TabBarData, before: int, max_title_length: int, index: int, is_last: bool) -> int:
tab_bg = draw_data.active_bg if tab.is_active else draw_data.inactive_bg
screen.cursor.bg = as_rgb(color_as_int(tab_bg))
if draw_data.leading_spaces:
screen.draw(' ' * draw_data.leading_spaces)
draw_title(draw_data, screen, tab, index)
@@ -79,8 +81,11 @@ def draw_tab_with_separator(draw_data: DrawData, screen: Screen, tab: TabBarData
screen.draw(' ' * trailing_spaces)
end = screen.cursor.x
screen.cursor.bold = screen.cursor.italic = False
screen.cursor.fg = screen.cursor.bg = 0
screen.cursor.fg = 0
if not is_last:
screen.cursor.bg = as_rgb(color_as_int(draw_data.inactive_bg))
screen.draw(draw_data.sep)
screen.cursor.bg = 0
return end
@@ -135,9 +140,11 @@ def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData
screen.draw('')
screen.cursor.fg = tab_fg
elif screen.cursor.x == 0:
screen.cursor.bg = tab_bg
screen.draw(' ')
start_draw = 1
screen.cursor.bg = tab_bg
if min_title_length >= max_title_length:
screen.draw('')
else:
@@ -179,7 +186,7 @@ class TabBar:
s.color_profile.update_ansi_color_table(build_ansi_color_table(opts))
s.color_profile.set_configured_colors(
color_as_int(opts.inactive_tab_foreground),
color_as_int(opts.inactive_tab_background)
color_as_int(opts.tab_bar_background or opts.background)
)
self.blank_rects: Tuple[Rect, ...] = ()
sep = opts.tab_separator
@@ -223,10 +230,13 @@ class TabBar:
self.draw_data = self.draw_data._replace(default_bg=color_from_int(spec['tab_bar_background']))
elif 'background' in spec and not self.opts.tab_bar_background:
self.draw_data = self.draw_data._replace(default_bg=color_from_int(spec['background']))
self.screen.color_profile.set_configured_colors(
spec.get('inactive_tab_foreground', color_as_int(self.opts.inactive_tab_foreground)),
spec.get('inactive_tab_background', color_as_int(self.opts.inactive_tab_background))
)
fg = spec.get('inactive_tab_foreground', color_as_int(self.opts.inactive_tab_foreground))
bg = spec.get('tab_bar_background', False)
if bg is None:
bg = color_as_int(self.opts.background)
elif bg is False:
bg = color_as_int(self.opts.tab_bar_background or self.opts.background)
self.screen.color_profile.set_configured_colors(fg, bg)
def layout(self) -> None:
central, tab_bar, vw, vh, cell_width, cell_height = viewport_for_window(self.os_window_id)

View File

@@ -26,7 +26,7 @@ from .layout import (
from .options_stub import Options
from .tab_bar import TabBar, TabBarData
from .utils import log_error, resolved_shell
from .window import Window, WindowDict
from .window import Window, WindowDict, Watchers
from .typing import TypedDict, SessionTab, SessionType
@@ -345,11 +345,15 @@ class Tab: # {{{
location: Optional[str] = None,
copy_colors_from: Optional[Window] = None,
allow_remote_control: bool = False,
marker: Optional[str] = None
marker: Optional[str] = None,
watchers: Optional[Watchers] = None
) -> Window:
child = self.launch_child(
use_shell=use_shell, cmd=cmd, stdin=stdin, cwd_from=cwd_from, cwd=cwd, env=env, allow_remote_control=allow_remote_control)
window = Window(self, child, self.opts, self.args, override_title=override_title, copy_colors_from=copy_colors_from)
window = Window(
self, child, self.opts, self.args, override_title=override_title,
copy_colors_from=copy_colors_from, watchers=watchers
)
if overlay_for is not None:
overlaid = next(w for w in self.windows if w.id == overlay_for)
window.overlay_for = overlay_for
@@ -384,6 +388,13 @@ class Tab: # {{{
if self.windows:
self.remove_window(self.windows[self.active_window_idx])
def close_other_windows_in_tab(self) -> None:
if len(self.windows) > 1:
active_window = self.windows[self.active_window_idx]
for window in tuple(self.windows):
if window is not active_window:
self.remove_window(window)
def previous_active_window_idx(self, num: int) -> Optional[int]:
try:
old_window_id = self.active_window_history[-num]

View File

@@ -10,8 +10,8 @@ from collections import deque
from enum import IntEnum
from itertools import chain
from typing import (
Any, Callable, Deque, Dict, List, Optional, Pattern, Sequence, Tuple,
Union
Any, Callable, Deque, Dict, Iterable, List, Optional, Pattern, Sequence,
Tuple, Union
)
from .child import ProcessDesc
@@ -32,7 +32,7 @@ from .keys import defines, extended_key_event, keyboard_mode_name
from .options_stub import Options
from .rgb import to_color
from .terminfo import get_capabilities
from .typing import ChildType, TabType, TypedDict
from .typing import BossType, ChildType, TabType, TypedDict
from .utils import (
color_as_int, get_primary_selection, load_shaders, open_cmd, open_url,
parse_color_set, read_shell_environment, sanitize_title,
@@ -77,6 +77,19 @@ DYNAMIC_COLOR_CODES = {
DYNAMIC_COLOR_CODES.update({k+100: v for k, v in DYNAMIC_COLOR_CODES.items()})
class Watcher:
def __call__(self, boss: BossType, window: 'Window', data: Dict[str, Any]) -> None:
pass
class Watchers:
def __init__(self) -> None:
self.on_resize: List[Watcher] = []
self.on_close: List[Watcher] = []
def calculate_gl_geometry(window_geometry: WindowGeometry, viewport_width: int, viewport_height: int, cell_width: int, cell_height: int) -> ScreenGeometry:
dx, dy = 2 * cell_width / viewport_width, 2 * cell_height / viewport_height
xmargin = window_geometry.left / viewport_width
@@ -181,8 +194,10 @@ class Window:
opts: Options,
args: CLIOptions,
override_title: Optional[str] = None,
copy_colors_from: Optional['Window'] = None
copy_colors_from: Optional['Window'] = None,
watchers: Optional[Watchers] = None
):
self.watchers = watchers or Watchers()
self.action_on_close: Optional[Callable] = None
self.action_on_removal: Optional[Callable] = None
self.current_marker_spec: Optional[Tuple[str, Union[str, Tuple[Tuple[int, str], ...]]]] = None
@@ -303,6 +318,7 @@ class Window:
if not self.pty_resized_once:
self.pty_resized_once = True
self.child.mark_terminal_ready()
self.call_watchers(self.watchers.on_resize, {'old_geometry': self.geometry, 'new_geometry': new_geometry})
else:
sg = self.update_position(new_geometry)
self.geometry = g = new_geometry
@@ -536,7 +552,17 @@ class Window:
return ''.join((l.rstrip() or '\n') for l in lines)
return ''.join(lines)
def call_watchers(self, which: Iterable[Watcher], data: Dict[str, Any]) -> None:
boss = get_boss()
for w in which:
try:
w(boss, self, data)
except Exception:
import traceback
traceback.print_exc()
def destroy(self) -> None:
self.call_watchers(self.watchers.on_close, {})
self.destroyed = True
if hasattr(self, 'screen'):
# Remove cycles so that screen is de-allocated immediately

View File

@@ -141,9 +141,12 @@ def cc_version() -> Tuple[str, Tuple[int, int]]:
else:
cc = 'cc'
raw = subprocess.check_output([cc, '-dumpversion']).decode('utf-8')
ver_ = raw.split('.')[:2]
ver_ = raw.strip().split('.')[:2]
try:
ver = int(ver_[0]), int(ver_[1])
if len(ver_) == 1:
ver = int(ver_[0]), 0
else:
ver = int(ver_[0]), int(ver_[1])
except Exception:
ver = (0, 0)
return cc, ver