oskarsh / Yin-Yang

Auto Nightmode for KDE, Gnome, Budgie, VSCode, Atom and more
MIT License
638 stars 52 forks source link

fix: QT Positioning #285

Closed ItachiSan closed 5 months ago

ItachiSan commented 8 months ago

Rather than manually fetching the position, have our background object receive the various updates of the location and magically update the config.

This is because QT needs its loop running in order to have the location working.

Fixes #274

ItachiSan commented 8 months ago

TODO: Add the magic part for updating the config. From my debugging, the configuration reads the value but we cannot set it. Need input from @oskarsh on how he wants to approach this :smile:

oskarsh commented 8 months ago

I think updating the config automatically is the best approach here.

l0drex commented 8 months ago

If we update the config, then the user-defined values will be overwritten. If the position detection fails, the coordinates might be nonsense (f.e. 0, 0). As we don't know if the user is at 0, 0 or the detection failed, I would prefer if we don't update the config values. Especially since the config values act as a fallback. Also, the detected position might be inaccurate: If the device has no GPS, then the position is guessed via the IP-address, which in my case is a few hundreds kilometers away. When switching back to the manual position, I expect to see my previously-defined manual position in the UI.

We could add a detected-position entry to the file and use that as a cache, but I don't think that is particularly useful - the position is read two times per day automatically and every time the UI is opened, which shouldn't be that often.

ItachiSan commented 8 months ago

What should I do then? :smile:

oskarsh commented 7 months ago

Go with the recommendation of @l0drex then. He is more in the topic and it defintely makes sense.

ItachiSan commented 6 months ago

Hi everyone, sorry for the silence. Was busy with life and stuff :) It seems to me that no config update is the way, so that we can keep the user defined value safely. I will thus remove the comments, making the PR ready :wink:

ItachiSan commented 6 months ago

Well, life has been even busier! Will push the code in a few minutes. :wink: