Closed kyle-seongwoo-jun closed 4 years ago
Nice work!
I'm getting the following error when trying to use the adapter however.
PS C:\Users\Hyper-V> pokemon
Traceback (most recent call last):
File "C:\Users\Hyper-V\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\pokemon-script.py", line 11, in <module>
load_entry_point('pokemon-terminal==1.2.0', 'console_scripts', 'pokemon')()
File "C:\Users\Hyper-V\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pokemonterminal\main.py", line 113, in main
scripter.change_terminal(target.get_path())
File "C:\Users\Hyper-V\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pokemonterminal\scripter.py", line 81, in change_terminal
TERMINAL_PROVIDER.change_terminal(image_file_path)
File "C:\Users\Hyper-V\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pokemonterminal\terminal\adapters\windowsterminal.py", line 50, in change_terminal
WindowsTerminalProvider.set_background_image(path)
File "C:\Users\Hyper-V\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pokemonterminal\terminal\adapters\windowsterminal.py", line 20, in set_background_image
if (profile['guid'] == current_profile):
TypeError: string indices must be integers
Seems like it's forgetting that it should access data['profiles']['list']
. Wouldn't it make more sense for it to change the defaults profile however?
Like this
# update defaults profile
profile = data['profiles']['defaults']
if (path is None):
del profile['backgroundImage']
else:
profile['backgroundImage'] = path
@sylveon Thank you!
Seems like it's forgetting that it should access
data['profiles']['list']
.
Oh, I didn't know there's Default Profile Settings option.
I'll change to set profiles
to data['profiles']['list']
when data['profiles']
is dictionary type,
Wouldn't it make more sense for it to change the defaults profile however?
I'm not sure... but I think it seems to be better to change just the current profile only.
I think there are some users who doesn't want to change another profile.
Changing only the current profile conflicts with the existing behavior of the app when it comes to terminal apps which don't support per-console background customization, like Tilix.
Okay, I got it.
@sylveon I updated it. Please check it. Thank you 😄
Implemented to support Windows Terminal.
Set background image via settings.json https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md
Check is Windows Terminal via environment variable https://github.com/microsoft/terminal/blob/64489b1ec114aca1766a31dd99c6de26a54afbbb/doc/user-docs/index.md#tips-and-tricks