Thinking Out Of The Sandboxie

I need to work on computers with a light text / dark background colour theme, and for the last couple of decades I’ve been able to get Windows and most applications I use to follow suit.

Windows Vista introduced a new theme system which took away the control over UI element colours unless you used the High Contrast theme, very harsh and ugly compared to what I’d configured and used since Win 3.1 to XP. With support for XP ending, the time had come to upgrade.

I had high hopes for Windows 8.1. The High Contrast theme lets you configure UI element colours (menus, text, backgrounds) but for some nonsensical reason, window borders always follow the colour of the window title (even though there is a field for window border in the theme file). Nonetheless I came up with an acceptable theme to work with.

Things came unstuck when I installed Mozilla’s Thunderbird and Firefox. When these detect a system High Contrast (HC) theme, they switch to a hard coded and broken theme (since September 2013) which includes white on white text and menu bars that get garbled as you drag over them. Its horrendous yet after months and plenty of bug reports, its unresolved.

Worst though is that when running on a HC Win8.1 system, Firefox shows all sites using an internal theme which wrecks the CSS for many sites, making them unusable. The setting of the “Allow pages to choose their own colours” option is totally ignored. System HC? Then your pages are always HC in FF, not acceptable to me.

Experimenting with .THEME files I found I could create a theme file with the high contrast flag off but still using the AeroLite rendering framework. Whilst this made FF and TB look OK, the windows Control Panel and other system windows now had huge sploges of white on them, as Microsoft uses the HC flag to control whether UI colours are respected. Running this way would also be unacceptable.

I found I could make TB and FF run without the theming if I ran them in Windows XP Compatibility Mode. I could have lived with this if it wasn’t for the fact that they also insisted in running as Administrator when in compability mode, not what you want for a web browser.

I was pretty cornered and starting to consider compiling from source or hooking the calls to the check for HC mode, Win32 function SystemParametersInfo(). Then I remembered an application called Sandboxie.

Sandboxie allows you to run windows applications in such a way that any modifications they make to files or the registry are captured and retained in a separate “sandbox” folder, meaning the real files are not modified, but from the point of view of applications running through Sandboxie, the changes have been made and persist. Its great for web browsers to help contain exploits from messing up your real system. But could it help me with theme problems?

It took a minute to install and it created a shortcut I could use to run Firefox as sandboxed. From within Sandboxie I then launched Windows Control Panel and went to Personalisation and chose my modified dark theme which had the “high contrast” flag off – the theme I mentioned earlier that messes up the system Control Panel but fixes Firefox and Thunderbird.

Interesting. The selection was made but the system’s theme did not change to reflect the selection. Control panel still looked good. The system still saw HC mode as on.

Then I opened Firefox through Sandboxie. It saw the HC mode as off and had reasonable UI colours.

After ensuring email and web history folders were not included in the sandbox, I now have a very workable solution to Mozilla’s High Contrast theme problems, and with the sandboxing feature, additional security as well.

I like that you can browse the sandbox folder. You see all the folder structure and registry hives that have been modified from within the sandbox. With my data files not sandboxed, there is very little there except a few hundred K of registry data which stores the alternate non HC theme that exists only within the sandbox.

Using it is trivial. I’ve made another shortcut for Thunderbird which launches it through the sandbox and Sandboxie has lots of options to get it out of the way once you’ve set things up.

The only downside I can think of is that I’ll have to take care when Firefox and Thunderbird update. The changed program files will be sandboxed but I guess I’ll occasionally run them outside sandboxie when I want to bring the “real” installs up to date.