mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 11:09:16 +02:00
@@ -15,9 +15,13 @@
|
||||
|
||||
PyObject*
|
||||
cocoa_hide_titlebar(PyObject UNUSED *self, PyObject *window_id) {
|
||||
NSView *native_view = (NSView*)PyLong_AsVoidPtr(window_id);
|
||||
NSWindow* window = [native_view window];
|
||||
[window setStyleMask:
|
||||
[window styleMask] & ~NSWindowStyleMaskTitled];
|
||||
NSWindow *window = (NSWindow*)PyLong_AsVoidPtr(window_id);
|
||||
|
||||
@try {
|
||||
[window setStyleMask:
|
||||
[window styleMask] & ~NSWindowStyleMaskTitled];
|
||||
} @catch (NSException *e) {
|
||||
return PyErr_Format(PyExc_ValueError, "Failed to set style mask: %s: %s", [[e name] UTF8String], [[e reason] UTF8String]);
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ type_map = {
|
||||
'initial_window_width': int,
|
||||
'initial_window_height': int,
|
||||
'use_system_wcwidth': to_bool,
|
||||
'macos_hide_titlebar': to_bool,
|
||||
}
|
||||
|
||||
for name in (
|
||||
|
||||
@@ -377,7 +377,7 @@ request_window_attention(Window *self) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef glfwGetCocoaWindow
|
||||
#ifdef __APPLE__
|
||||
static PyObject*
|
||||
cocoa_window_id(Window *self) {
|
||||
void *wid = glfwGetCocoaWindow(self->window);
|
||||
@@ -400,7 +400,7 @@ static PyMethodDef methods[] = {
|
||||
#ifdef glfwRequestWindowAttention
|
||||
MND(request_window_attention, METH_NOARGS),
|
||||
#endif
|
||||
#ifdef cocoa_window_id
|
||||
#ifdef __APPLE__
|
||||
MND(cocoa_window_id, METH_NOARGS),
|
||||
#endif
|
||||
MND(set_should_close, METH_VARARGS),
|
||||
|
||||
@@ -237,3 +237,9 @@ map ctrl+shift+backspace restore_font_size
|
||||
# For example:
|
||||
#
|
||||
# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols
|
||||
|
||||
|
||||
# OS specific tweaks
|
||||
|
||||
# Hide the kitty window's title bar on macOS.
|
||||
macos_hide_titlebar no
|
||||
|
||||
@@ -191,7 +191,11 @@ def run_app(opts, args):
|
||||
window = Window(viewport_size.width, viewport_size.height, args.cls)
|
||||
window.set_title(appname)
|
||||
window.make_context_current()
|
||||
if not isosx:
|
||||
if isosx:
|
||||
if opts.macos_hide_titlebar:
|
||||
from .fast_data_types import cocoa_hide_titlebar
|
||||
cocoa_hide_titlebar(window.cocoa_window_id())
|
||||
else:
|
||||
with open(logo_data_file, 'rb') as f:
|
||||
window.set_icon(f.read(), 256, 256)
|
||||
viewport_size.width, viewport_size.height = window.get_framebuffer_size()
|
||||
|
||||
Reference in New Issue
Block a user