Add a new kitty --start-as command line flag to start kitty fullscreen/maximized/minimized.
This obsoletes the --start-in-fullscreen flag introduced in the previous release which has been removed since it has only existed for a few days. Fixes #935
This commit is contained in:
@@ -13,6 +13,10 @@ Changelog
|
|||||||
neighboring windows in the current layout, and move them around, similar to
|
neighboring windows in the current layout, and move them around, similar to
|
||||||
window movement in vim (:iss:`916`)
|
window movement in vim (:iss:`916`)
|
||||||
|
|
||||||
|
- Add a new :option:`kitty --start-as` command line flag to start kitty
|
||||||
|
fullscreen/maximized/minimized. This obsoletes the ``--start-in-fullscreen``
|
||||||
|
flag introduced in the previous release (:iss:`935`)
|
||||||
|
|
||||||
- Linux: Ensure that the python embedded in the kitty binary build uses
|
- Linux: Ensure that the python embedded in the kitty binary build uses
|
||||||
UTF-8 mode to process command-line arguments (:iss:`924`)
|
UTF-8 mode to process command-line arguments (:iss:`924`)
|
||||||
|
|
||||||
@@ -23,7 +27,7 @@ Changelog
|
|||||||
0.12.1 [2018-09-08]
|
0.12.1 [2018-09-08]
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
- Add a new :option:`kitty --start-in-fullscreen` command line flag to start
|
- Add a new ``--start-in-fullscreen`` command line flag to start
|
||||||
kitty in full screen mode (:iss:`856`)
|
kitty in full screen mode (:iss:`856`)
|
||||||
|
|
||||||
- macOS: Fix a character that cannot be rendered in any font causing
|
- macOS: Fix a character that cannot be rendered in any font causing
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ from .constants import (
|
|||||||
)
|
)
|
||||||
from .fast_data_types import (
|
from .fast_data_types import (
|
||||||
ChildMonitor, background_opacity_of, change_background_opacity,
|
ChildMonitor, background_opacity_of, change_background_opacity,
|
||||||
create_os_window, current_os_window, destroy_global_data,
|
change_os_window_state, create_os_window, current_os_window,
|
||||||
get_clipboard_string, glfw_post_empty_event, global_font_size,
|
destroy_global_data, get_clipboard_string, glfw_post_empty_event,
|
||||||
mark_os_window_for_close, os_window_font_size, patch_global_colors,
|
global_font_size, mark_os_window_for_close, os_window_font_size,
|
||||||
set_clipboard_string, set_in_sequence_mode, toggle_fullscreen
|
patch_global_colors, set_clipboard_string, set_in_sequence_mode,
|
||||||
|
toggle_fullscreen
|
||||||
)
|
)
|
||||||
from .keys import get_shortcut, shortcut_matches
|
from .keys import get_shortcut, shortcut_matches
|
||||||
from .layout import set_draw_minimal_borders
|
from .layout import set_draw_minimal_borders
|
||||||
@@ -103,8 +104,11 @@ class Boss:
|
|||||||
if new_os_window_trigger is not None:
|
if new_os_window_trigger is not None:
|
||||||
self.keymap.pop(new_os_window_trigger, None)
|
self.keymap.pop(new_os_window_trigger, None)
|
||||||
self.add_os_window(startup_session, os_window_id=os_window_id)
|
self.add_os_window(startup_session, os_window_id=os_window_id)
|
||||||
if args.start_in_fullscreen:
|
if args.start_as != 'normal':
|
||||||
self.toggle_fullscreen()
|
if args.start_as == 'fullscreen':
|
||||||
|
self.toggle_fullscreen()
|
||||||
|
else:
|
||||||
|
change_os_window_state(args.start_as)
|
||||||
|
|
||||||
def add_os_window(self, startup_session, os_window_id=None, wclass=None, wname=None, opts_for_size=None, startup_id=None):
|
def add_os_window(self, startup_session, os_window_id=None, wclass=None, wname=None, opts_for_size=None, startup_id=None):
|
||||||
if os_window_id is None:
|
if os_window_id is None:
|
||||||
|
|||||||
@@ -546,9 +546,11 @@ specify this address. This option will be ignored, unless you set
|
|||||||
option as it is read automatically from the environment.
|
option as it is read automatically from the environment.
|
||||||
|
|
||||||
|
|
||||||
--start-in-fullscreen
|
--start-as
|
||||||
type=bool-set
|
type=choices
|
||||||
Make the initial kitty window fullscreen on startup
|
default=normal
|
||||||
|
choices=normal,fullscreen,maximized,minimized
|
||||||
|
Control how the initial kitty window is created.
|
||||||
|
|
||||||
|
|
||||||
# Debugging options
|
# Debugging options
|
||||||
|
|||||||
15
kitty/glfw.c
15
kitty/glfw.c
@@ -693,7 +693,7 @@ static PyObject*
|
|||||||
toggle_fullscreen(PYNOARG) {
|
toggle_fullscreen(PYNOARG) {
|
||||||
GLFWmonitor *monitor;
|
GLFWmonitor *monitor;
|
||||||
OSWindow *w = current_os_window();
|
OSWindow *w = current_os_window();
|
||||||
if (!w) Py_RETURN_NONE;
|
if (!w || !w->handle) Py_RETURN_NONE;
|
||||||
if ((monitor = glfwGetWindowMonitor(w->handle)) == NULL) {
|
if ((monitor = glfwGetWindowMonitor(w->handle)) == NULL) {
|
||||||
// make fullscreen
|
// make fullscreen
|
||||||
monitor = current_monitor(w->handle);
|
monitor = current_monitor(w->handle);
|
||||||
@@ -716,6 +716,18 @@ toggle_fullscreen(PYNOARG) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
change_os_window_state(PyObject *self UNUSED, PyObject *args) {
|
||||||
|
char *state;
|
||||||
|
if (!PyArg_ParseTuple(args, "s", &state)) return NULL;
|
||||||
|
OSWindow *w = current_os_window();
|
||||||
|
if (!w || !w->handle) Py_RETURN_NONE;
|
||||||
|
if (strcmp(state, "maximized") == 0) glfwMaximizeWindow(w->handle);
|
||||||
|
else if (strcmp(state, "minimized") == 0) glfwIconifyWindow(w->handle);
|
||||||
|
else { PyErr_SetString(PyExc_ValueError, "Unknown window state"); return NULL; }
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ring_audio_bell(OSWindow *w) {
|
ring_audio_bell(OSWindow *w) {
|
||||||
static double last_bell_at = -1;
|
static double last_bell_at = -1;
|
||||||
@@ -924,6 +936,7 @@ static PyMethodDef module_methods[] = {
|
|||||||
METHODB(get_content_scale_for_window, METH_NOARGS),
|
METHODB(get_content_scale_for_window, METH_NOARGS),
|
||||||
METHODB(set_clipboard_string, METH_VARARGS),
|
METHODB(set_clipboard_string, METH_VARARGS),
|
||||||
METHODB(toggle_fullscreen, METH_NOARGS),
|
METHODB(toggle_fullscreen, METH_NOARGS),
|
||||||
|
METHODB(change_os_window_state, METH_VARARGS),
|
||||||
METHODB(glfw_window_hint, METH_VARARGS),
|
METHODB(glfw_window_hint, METH_VARARGS),
|
||||||
METHODB(os_window_should_close, METH_VARARGS),
|
METHODB(os_window_should_close, METH_VARARGS),
|
||||||
METHODB(os_window_swap_buffers, METH_VARARGS),
|
METHODB(os_window_swap_buffers, METH_VARARGS),
|
||||||
|
|||||||
Reference in New Issue
Block a user