Merge branch 'macos_hide_titlebar' of https://github.com/Luflosi/kitty
This commit is contained in:
commit
6b4f8408de
@ -500,6 +500,30 @@ cocoa_hide_window_title(void *w)
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
void
|
||||
cocoa_hide_titlebar(void *w)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
cocoa_hide_window_title(w);
|
||||
|
||||
NSWindow *window = (NSWindow*)w;
|
||||
NSButton *button;
|
||||
|
||||
button = [window standardWindowButton: NSWindowCloseButton];
|
||||
if (button) button.hidden = true;
|
||||
button = [window standardWindowButton: NSWindowMiniaturizeButton];
|
||||
if (button).hidden = true;
|
||||
button = [window standardWindowButton: NSWindowZoomButton];
|
||||
if (button) button.hidden = true;
|
||||
|
||||
[window setTitlebarAppearsTransparent:YES];
|
||||
[window setStyleMask:
|
||||
[window styleMask] | NSWindowStyleMaskFullSizeContentView];
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"cocoa_get_lang", (PyCFunction)cocoa_get_lang, METH_NOARGS, ""},
|
||||
{"cocoa_set_new_window_trigger", (PyCFunction)cocoa_set_new_window_trigger, METH_VARARGS, ""},
|
||||
|
||||
@ -662,8 +662,18 @@ Fade the text in inactive windows by the specified amount (a number between
|
||||
zero and one, with zero being fully faded).
|
||||
'''))
|
||||
|
||||
o('hide_window_decorations', False, long_text=_('''
|
||||
Hide the window decorations (title-bar and window borders).
|
||||
|
||||
def hide_window_decorations(x):
|
||||
if x == 'titlebar-only':
|
||||
return 0b10
|
||||
if to_bool(x):
|
||||
return 0b01
|
||||
return 0b00
|
||||
|
||||
|
||||
o('hide_window_decorations', 'no', option_type=hide_window_decorations, long_text=_('''
|
||||
Hide the window decorations (title-bar and window borders) with :code:`yes`.
|
||||
On macOS, :code:`titlebar-only` can be used to only hide the titlebar.
|
||||
Whether this works and exactly what effect it has depends on the
|
||||
window manager/operating system.
|
||||
'''))
|
||||
|
||||
@ -14,6 +14,7 @@ extern bool cocoa_make_window_resizable(void *w, bool);
|
||||
extern void cocoa_focus_window(void *w);
|
||||
extern void cocoa_create_global_menu(void);
|
||||
extern void cocoa_hide_window_title(void *w);
|
||||
extern void cocoa_hide_titlebar(void *w);
|
||||
extern void cocoa_set_activation_policy(bool);
|
||||
extern void cocoa_set_titlebar_color(void *w, color_type color);
|
||||
extern bool cocoa_alt_option_key_pressed(unsigned long);
|
||||
@ -513,7 +514,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
||||
// We don't use depth and stencil buffers
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 0);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 0);
|
||||
if (OPT(hide_window_decorations)) glfwWindowHint(GLFW_DECORATED, false);
|
||||
if (OPT(hide_window_decorations) & 1) glfwWindowHint(GLFW_DECORATED, false);
|
||||
#ifdef __APPLE__
|
||||
cocoa_set_activation_policy(OPT(macos_hide_from_tasks));
|
||||
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, true);
|
||||
@ -652,7 +653,9 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
||||
glfwSetDropCallback(glfw_window, drop_callback);
|
||||
#ifdef __APPLE__
|
||||
if (glfwGetCocoaWindow) {
|
||||
if (!(OPT(macos_show_window_title_in) & WINDOW)) {
|
||||
if (OPT(hide_window_decorations) & 2) {
|
||||
cocoa_hide_titlebar(glfwGetCocoaWindow(glfw_window));
|
||||
} else if (!(OPT(macos_show_window_title_in) & WINDOW)) {
|
||||
cocoa_hide_window_title(glfwGetCocoaWindow(glfw_window));
|
||||
}
|
||||
cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window), OPT(macos_window_resizable));
|
||||
|
||||
@ -476,7 +476,7 @@ PYWRAP1(set_options) {
|
||||
#define SS(name, dest, convert) { GA(name); dest = convert(ret); Py_DECREF(ret); if (PyErr_Occurred()) return NULL; }
|
||||
#define S(name, convert) SS(name, OPT(name), convert)
|
||||
SS(kitty_mod, kitty_mod, PyLong_AsLong);
|
||||
S(hide_window_decorations, PyObject_IsTrue);
|
||||
S(hide_window_decorations, PyLong_AsUnsignedLong);
|
||||
S(visual_bell_duration, parse_s_double_to_monotonic_t);
|
||||
S(enable_audio_bell, PyObject_IsTrue);
|
||||
S(focus_follows_mouse, PyObject_IsTrue);
|
||||
|
||||
@ -28,7 +28,8 @@ typedef struct {
|
||||
color_type url_color, background, foreground, active_border_color, inactive_border_color, bell_border_color;
|
||||
color_type mark1_foreground, mark1_background, mark2_foreground, mark2_background, mark3_foreground, mark3_background;
|
||||
monotonic_t repaint_delay, input_delay;
|
||||
bool focus_follows_mouse, hide_window_decorations;
|
||||
bool focus_follows_mouse;
|
||||
unsigned int hide_window_decorations;
|
||||
bool macos_hide_from_tasks, macos_quit_when_last_window_closed, macos_window_resizable, macos_traditional_fullscreen;
|
||||
unsigned int macos_option_as_alt;
|
||||
float macos_thicken_font;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user