mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Make the kitty man pages automatically available inside kitty when using a binary build
This commit is contained in:
@@ -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)
|
# 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|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
|
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::
|
.. note::
|
||||||
In :file:`kitty-open.desktop`, kitty is registered to handle some supported
|
In :file:`kitty-open.desktop`, kitty is registered to handle some supported
|
||||||
|
|||||||
@@ -318,6 +318,22 @@ 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 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:
|
def setup_environment(opts: Options, cli_opts: CLIOptions) -> None:
|
||||||
from_config_file = False
|
from_config_file = False
|
||||||
if not cli_opts.listen_on and opts.listen_on.startswith('unix:'):
|
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
|
# 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:
|
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'])
|
env['PATH'] = prepend_if_not_present(os.path.dirname(kitty_path), env['PATH'])
|
||||||
|
setup_manpath(env)
|
||||||
set_default_env(env)
|
set_default_env(env)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user