streamdeck-linux-gui: [BUG]: Stream Deck ceased to be recognized by streamdeck-linux-gui

In raising this issue I confirm that

Describe the bug

Hi! For the last 24 hours (with up to date system) my Stream Deck ceased to be recognized by streamdeck-linux-gui. I’ve tested it on other systems and it still works (was afraid it got damaged somehow). Please tell me if more info is required.

Steps to reproduce the behavior

running streamdeckc does not bring up the GUI

Traceback (most recent call last):
  File "/usr/bin/streamdeckc", line 8, in <module>
    sys.exit(execute())
             ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/cli/server.py", line 167, in execute
    sock.connect(path)
FileNotFoundError: [Errno 2] No such file or directory
****

running streamdeck brings up the GUI

Exception in thread Thread-1 (_run):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/stream_deck_monitor.py", line 117, in _run
    self.attached(streamdeck_id, streamdeck)
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/api.py", line 203, in _on_steam_deck_attached
    self._update_streamdeck_filters(serial_number)
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/api.py", line 658, in _update_streamdeck_filters
    self._update_button_filters(serial_number, page, button)
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/api.py", line 691, in _update_button_filters
    TextFilter(
  File "/usr/lib/python3.11/site-packages/streamdeck_ui/display/text_filter.py", line 25, in __init__
    self.true_font = ImageFont.truetype(font, font_size)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/PIL/ImageFont.py", line 819, in truetype
    return freetype(font)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/PIL/ImageFont.py", line 816, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/PIL/ImageFont.py", line 245, in __init__
    self.font = core.getfont(
                ^^^^^^^^^^^^^
OSError: cannot open resource

Expected behavior

In the first case I get nothing. In the second one I do get the UI but with no Streamdeck connected. I’ve tried the Streamdeck on other devices to check if it’s broken or something. It’s not.

Screenshots

image

System Information

OS: Arch Linux x86_64 Kernel: 6.7.3-arch1-1 Shell: bash 5.2.26 Display (PHL098C): 3440x1440 @ 120Hz DE: KDE Plasma 5.27.10 WM: KWin (X11) CPU: 13th Gen Intel® Core™ i5-13400 (16) @ 4.60 GHz GPU: NVIDIA GeForce RTX 3060 Memory: 3.41 GiB / 62.61 GiB (5%) Swap: 12.06 MiB / 4.00 GiB (0%)

Stream Deck Version

Stream Deck MK.2

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

The issue is that the config file is saved with the absolute path of the font. So when you moved Trenda it could no longer locate a font at the path specified in the config. It probably does know where Trenda is when it builds its font listing, since it uses the system utility fc-list to discover fonts.

The solution here is probably two parts:

  1. Check if the path to the font file specified in the config exists, if it doesn’t, search for the font file name in the font listing, if we find the font elsewhere on the system, then change the path in the config to the valid font file path
  2. If the app is unable to set a font, use the default font instead. I don’t think we ever want to crash the program entirely just because we were unable to apply a font

Thanks! It looks like you don’t have that font installed on that PC or if it is it’s installed in a different location. I didn’t think about the use case of sharing a config between different PCs. I will modify the code to fall back to the default font in this case.