diff --git a/docs/binary.rst b/docs/binary.rst index c7dc5221b..79ee0fd20 100644 --- a/docs/binary.rst +++ b/docs/binary.rst @@ -56,10 +56,6 @@ particular desktop, but it should work for most major desktop environments. # Update the paths to the kitty and its icon in the kitty.desktop file(s) sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop - # Install the man pages - mkdir -p ~/.local/share/man/man1 ~/.local/share/man/man5 - ln -s ~/.local/kitty.app/share/man/man1/kitty.1 ~/.local/share/man/man1 - ln -s ~/.local/kitty.app/share/man/man5/kitty.conf.5 ~/.local/share/man/man5 .. note:: In :file:`kitty-open.desktop`, kitty is registered to handle some supported diff --git a/kitty/main.py b/kitty/main.py index 0aed81c5d..069466400 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -318,6 +318,22 @@ def ensure_kitty_in_path() -> None: os.environ['PATH'] = prepend_if_not_present(rpath, env_path) +def setup_manpath(env: Dict[str, str]) -> None: + # Ensure kitty manpages are available in frozen builds + if not getattr(sys, 'frozen', False): + return + from .constants import local_docs + mp = os.environ.get('MANPATH', env.get('MANPATH', '')) + d = os.path.dirname + kitty_man = os.path.join(d(d(d(local_docs()))), 'man') + if not mp: + env['MANPATH'] = f'{kitty_man}:' + elif mp.startswith(':'): + env['MANPATH'] = f':{kitty_man}:{mp}' + else: + env['MANPATH'] = f'{kitty_man}:{mp}' + + def setup_environment(opts: Options, cli_opts: CLIOptions) -> None: from_config_file = False if not cli_opts.listen_on and opts.listen_on.startswith('unix:'): @@ -334,6 +350,7 @@ def setup_environment(opts: Options, cli_opts: CLIOptions) -> None: # the other values mean the user doesn't want a PATH if child_path not in ('', DELETE_ENV_VAR) and child_path is not None: env['PATH'] = prepend_if_not_present(os.path.dirname(kitty_path), env['PATH']) + setup_manpath(env) set_default_env(env)