Allow users to modify XDG_DATA_DIRS in the fish rc files

The only downside of this new technique is that it is no
longer possible to set XDG_DATA_DIRS to an empty var in kitty.conf
Since an empty XDG_DATA_DIRS breaks lots fo things, I dont think that
is a big concern.
This commit is contained in:
Kovid Goyal
2021-11-07 18:59:50 +05:30
parent 6fa0a21b3c
commit b5e8b5a124
2 changed files with 14 additions and 10 deletions

View File

@@ -65,15 +65,12 @@ def setup_fish_integration(env: Dict[str, str]) -> None:
def setup_fish_env(env: Dict[str, str]) -> None:
val = env.get('XDG_DATA_DIRS')
if val is None:
env['KITTY_FISH_XDG_DATA_DIR'] = shell_integration_dir
if not val:
env['XDG_DATA_DIRS'] = shell_integration_dir
elif not val:
env['XDG_DATA_DIRS'] = shell_integration_dir
env['KITTY_FISH_XDG_DATA_DIRS'] = ''
else:
dirs = list(filter(None, val.split(os.pathsep)))
dirs.insert(0, shell_integration_dir)
env['KITTY_FISH_XDG_DATA_DIRS'] = val
env['XDG_DATA_DIRS'] = os.pathsep.join(dirs)