LazoCoder / Pokemon-Terminal

Pokemon terminal themes.
GNU General Public License v3.0
4.19k stars 224 forks source link

Support Windows Terminal #183

Closed kyle-seongwoo-jun closed 4 years ago

kyle-seongwoo-jun commented 4 years ago

image

Implemented to support Windows Terminal.

sylveon commented 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
kyle-seongwoo-jun commented 4 years ago

@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.

sylveon commented 4 years ago

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.

kyle-seongwoo-jun commented 4 years ago

Okay, I got it.

kyle-seongwoo-jun commented 4 years ago

@sylveon I updated it. Please check it. Thank you 😄