From fecf9a9c66152ea12f9cdd8b1846e19eaf87813e Mon Sep 17 00:00:00 2001 From: "rd.skarth" Date: Sun, 16 Aug 2020 06:36:31 +0800 Subject: [PATCH] Fix for WSL/Linux --- pokemonterminal/terminal/adapters/windowsterminal.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pokemonterminal/terminal/adapters/windowsterminal.py b/pokemonterminal/terminal/adapters/windowsterminal.py index 4784ff4..289de7a 100644 --- a/pokemonterminal/terminal/adapters/windowsterminal.py +++ b/pokemonterminal/terminal/adapters/windowsterminal.py @@ -7,7 +7,7 @@ class WindowsTerminalProvider(_TProv): def set_background_image(path: str): - profiles_path = os.environ['LOCALAPPDATA'] + '\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json' + profiles_path = os.environ['LOCALAPPDATA'] + '/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json' with open(profiles_path, 'r+', encoding='utf8') as json_file: # read profiles.json # remove comments from json to load @@ -18,15 +18,16 @@ def set_background_image(path: str): if (isinstance(profiles, list)): data['profiles'] = profiles = { 'defaults': {}, - 'list': profiles + 'list': profiles } - + # update defaults profile profile = profiles['defaults'] if (path is None): del profile['backgroundImage'] else: - profile['backgroundImage'] = path + wsl_path = os.environ['WSLPATH'] + profile['backgroundImage'] = wsl_path + path # write to file # it lost orignal indent, comment, ... @@ -57,4 +58,4 @@ def clear(): WindowsTerminalProvider.set_background_image(None) def __str__(): - return "Windows Terminal" \ No newline at end of file + return "Windows Terminal"