After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630428 - support for changing theme
support for changing theme
Status: RESOLVED WONTFIX
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Owen Taylor
gnome-shell-maint
: 640821 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-23 15:40 UTC by Maxim Ermilov
Modified: 2011-01-30 21:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add support for changing theme (2.31 KB, patch)
2010-09-23 15:40 UTC, Maxim Ermilov
none Details | Review
add support for changing theme (2.36 KB, patch)
2010-09-23 16:43 UTC, Maxim Ermilov
none Details | Review
gnome-shell-bgo630428-change-theme.diff (4.11 KB, patch)
2011-01-04 20:09 UTC, Federico Mena Quintero
none Details | Review
gnome-shell-bgo630428-reload-theme.diff (2.62 KB, patch)
2011-01-04 20:20 UTC, Federico Mena Quintero
none Details | Review
Factor out a function to load the default theme (1.53 KB, patch)
2011-01-05 00:02 UTC, Federico Mena Quintero
committed Details | Review
Add an 'rt' command to the Run dialog to reload the theme (1.18 KB, patch)
2011-01-05 00:02 UTC, Federico Mena Quintero
committed Details | Review
Add a global themes var to Main (1.50 KB, patch)
2011-01-28 23:54 UTC, Quentin "Sardem FF7" Glidic
none Details | Review
Add an API to set the theme (1.57 KB, patch)
2011-01-30 19:59 UTC, Quentin "Sardem FF7" Glidic
needs-work Details | Review
Add an API to set the theme (1.91 KB, patch)
2011-01-30 20:40 UTC, Quentin "Sardem FF7" Glidic
none Details | Review
Add an API to set the theme (1.92 KB, patch)
2011-01-30 20:54 UTC, Quentin "Sardem FF7" Glidic
committed Details | Review

Description Maxim Ermilov 2010-09-23 15:40:14 UTC
Created attachment 170928 [details] [review]
add support for changing theme

Add 'theme-path' option.
If it's value empty, default theme will be used.
Comment 1 Maxim Ermilov 2010-09-23 16:43:24 UTC
Created attachment 170932 [details] [review]
add support for changing theme
Comment 2 Federico Mena Quintero 2011-01-04 20:09:34 UTC
Created attachment 177513 [details] [review]
gnome-shell-bgo630428-change-theme.diff

I rebased Maxim's patch for the latest sources.

I also added an "rt" command for the Run dialog, short for "reload theme".  This makes it very quick to experiment with changes to the CSS file, for example.
Comment 3 Federico Mena Quintero 2011-01-04 20:20:50 UTC
Created attachment 177515 [details] [review]
gnome-shell-bgo630428-reload-theme.diff

Alternative version that doesn't add a "theme-path" settings key. This just adds a "rt" command in the Run dialog.
Comment 4 Federico Mena Quintero 2011-01-05 00:02:16 UTC
Created attachment 177530 [details] [review]
Factor out a function to load the default theme

We will use this function elsewhere when the theme needs to be reloaded.
Comment 5 Federico Mena Quintero 2011-01-05 00:02:33 UTC
Created attachment 177531 [details] [review]
Add an 'rt' command to the Run dialog to reload the theme

This should be useful for theme authors who want to quickly reload
the theme without restarting the whole shell.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Comment 6 Owen Taylor 2011-01-07 18:13:23 UTC
Review of attachment 177530 [details] [review]:

Looks good
Comment 7 Owen Taylor 2011-01-07 18:13:46 UTC
Review of attachment 177531 [details] [review]:

Sure!
Comment 8 Federico Mena Quintero 2011-01-07 20:25:38 UTC
Thanks! Both commits pushed to master.

Should I leave the bug open for the part about actually changing the current theme?
Comment 9 Owen Taylor 2011-01-07 20:58:11 UTC
(In reply to comment #8)
> Thanks! Both commits pushed to master.
> 
> Should I leave the bug open for the part about actually changing the current
> theme?

Hmm, no. Switching theme isn't currently something we are planning for and the CSS classnames and details of the actor hierarchy aren't something we want to expose as publicly supportable yet. Any initial support for theme switching will almost certainly be just for high-contrast and inverse accessibility themes so the approach of pointing to an absolute filename out of a config key isn't right.

I think it's probably easiest to just WONTFIX this - we might eventually want something but keeping this open doesn't seem worth while.
Comment 10 Owen Taylor 2011-01-12 20:25:37 UTC
Forgot to actually WONTFIX
Comment 11 Owen Taylor 2011-01-28 14:40:50 UTC
*** Bug 640821 has been marked as a duplicate of this bug. ***
Comment 12 Quentin "Sardem FF7" Glidic 2011-01-28 23:54:53 UTC
Created attachment 179561 [details] [review]
Add a global themes var to Main

A little change to the main.js which permits extensions to specify a hash that is passed to the StTheme constructor (then to libcroco one).

Maybe some checks could be useful but I can't exactly identify which ones.
Comment 13 Quentin "Sardem FF7" Glidic 2011-01-30 19:59:45 UTC
Created attachment 179649 [details] [review]
Add an API to set the theme

This adds a function to set a theme. Set it to null will reset to the default Gnome-Shell theme.
Comment 14 Owen Taylor 2011-01-30 20:14:43 UTC
[ Reopening bug since I said I'd take a simple patch to let an extension override the global stylesheet ]
Comment 15 Owen Taylor 2011-01-30 20:15:18 UTC
Review of attachment 179649 [details] [review]:

Your commit message needs a body - see the email about writing commit messages linked to in the first section of https://live.gnome.org/GnomeShell/Development/WorkingWithPatches

+let _default_theme = null;
+let _theme = null;

Note the contrast with the theme variable name used elsewhere and the "StTheme" object - these clearly aren't the theme and should be called something like "_default_css_stylesheet" "_css_stylesheet"

 /**
+ * setTheme
+ *
+ * Set the theme file that the shell will load
+ */
+function setTheme(theme)
+{
+	if ( theme )
+		_theme = theme;
+}

- Please indent with 4 spaces. No tabs in the JS files
- No spaces around (theme)
- This doesn't work as intended since this function does nothing if theme is null
- Document that setting to null restores to the default theme in the doc comment here

+    if (_theme == null)
+        _theme = _default_theme;

It's better to use a local variable than to modify the global variable.
Comment 16 Quentin "Sardem FF7" Glidic 2011-01-30 20:40:43 UTC
Created attachment 179650 [details] [review]
Add an API to set the theme

Fixed patch with full doc comment and a commit body.
Comment 17 Quentin "Sardem FF7" Glidic 2011-01-30 20:54:14 UTC
Created attachment 179651 [details] [review]
Add an API to set the theme

Fixed patch with full doc comment and a commit body. (Oops)
Comment 18 Owen Taylor 2011-01-30 21:02:05 UTC
Comment on attachment 179651 [details] [review]
Add an API to set the theme

Pushed as 5abf9a04255d1b6f2b7c004221ada7e01eb3ae39
Comment 19 Owen Taylor 2011-01-30 21:02:53 UTC
Closing as WONTFIX again since this still isn't a "standard" way to change the theme just a hook for extensions.