Better fix for kitten not being in PATH
Add it to PATH just as we add the kitty dir to PATH. Ensures the correct kitten is in PATH, corresponding to the correct kitty.
This commit is contained in:
parent
6ea812679f
commit
fbbfb25702
@ -40,6 +40,9 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Fix :opt:`modify_font` not working for strikethrough position (:iss:`5946`)
|
- Fix :opt:`modify_font` not working for strikethrough position (:iss:`5946`)
|
||||||
|
|
||||||
|
- Fix a regression causing the ``edit-in-kitty`` command not working if :file:`kitten` is not added
|
||||||
|
to PATH (:iss:`5956`)
|
||||||
|
|
||||||
0.27.0 [2023-01-31]
|
0.27.0 [2023-01-31]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ from .constants import (
|
|||||||
glfw_path,
|
glfw_path,
|
||||||
is_macos,
|
is_macos,
|
||||||
is_wayland,
|
is_wayland,
|
||||||
|
kitten_exe,
|
||||||
kitty_exe,
|
kitty_exe,
|
||||||
logo_png_file,
|
logo_png_file,
|
||||||
running_in_kitty,
|
running_in_kitty,
|
||||||
@ -382,6 +383,15 @@ def ensure_kitty_in_path() -> None:
|
|||||||
os.environ['PATH'] = prepend_if_not_present(rpath, env_path)
|
os.environ['PATH'] = prepend_if_not_present(rpath, env_path)
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_kitten_in_path() -> None:
|
||||||
|
correct_kitten = kitten_exe()
|
||||||
|
existing = shutil.which('kitten')
|
||||||
|
if existing and safe_samefile(existing, correct_kitten):
|
||||||
|
return
|
||||||
|
env_path = os.environ.get('PATH', '')
|
||||||
|
os.environ['PATH'] = prepend_if_not_present(os.path.dirname(correct_kitten), env_path)
|
||||||
|
|
||||||
|
|
||||||
def setup_manpath(env: Dict[str, str]) -> None:
|
def setup_manpath(env: Dict[str, str]) -> None:
|
||||||
# Ensure kitty manpages are available in frozen builds
|
# Ensure kitty manpages are available in frozen builds
|
||||||
if not getattr(sys, 'frozen', False):
|
if not getattr(sys, 'frozen', False):
|
||||||
@ -407,6 +417,7 @@ def setup_environment(opts: Options, cli_opts: CLIOptions) -> None:
|
|||||||
cli_opts.listen_on = expand_listen_on(cli_opts.listen_on, from_config_file)
|
cli_opts.listen_on = expand_listen_on(cli_opts.listen_on, from_config_file)
|
||||||
env = opts.env.copy()
|
env = opts.env.copy()
|
||||||
ensure_kitty_in_path()
|
ensure_kitty_in_path()
|
||||||
|
ensure_kitten_in_path()
|
||||||
kitty_path = shutil.which('kitty')
|
kitty_path = shutil.which('kitty')
|
||||||
if kitty_path:
|
if kitty_path:
|
||||||
child_path = env.get('PATH')
|
child_path = env.get('PATH')
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import subprocess
|
|||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from typing import Callable, Dict, List, Optional
|
from typing import Callable, Dict, List, Optional
|
||||||
|
|
||||||
from .constants import kitten_exe, shell_integration_dir
|
from .constants import shell_integration_dir
|
||||||
from .fast_data_types import get_options
|
from .fast_data_types import get_options
|
||||||
from .options.types import Options, defaults
|
from .options.types import Options, defaults
|
||||||
from .utils import log_error, which
|
from .utils import log_error, which
|
||||||
@ -221,7 +221,6 @@ def modify_shell_environ(opts: Options, env: Dict[str, str], argv: List[str]) ->
|
|||||||
if shell is None or not ksi:
|
if shell is None or not ksi:
|
||||||
return
|
return
|
||||||
env['KITTY_SHELL_INTEGRATION'] = ksi
|
env['KITTY_SHELL_INTEGRATION'] = ksi
|
||||||
env['KITTY_KITTEN_EXE'] = kitten_exe()
|
|
||||||
if not shell_integration_allows_rc_modification(opts):
|
if not shell_integration_allows_rc_modification(opts):
|
||||||
return
|
return
|
||||||
f = ENV_MODIFIERS.get(shell)
|
f = ENV_MODIFIERS.get(shell)
|
||||||
|
|||||||
@ -209,9 +209,7 @@ _ksi_main() {
|
|||||||
_ksi_prompt[ps0]+="\[\e]133;C\a\]"
|
_ksi_prompt[ps0]+="\[\e]133;C\a\]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z "${KITTY_KITTEN_EXE}" ]] && KITTY_KITTEN_EXE="kitten"
|
alias edit-in-kitty="kitten edit-in-kitty"
|
||||||
alias edit-in-kitty="${KITTY_KITTEN_EXE} edit-in-kitty"
|
|
||||||
builtin unset KITTY_KITTEN_EXE
|
|
||||||
|
|
||||||
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
|
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
|
||||||
_ksi_completions() {
|
_ksi_completions() {
|
||||||
|
|||||||
@ -386,9 +386,7 @@ _ksi_deferred_init() {
|
|||||||
fi
|
fi
|
||||||
builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES
|
builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES
|
||||||
|
|
||||||
[[ -z "${KITTY_KITTEN_EXE}" ]] && KITTY_KITTEN_EXE="kitten"
|
alias edit-in-kitty="kitten edit-in-kitty"
|
||||||
alias edit-in-kitty="${KITTY_KITTEN_EXE} edit-in-kitty"
|
|
||||||
builtin unset KITTY_KITTEN_EXE
|
|
||||||
|
|
||||||
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
|
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
|
||||||
# of answering questions about it.
|
# of answering questions about it.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user