diff --git a/kitty/constants.py b/kitty/constants.py index b68c6e068..0e9783b02 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -141,10 +141,12 @@ def cache_dir() -> str: def runtime_dir() -> str: if 'KITTY_RUNTIME_DIRECTORY' in os.environ: candidate = os.path.abspath(os.environ['KITTY_RUNTIME_DIRECTORY']) + elif is_macos: + candidate = os.path.join(cache_dir(), 'run') elif 'XDG_RUNTIME_DIR' in os.environ: candidate = os.path.abspath(os.environ['XDG_RUNTIME_DIR']) else: - candidate = os.path.join(cache_dir(), 'run') + candidate = os.environ.get('XDG_RUNTIME_DIR', os.path.join(cache_dir(), 'run')) os.makedirs(candidate, exist_ok=True) os.chmod(candidate, 0o700) return candidate @@ -167,7 +169,9 @@ except KeyError: with suppress(Exception): print('Failed to read login shell via getpwuid() for current user, falling back to /bin/sh', file=sys.stderr) shell_path = '/bin/sh' -ssh_control_master_template = 'ssh-kitten-{kitty_pid}-master-{ssh_placeholder}' +# Keep this short as it is limited to 103 bytes on macOS +# https://github.com/ansible/ansible/issues/11536#issuecomment-153030743 +ssh_control_master_template = 'kssh-{kitty_pid}-{ssh_placeholder}' def glfw_path(module: str) -> str: