Loading Themes without Restart.

Discuss application theming and theme development.
Locked
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Loading Themes without Restart.

Post by patrickjdempsey »

Please excuse the length of the first post, I've decided to branch this conversation off from Sharebird's "light-weight" theme post. While I was inspired by something Sharebird mentioned early in that thread, this topic is separate, and I don't want to create any more confusion in that thread.


patrickjdempsey wrote:WOW

From the first page....
ShareBird wrote:Let's suppose an user has installed 4 themes, theme 1 , theme 2, theme 3, theme 4.

All these themes will register, e.g., a skin provider for the browser package:
Theme 1:

Code: Select all

skin      browser    theme_1      chrome/browser/


Theme 2:

Code: Select all

skin      browser    theme_2      chrome/browser/


Etc...

Now, Firefox has registered 5 skin providers for the browser package:

Image

The first best-fit skin is defined on user preferences at general.skins.selectedSkin preference. With this, Firefox will switch to the skin provider with this value as internal name.

So, I've registered a skin provider for the customskin package, right? But the only theme that has registered a skin for this package is already firebird.

When the user changes the value from general.skins.selectedSkin, Firefox will look for the respective register and, of course, will not find it. But it has already a skin provider registered for this package (the firebird skin) and will take it for all other themes.


Umm... has anyone else played with this pref? If you force it, it will swap themes, FULL THEMES on the fly... no restart... except that it carries over previous icon sets with it, at least in Firefox 3.6. I tried aaron's Smoke but it simply reset to the default theme. I think the only way to get it to line up styles and icons would be to have two basically identical themes with different names/GUID's which you could swap in succession. I'm more than a little bit flabbergasted about this. It means Firefox apparently has the ability to swap themes without restarts BUILT IN, the devs are just too stubborn to make the fixes required to do it. If someone could find their way around the images/styles misalignment this could possibly make a very small extension. I really don't think I was mad enough about Personas before.



ShareBird wrote:Try pressing Ctrl+N at one of the windows... the new window will fix the messes...



patrickjdempsey wrote:So if someone was make an extension that repurposed the Use Theme button in the Add-ons panel to force this pref and then had an action like Open In New Window for all tabs (like TabMixPlus's Duplicate in New Window) and then closed the previous Window, it would basicly act like a Restart, but much faster.



WildcatRay wrote:I see something similar. I use the Organize Status Bar extension. I have saved its about:config pref so that I do not have to manually organize things. But after pasting the saved data into the pref, I must open a new window to see the changes take affect.



patrickjdempsey wrote:This add-on: https://addons.mozilla.org/en-US/firefox/addon/45322 has a feature called "Reload Chrome" that allows you to reload the browser chrome without restarting Firefox or opening a new window. The downside is major though, it clears the tabs and gives you a completely fresh start. It may or may not be related to this project: http://github.com/dom0/reload-chrome which has the same exact effect but the code is simplified down to just the reload chrome aspect. Someone who understands XUL and JS more than me would probably be able to make something of it.



patrickjdempsey wrote:Opening the Customize window also redraws the chrome without loosing any tabs.



patrickjdempsey wrote:An update about the Customize window: Because it only draws the main toolbars, it will not fix the images for the tabs, scrollbars, or the statusbar. Opening a new window does clean everything up nicely though.

You can also switch to a Persona from a 3rd party theme and back without a restart by loading the default theme first, it's called "classic/1.0".



Lastly, I've found that hitting F-11 twice to go full-screen and come back redraws about the same amount of the chrome as Customize. Scrollbars only update if you click on them and tab icons update when you hover over them. It's a freaky effect, but not exactly what people would want. The fact that what does happen is so close to working suggests to me that it is totally possible to swap full themes without a restart. Restarts would be required for installs because of the way Firefox checks for compatibility and installs new packages at start-up. I'm very tempted to learn enough JS to write and extension that will do this. I need to study the Content folders and see how Firefox handles theme swaps to begin with I suppose.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
smsmith
Moderator
Posts: 19979
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Re: Loading Themes without Restart.

Post by smsmith »

There's already a preference that does this:
extensions.dss.enabled <-- set to true

But as you've discovered, you need to somehow reload the chrome as some of the elements may become distorted, which can be done by making a new window.
https://bugzilla.mozilla.org/show_bug.cgi?id=226791
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.
User avatar
Jeff.Tet
Posts: 478
Joined: August 25th, 2004, 7:36 pm

Re: Loading Themes without Restart.

Post by Jeff.Tet »

There is another preference that will apply a theme without a restart. The problem is that not everything loads properly. Like you posted, you have hit f-11 a few times, click on the scroll bars and so-on. I have played around trying to make those adjustments. I didn't really make any head way. :? I have played around with the idea of simulating a theme change without actually using extensions manager to apply it. I had to shelf it to work on other stuff for now.
Chromifox Extreme Themes Extreme | Carbon

Home Page Chromifox Themes
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

My jaw is absolutely on the floor right now.

Mike Connor 2004-01-23 10:22:47 PST

I personally don't think that its worth the effort to make it work. Its not
necessary at this point, however if someone wants to try investing the effort
to get this to work, a new bug should be opened to implement it properly.


And almost exactly 6 years later he is using the argument that Themes don't work without a restart to kill them off?? If there has even been a time for this emoticon, it is now:

](*,)
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
smsmith
Moderator
Posts: 19979
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Re: Loading Themes without Restart.

Post by smsmith »

Possibly other useful ones at this time:
#-o
:roll:
:shock:

patrickjdempsey wrote:And almost exactly 6 years later he is using the argument that Themes don't work without a restart to kill them off??

I haven't been following the "debate" over this closely at all. Can you point me to where he says that?
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

My bad, it was actually Mike Beltzner that used that argument here:

http://groups.google.com/group/mozilla. ... ch=restart

It's also one of the top reasons listed for choosing Personas over Themes in just about every marketing blurb and blog post, which means it must be on press releases, as well as being at the very top of the Mozilla Wiki / Personas Uplift:

https://wiki.mozilla.org/Firefox/Projec ... xploration
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

Triton wrote:There is another preference that will apply a theme without a restart. The problem is that not everything loads properly. Like you posted, you have hit f-11 a few times, click on the scroll bars and so-on. I have played around trying to make those adjustments. I didn't really make any head way. :? I have played around with the idea of simulating a theme change without actually using extensions manager to apply it. I had to shelf it to work on other stuff for now.


Something that WOULD work, although crudely, would be to force all tabs to open in a New Window and then close the old Window. This would be somewhat faster than a restart, but somewhat slower than a forced re-chrome.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
smsmith
Moderator
Posts: 19979
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Re: Loading Themes without Restart.

Post by smsmith »

patrickjdempsey wrote:Something that WOULD work, although crudely, would be to force all tabs to open in a New Window and then close the old Window. This would be somewhat faster than a restart, but somewhat slower than a forced re-chrome.

As long as the tabs didn't try to reload, that would be fine with me. I don't tell Firefox to clear my history or cache, and when I restart, it feels like the pages are reloading, even though a reload when the tab finally becomes responsive indicates they are not.

I'll need to read through the links you gave. Thanks for posting them for me.
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

That may depend on the size of your cache and I think Firefox does reload some things... I wipe the cache on this machine every time it closes out and it's still pretty snappy! The method I'm talking about would reload the tabs, which I why I called it crude. It would still be less time than a restart and now that Firefox is pretty reliable about keeping form post data when you reload a tab or even restart, it wouldn't be to bad. An alternative would be to stuff a button in the Add-Ons panel that allows you to manually create the new window. That way you would only do that when you need to to refresh the icons.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
ShareBird
Posts: 2740
Joined: December 8th, 2004, 7:09 am
Location: Berlin | Made in Brasil
Contact:

Re: Loading Themes without Restart.

Post by ShareBird »

I've missed this discussion here...

Anyway, I've written a small extension to load themes without a restart:
Get it from AMO:
https://addons.mozilla.org/en-US/firefox/addon/61769

or direct installation:
http://www.silvermel.net/xpi/switchthemes_0.0.1.xpi
Silvermel - A Theme for Firefox and Thunderbird
YATT - Yet Another Theme Tutorial
Don't give a man a fish. Teach him how to fish instead.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

I agree with Ngamer01's post:

Ngamer01 wrote:..It does it's job well, though it isn't pretty with the Add-ons Window having to stay visible.


I think that since the action is immediate once you switch a theme, you can probably kill off the Add-ons panel. It's only useful to have it up if you are switching from theme to theme. The only problem I could see is the surprise people will have that the window closes and reopens when you select "Use Theme". An alternative would be to not automatically have the theme switch, but to add a button at the bottom, maybe where Get Themes is ;) that says "Load Theme" that does the switch, and then close the Add-ons panel after that. That is... until we can figure out how to reload the Chrome without forcing all of the tabs to a new window. :) But so far so good... I like it! It's def useful as a developer and takes the time out of testing different themes!
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
tanjihay
Posts: 54
Joined: October 30th, 2007, 2:11 am
Contact:

Re: Loading Themes without Restart.

Post by tanjihay »

ShareBird wrote:I've missed this discussion here...

Anyway, I've written a small extension to load themes without a restart:
Get it from AMO:
https://addons.mozilla.org/en-US/firefox/addon/61769

or direct installation:
http://www.silvermel.net/xpi/switchthemes_0.0.1.xpi


This is great!!! =D>
They should really add this into Firefox 3.7 :mrgreen:
User avatar
ShareBird
Posts: 2740
Joined: December 8th, 2004, 7:09 am
Location: Berlin | Made in Brasil
Contact:

Re: Loading Themes without Restart.

Post by ShareBird »

A new version closing the Addons Manager and "fixing" the "Get Themes" link:
http://www.silvermel.net/dev/xpi/switch ... _r3238.xpi
Silvermel - A Theme for Firefox and Thunderbird
YATT - Yet Another Theme Tutorial
Don't give a man a fish. Teach him how to fish instead.
User avatar
DonGato
Posts: 589
Joined: December 1st, 2005, 9:57 am

Re: Loading Themes without Restart.

Post by DonGato »

Nice work ShareBird, this should show that is merely a political decision and not "technical issues" that this thing wasn't done before.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Loading Themes without Restart.

Post by patrickjdempsey »

Sharebird.... the Get Personas button should only appear for the Add-ons tab. If you insert it after the GetMore button instead of before, then you can use a little CSS to hide it without anything special. ;)

Code: Select all

#getMore[hidden="true"] + #getPersonas { visibility: hidden; }


Also, is there a way for the Add-ons panel to close before the chrome is reloaded?
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
Locked