A new command to show the env vars of the kitty process

This commit is contained in:
Kovid Goyal 2021-03-03 16:04:08 +05:30
parent 90c6c2a366
commit 1ded78a98c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 18 additions and 5 deletions

View File

@ -270,10 +270,17 @@ and the shell's rc files will have setup a whole different set of environment
variables which kitty will now inherit. variables which kitty will now inherit.
You need to make sure that the environment variables you define in your shell's You need to make sure that the environment variables you define in your shell's
rc files are either also defined system wide or via the ``env`` directive in rc files are either also defined system wide or via the :opt:`env` directive in
kitty.conf. Common environment variables that cause issues are those related to :file:`kitty.conf`. Common environment variables that cause issues are those
localization, such as ``LANG, LC_*`` and loading of configuration files such as related to localization, such as ``LANG, LC_*`` and loading of configuration
``XDG_*, KITTY_CONFIG_DIRECTORY``. files such as ``XDG_*, KITTY_CONFIG_DIRECTORY``.
To see the environment variables that kitty sees, you can add the following
mapping to :file:`kitty.conf`::
map f1 show_kitty_env_vars
then pressing :kbd:`F1` will show you the environment variables kitty sees.
This problem is most common on macOS, as Apple makes it exceedingly difficult to This problem is most common on macOS, as Apple makes it exceedingly difficult to
setup environment variables system-wide, so people end up putting them in all setup environment variables system-wide, so people end up putting them in all

View File

@ -853,7 +853,7 @@ class Boss:
s.shutdown(socket.SHUT_RDWR) s.shutdown(socket.SHUT_RDWR)
s.close() s.close()
def display_scrollback(self, window: Window, data: Optional[bytes], cmd: Optional[List[str]]) -> None: def display_scrollback(self, window: Window, data: Optional[bytes], cmd: List[str]) -> None:
tab = self.active_tab tab = self.active_tab
if tab is not None: if tab is not None:
tab.new_special_window( tab.new_special_window(
@ -1635,3 +1635,9 @@ class Boss:
self.set_active_window(w, switch_os_window_if_needed=True) self.set_active_window(w, switch_os_window_if_needed=True)
if report: if report:
w.report_notification_activated(identifier) w.report_notification_activated(identifier)
def show_kitty_env_vars(self) -> None:
w = self.active_window
if w:
output = '\n'.join(f'{k}={v}' for k, v in os.environ.items()).encode('utf-8')
self.display_scrollback(w, output, ['less'])