Made window size caching and initial dimensions configurable
This commit is contained in:
parent
217cc2f40e
commit
a215ecde66
@ -110,6 +110,9 @@ type_map = {
|
|||||||
'cursor_blink_interval': float,
|
'cursor_blink_interval': float,
|
||||||
'cursor_stop_blinking_after': float,
|
'cursor_stop_blinking_after': float,
|
||||||
'enabled_layouts': to_layout_names,
|
'enabled_layouts': to_layout_names,
|
||||||
|
'cache_window_size': to_bool,
|
||||||
|
'initial_window_width': int,
|
||||||
|
'initial_window_height': int,
|
||||||
'use_system_wcwidth': to_bool,
|
'use_system_wcwidth': to_bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,13 @@ mouse_hide_wait 3.0
|
|||||||
# For a list of available layouts, see the file layouts.py
|
# For a list of available layouts, see the file layouts.py
|
||||||
enabled_layouts *
|
enabled_layouts *
|
||||||
|
|
||||||
|
# If enabled, the window size will be cached so that new instances of kitty will have the same
|
||||||
|
# size as the previous instance. If disabled, the window will initially have size configured
|
||||||
|
# by initial_window_width/height, in pixels.
|
||||||
|
cache_window_size yes
|
||||||
|
initial_window_width 640
|
||||||
|
initial_window_height 400
|
||||||
|
|
||||||
# Delay (in milliseconds) between screen updates. Decreasing it, increases fps
|
# Delay (in milliseconds) between screen updates. Decreasing it, increases fps
|
||||||
# at the cost of more CPU usage. The default value yields ~100fps which is more
|
# at the cost of more CPU usage. The default value yields ~100fps which is more
|
||||||
# that sufficient for most uses.
|
# that sufficient for most uses.
|
||||||
|
|||||||
@ -89,7 +89,7 @@ def dispatch_pending_calls(boss):
|
|||||||
def run_app(opts, args):
|
def run_app(opts, args):
|
||||||
setup_opengl()
|
setup_opengl()
|
||||||
load_cached_values()
|
load_cached_values()
|
||||||
if 'window-size' in cached_values:
|
if 'window-size' in cached_values and opts.cache_window_size:
|
||||||
ws = cached_values['window-size']
|
ws = cached_values['window-size']
|
||||||
try:
|
try:
|
||||||
viewport_size.width, viewport_size.height = map(int, ws)
|
viewport_size.width, viewport_size.height = map(int, ws)
|
||||||
@ -97,6 +97,9 @@ def run_app(opts, args):
|
|||||||
safe_print('Invalid cached window size, ignoring', file=sys.stderr)
|
safe_print('Invalid cached window size, ignoring', file=sys.stderr)
|
||||||
viewport_size.width = max(100, viewport_size.width)
|
viewport_size.width = max(100, viewport_size.width)
|
||||||
viewport_size.height = max(80, viewport_size.height)
|
viewport_size.height = max(80, viewport_size.height)
|
||||||
|
else:
|
||||||
|
viewport_size.width = opts.initial_window_width
|
||||||
|
viewport_size.height = opts.initial_window_height
|
||||||
window = Window(
|
window = Window(
|
||||||
viewport_size.width, viewport_size.height, args.cls)
|
viewport_size.width, viewport_size.height, args.cls)
|
||||||
window.set_title(appname)
|
window.set_title(appname)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user