trigg / Discover

Yet another discord overlay for linux
GNU General Public License v3.0
651 stars 28 forks source link

Unable to place window from fresh install (configparser.NoSectionError: No section: 'main') #293

Closed Hubro closed 1 year ago

Hubro commented 1 year ago

Steps to Reproduce Steps to reproduce the behavior:

  1. Fresh install of Discover, no config file
  2. Launch discover-overlay -c in terminal
  3. Try to set the window position, click the green box

Expected behavior Expected the box to close and the config to be saved.

Problematic behavior The box doesn't close, the following error is shown in the terminal:

➜ discover-overlay -c
INFO - discover_overlay.discover_overlay - Starting Discover Overlay: 0.6.3
INFO - discover_overlay.autostart - Autostart info : desktop /usr/share/applications/discover_overlay.desktop auto None
INFO - discover_overlay.autostart - Autostart info : desktop /usr/share/applications/discover_overlay_configure.desktop auto None
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/discover_overlay/draggable_window_wayland.py", line 112, in button_press
    self.settings.change_placement(self)
  File "/usr/lib/python3.10/site-packages/discover_overlay/settings_window.py", line 728, in change_placement
    self.voice_place_window(None)
  File "/usr/lib/python3.10/site-packages/discover_overlay/settings_window.py", line 644, in voice_place_window
    config.set("main", "floating_x", "%s" %
  File "/usr/lib/python3.10/configparser.py", line 1206, in set
    super().set(section, option, value)
  File "/usr/lib/python3.10/configparser.py", line 904, in set
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

I assume this is because the config file doesn't exist yet. If I modify any other setting first, that causes the config file to be created. After that, window placement works as it should.

Desktop (please complete the following information):

Installation Method

Additional context

trigg commented 1 year ago

Thanks for the report! I'm looking into this now

trigg commented 1 year ago

Note to self -> if you write helper functions to avoid bugs, use them.

Sections are created as necessary in most cases, but window placement was written without this step.

The fix is commited now, thanks again!