Skip to content

Commit

Permalink
Fix for WSL/Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
chardskarth committed Aug 15, 2020
1 parent ed8f7f4 commit fecf9a9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pokemonterminal/terminal/adapters/windowsterminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, ...
Expand Down Expand Up @@ -57,4 +58,4 @@ def clear():
WindowsTerminalProvider.set_background_image(None)

def __str__():
return "Windows Terminal"
return "Windows Terminal"

0 comments on commit fecf9a9

Please sign in to comment.