albertosottile / darkdetect

Detect OS Dark Mode from Python
Other
171 stars 18 forks source link

Previous code did some problems wih Ubuntu #9

Closed HetDaftary closed 3 years ago

HetDaftary commented 3 years ago

This one is a better way as it just picks up the current theme in use directly from the gnome gsettings

albertosottile commented 3 years ago

Thanks for preparing this.

Could you argument about how this method would be better than the currently implemented one? Did you experience issues with the existing code?

One could argue that depending on the output of a spawned, independent process could actually be less desirable than interrogating an external library from the main process via ctypes.

I am not a Linux expert but, at least on macOS there are scenarios in which using subprocess for this purpose can lead to misleading results when called from a frozen Python app (which is I would say a decent use case for this library).

/cc @larsoner @cbrnr

HetDaftary commented 3 years ago

I tried to use it with My PyQt5 application but it showed some problems. Maybe it can be a bug in my application but this one works better as it always works because gsettings is inbuilt in all the gnome machines. But after this code, it worked fine.

larsoner commented 3 years ago

I tried to use it with My PyQt5 application but it showed some problems. Maybe it can be a bug in my application but this one works better as it always works because gsettings is inbuilt in all the gnome machines.

Can you try to make a minimal example?

It is possible that multiple GUI toolkits being used at once by a given executable won't get along properly, so in the end the subprocess method might be safer.