Make the screen update delay configurable

Add some comments to the default config
This commit is contained in:
Kovid Goyal 2016-11-19 17:14:44 +05:30
parent df4c90d94b
commit 804c86ffc5
2 changed files with 33 additions and 7 deletions

View File

@ -40,10 +40,10 @@ class Boss(Thread):
shutting_down = False
pending_title_change = pending_icon_change = None
pending_color_changes = {}
SCREEN_UPDATE_DELAY = 2 / 100 # seconds
def __init__(self, window, window_width, window_height, opts, args):
Thread.__init__(self, name='ChildMonitor')
self.screen_update_delay = opts.repaint_delay / 1000.0
self.pending_update_screen = None
self.action_queue = Queue()
self.child_fd = create_pty()[0]
@ -137,6 +137,7 @@ class Boss(Thread):
def apply_opts(self, opts):
self.opts = opts
self.screen_update_delay = opts.repaint_delay / 1000.0
self.queue_action(self.apply_opts_to_screen)
def apply_opts_to_screen(self):
@ -181,7 +182,7 @@ class Boss(Thread):
if monotonic() > self.pending_update_screen:
self.apply_update_screen()
elif self.screen.is_dirty():
self.pending_update_screen = monotonic() + self.SCREEN_UPDATE_DELAY
self.pending_update_screen = monotonic() + self.screen_update_delay
def close(self):
if not self.shutting_down:

View File

@ -204,12 +204,14 @@ def to_bool(x):
def to_opacity(x):
return max(0.3, min(float(x), 1))
type_map = {
'scrollback_lines': int,
'font_size': to_font_size,
'cursor_shape': to_cursor_shape,
'cursor_blink': to_bool,
'cursor_opacity': to_opacity,
'repaint_delay': int,
}
for name in 'foreground foreground_bold background cursor'.split():
@ -220,17 +222,40 @@ for i in range(16):
for line in '''
term xterm-kitty
# The foreground color
foreground #dddddd
foreground_bold #ffffff
cursor #ffffff
cursor_opacity 0.7
cursor_shape block
cursor_blink no
# The background color
background #000000
# The high intensity foreground color
foreground_bold #ffffff
# The cursor color
cursor #ffffff
# The cursor opacity
cursor_opacity 0.7
# The cursor shape can be one of (block, beam, underline)
cursor_shape block
# Whether to blink the cursor or not
cursor_blink no
# Font family
font_family monospace
# Font size (in pts)
font_size 11.0
# Number of lines of history to keep in memory for scrolling back
scrollback_lines 2000
# Delay (in milliseconds) between screen updates. Decreasing it, increases fps
# at the cost of more CPU usage. The default value yields ~50fps which is more
# that sufficient for most uses.
repaint_delay 20
# black
color0 #000000
color8 #4d4d4d