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 693219 - sessionMode: Add support for mode-specific styling
sessionMode: Add support for mode-specific styling
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 693169
 
 
Reported: 2013-02-05 17:55 UTC by Florian Müllner
Modified: 2013-02-05 18:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sessionMode: Add stylesheetName property (1.95 KB, patch)
2013-02-05 17:55 UTC, Florian Müllner
reviewed Details | Review
extensionSystem: Allow extensions to provide mode-specific styling (1.57 KB, patch)
2013-02-05 17:55 UTC, Florian Müllner
committed Details | Review
sessionMode: Add stylesheetName property (2.11 KB, patch)
2013-02-05 18:49 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2013-02-05 17:55:28 UTC
The new classic mode should be visually distinct from normal mode, so add a simple mechanism for mode-specific styling.
Comment 1 Florian Müllner 2013-02-05 17:55:31 UTC
Created attachment 235240 [details] [review]
sessionMode: Add stylesheetName property

This will allow to visually differentiate modes by providing
separate styling.
Comment 2 Florian Müllner 2013-02-05 17:55:34 UTC
Created attachment 235241 [details] [review]
extensionSystem: Allow extensions to provide mode-specific styling

Allow extensions to integrate with modes that provide a distinct
style by providing a mode-specific stylesheet.
Comment 3 Giovanni Campagna 2013-02-05 18:21:59 UTC
Review of attachment 235240 [details] [review]:

::: js/ui/main.js
@@ +383,3 @@
+function _loadDefaultStylesheet() {
+    _defaultCssStylesheet = global.datadir + '/theme/' + sessionMode.stylesheetName;
+    loadTheme();

Loading a theme is expensive, it would be better if we checked that it actually changed.
Also, global.datadir is /usr/share/gnome-shell. Do you want gnome-shell-extensions to install there?
Comment 4 Giovanni Campagna 2013-02-05 18:22:42 UTC
Review of attachment 235241 [details] [review]:

Ok
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-02-05 18:23:18 UTC
Review of attachment 235241 [details] [review]:

This doesn't make sense to me, as the stylesheet being loaded now depends on the session mode that we're in when the extension is enabled. We don't swap it out when the session mode changes.
Comment 6 Giovanni Campagna 2013-02-05 18:33:48 UTC
(In reply to comment #5)
> Review of attachment 235241 [details] [review]:
> 
> This doesn't make sense to me, as the stylesheet being loaded now depends on
> the session mode that we're in when the extension is enabled. We don't swap it
> out when the session mode changes.

No, it's global.session_mode, not Main.sessionMode. It's the session mode that was chosen at shell startup (gdm, shell or classic), not including the temporary ones.
Comment 7 Giovanni Campagna 2013-02-05 18:34:15 UTC
(Plus, extensions get disabled outside of shell/classic, so it's a moot point really)
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-02-05 18:39:51 UTC
Oh, whoops. We maybe should rename that to global.startup_session_mode, so it's not too confusing.
Comment 9 Florian Müllner 2013-02-05 18:49:03 UTC
Created attachment 235250 [details] [review]
sessionMode: Add stylesheetName property

- add check for actual stylesheet changes before loading theme
 - restrict mode-specific stylesheets to primary modes (to be consistent
   with mode-specific extension stylesheets)

Regarding global.datadir, it's actually $PREFIX/share/gnome-shell - given that classic mode already assumes that gnome-session, gnome-shell and gnome-shell-extensions are installed to the same prefix (session file, mode file), I don't see anything particularly wrong with making the same assumption for the stylesheet.
Comment 10 Giovanni Campagna 2013-02-05 18:51:02 UTC
Review of attachment 235250 [details] [review]:

What I was really complaining about was reusing the gnome-shell subdirectory of $(datadir), but thinking of it again it probably makes sense.
Comment 11 Florian Müllner 2013-02-05 18:55:27 UTC
Attachment 235241 [details] pushed as 2344706 - extensionSystem: Allow extensions to provide mode-specific styling
Attachment 235250 [details] pushed as fcc32fc - sessionMode: Add stylesheetName property