Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fallback to opts if no shell integration env #37

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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