C2N14 / AutomaThemely

Simple, set-and-forget python application for changing between desktop themes according to light and dark hours
GNU General Public License v3.0
205 stars 32 forks source link

Suggestion: Automatically switch theme of Mozilla Firefox #13

Open prajjwaldimri opened 5 years ago

prajjwaldimri commented 5 years ago

Firefox stores profile data in /home//.mozilla/firefox/profiles.ini Or Whatever directory is listed here: about:profiles

Data of profiles.ini looks like this

[General]
StartWithLastProfile=1

[Profile0]
Name=dev-edition-default
IsRelative=1
Path=0xo36fmu.dev-edition-default

[Profile1]
Name=default
IsRelative=1
Path=xngzkevy.default
Default=1

I don't yet know if this has anything to do with light and dark themes but I am looking into this.

Thanks.

prajjwaldimri commented 5 years ago

This is relevant: https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data

prajjwaldimri commented 5 years ago

Alright got it. Its the file prefs.js which is automatically generated by the firefox browser. There is a user pref stored there which is altered every time a user changes their theme.

For Light:

user_pref("lightweightThemes.selectedThemeID", "firefox-compact-light@mozilla.org");

For Dark:

user_pref("lightweightThemes.selectedThemeID", "firefox-compact-dark@mozilla.org");

Default Theme:

user_pref("lightweightThemes.selectedThemeID", "default-theme@mozilla.org");

However, it can be overridden by specifying the same key in a optional user.js file which can be created inside the same directory.

bipox commented 5 years ago

That would be great.

In case you didn't know: you can already do this in Firefox with the automaticdark addon. And if you use Darkreader there's an option for automatic theme change too.

C2N14 commented 5 years ago

It's been a while, but I'll look into it :)