Show a startup warning when the effective config can't be saved

This commit is contained in:
James Swartz 2026-09-18 14:17:41 -04:00
parent 70d8a536f1
commit 3a5c815720
2 changed files with 9 additions and 5 deletions

View file

@ -463,8 +463,11 @@ class Boss:
set_boss(self)
self.mappings: Mappings = Mappings(global_shortcuts, self.refresh_active_tab_bar)
self.notification_manager: NotificationManager = NotificationManager(debug=self.args.debug_keyboard or self.args.debug_rendering)
if effective_config_path := store_effective_config():
effective_config_path, effective_config_error = store_effective_config()
if effective_config_path:
self.atexit.unlink(effective_config_path)
if effective_config_error:
self.misc_config_errors.append(effective_config_error)
def startup_first_child(self, os_window_id: int | None, startup_sessions: Iterable[Session] = ()) -> None:
si = startup_sessions or create_sessions(get_options(), self.args, default_session=get_options().startup_session)

View file

@ -202,7 +202,7 @@ def load_config(*paths: str, overrides: Iterable[str] | None = None, accumulate_
return opts
def store_effective_config() -> str:
def store_effective_config() -> tuple[str, str]:
import os
import stat
import tempfile
@ -220,9 +220,10 @@ def store_effective_config() -> str:
except OSError as err:
# writing the effective config is a best effort debugging aid, do not
# let it prevent kitty from starting, for example, when the disk is full
log_error(f'Failed to store effective config with error: {err}')
path = ''
return path
msg = f'Failed to store effective config with error: {err}'
log_error(msg)
return '', msg
return path, ''
class KittyCommonOpts(TypedDict):