How to get data from extension.js file to prefs.js

Hi Experts,

I have authored the “Replace Activities Text” gnome-shell extension. Replace Activities Text - GNOME Shell Extensions

while implementing a feature to choose the text colour, All is working fine except resetting the colour back to the previous state when the extension is enabled.

When I need to Reset the colour back to the default one which I have obtained from the extension.js file below

const COLOR = Main.panel.statusArea.activities.get_theme_node().get_foreground_color().to_string(); // "f2f2f2ff"

How can I use this value in the prefs.js file while resetting the colour value?


Maybe you can create some other keys in the settings schema for default-color and default-icon-color, then you can set them in your enable() function? And then prefs.js can read those values.

@jfrancis, thanks for your response. We do not know which colour is the default because it changes based on the OS and the custom theme used by the user. When this extension is enabled, it picks the colour as I mentioned. While resetting, I want this colour to be put back. So we can not send/set this data via the settings schema.

But I think your idea of settings schema is the only way to trigger something we can set in the extension.js file along with settings. I will try in this way and get back to you soon.

Thank You

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.