Skip to content

Commit

Permalink
fix: fallback to opts if no shell integration env
Browse files Browse the repository at this point in the history
kitty v0.30.1 is returning empty window envs so fallback on opts
see kovidgoyal/kitty#6749
  • Loading branch information
mikesmithgh committed Oct 24, 2023
1 parent 9e94ee9 commit da339d5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion python/kitty_scrollback_nvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ def main():
raise SystemExit('Must be run as kitten kitty_scrollback_nvim')


def get_kitty_shell_integration(kitty_opts, w):
# KITTY_SHELL_INTEGRATION env var takes precedence over opts
# kitty v0.30.1 is returning empty window envs so fallback on opts
# see https://github.com/kovidgoyal/kitty/issues/6749
shell_integration_opts = kitty_opts.shell_integration or frozenset(
{'enabled'})
shell_integration = w.child.environ.get(
'KITTY_SHELL_INTEGRATION',
' '.join(list(shell_integration_opts)))
return shell_integration.split()


# based on kitty source window.py
def pipe_data(w, target_window_id, ksb_dir, config_files):
kitty_opts = get_options()
kitty_shell_integration = get_kitty_shell_integration(kitty_opts, w)
data = {
'scrolled_by': w.screen.scrolled_by,
'cursor_x': w.screen.cursor.x + 1,
Expand All @@ -31,7 +44,7 @@ def pipe_data(w, target_window_id, ksb_dir, config_files):
'ksb_dir': ksb_dir,
'kitty_opts': {
"shell_integration":
w.child.environ.get('KITTY_SHELL_INTEGRATION', 'disabled').split(), # env takes precedence over config
kitty_shell_integration,
"scrollback_fill_enlarged_window":
kitty_opts.scrollback_fill_enlarged_window,
"scrollback_lines":
Expand Down

0 comments on commit da339d5

Please sign in to comment.