mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
@@ -15,9 +15,13 @@
|
|||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
cocoa_hide_titlebar(PyObject UNUSED *self, PyObject *window_id) {
|
cocoa_hide_titlebar(PyObject UNUSED *self, PyObject *window_id) {
|
||||||
NSView *native_view = (NSView*)PyLong_AsVoidPtr(window_id);
|
NSWindow *window = (NSWindow*)PyLong_AsVoidPtr(window_id);
|
||||||
NSWindow* window = [native_view window];
|
|
||||||
[window setStyleMask:
|
@try {
|
||||||
[window styleMask] & ~NSWindowStyleMaskTitled];
|
[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;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ type_map = {
|
|||||||
'initial_window_width': int,
|
'initial_window_width': int,
|
||||||
'initial_window_height': int,
|
'initial_window_height': int,
|
||||||
'use_system_wcwidth': to_bool,
|
'use_system_wcwidth': to_bool,
|
||||||
|
'macos_hide_titlebar': to_bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
for name in (
|
for name in (
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ request_window_attention(Window *self) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef glfwGetCocoaWindow
|
#ifdef __APPLE__
|
||||||
static PyObject*
|
static PyObject*
|
||||||
cocoa_window_id(Window *self) {
|
cocoa_window_id(Window *self) {
|
||||||
void *wid = glfwGetCocoaWindow(self->window);
|
void *wid = glfwGetCocoaWindow(self->window);
|
||||||
@@ -400,7 +400,7 @@ static PyMethodDef methods[] = {
|
|||||||
#ifdef glfwRequestWindowAttention
|
#ifdef glfwRequestWindowAttention
|
||||||
MND(request_window_attention, METH_NOARGS),
|
MND(request_window_attention, METH_NOARGS),
|
||||||
#endif
|
#endif
|
||||||
#ifdef cocoa_window_id
|
#ifdef __APPLE__
|
||||||
MND(cocoa_window_id, METH_NOARGS),
|
MND(cocoa_window_id, METH_NOARGS),
|
||||||
#endif
|
#endif
|
||||||
MND(set_should_close, METH_VARARGS),
|
MND(set_should_close, METH_VARARGS),
|
||||||
|
|||||||
@@ -237,3 +237,9 @@ map ctrl+shift+backspace restore_font_size
|
|||||||
# For example:
|
# For example:
|
||||||
#
|
#
|
||||||
# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols
|
# 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 = Window(viewport_size.width, viewport_size.height, args.cls)
|
||||||
window.set_title(appname)
|
window.set_title(appname)
|
||||||
window.make_context_current()
|
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:
|
with open(logo_data_file, 'rb') as f:
|
||||||
window.set_icon(f.read(), 256, 256)
|
window.set_icon(f.read(), 256, 256)
|
||||||
viewport_size.width, viewport_size.height = window.get_framebuffer_size()
|
viewport_size.width, viewport_size.height = window.get_framebuffer_size()
|
||||||
|
|||||||
Reference in New Issue
Block a user