Question

Is there any way to change the firefox shift hotkey that makes firefox start in safe mode? I've set up some unit tests using Selenium and PHPUnit, but if I'm working on the machine while the tests are running then I frequently find I'm pressing shift as I type (holding shift as I select blocks of code is another big offender). This causes the test to fail (and time out) even if you click past the safe mode prompt that pops up.

Is there a way to disable this hot key, or change the key to something that I'd use less often?

Was it helpful?

Solution

I've also met with this problem and didn't find a solution. It seems that it is still an open issue: Mozilla Forums thread, Bug 653410, Bug 644175 and so on. As a workaround you can install firefox 3.6 as this feature was implemented since firefox 4, but probably this will not suite you.

OTHER TIPS

Mozilla finally added an environment variable to control this behavior. Unfortunately, configuring this environment variable in a way that applies to the overall graphical system, rather than merely a bash session, is a bit difficult. This used to be done via /etc/launchd.conf, but macOS dropped support for this in v10.10. Fortunately, systemctl offers a .plist file system which can define run programs and define system-wide environment variables at boot, so I published this working .plist file, with instructions for installing and removing it:

https://github.com/mcandre/dotfiles/blob/master/setenv.MOZ_DISABLE_SAFE_MODE_KEY.plist

This is awesome for me, because I like to launch my web browser from anywhere in the GUI with Control+Alt+G via QuickSilver, which of course includes the Alt modifier that Firefox tends to interpret as signaling safe mode.

Until Bug 653410 is fixed, the best workaround I can come up with is to detect when safe mode is launched and handle it in the best way fit for your particular purposes. This may mean killing the Firefox process and launching again, or it may mean warning the user, or both.

When Firefox is launched into safe mode, it writes "LastVersion=Safe Mode" to its compatibility.ini file in its profile directory. An example C# function to watch for this is given below.

    FileSystemWatcher safeModeWatcher;

    private void watchSafeMode()
    {
        string profiles = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Mozilla", "Firefox", "Profiles");
        string defaultProfile = Directory.GetDirectories(profiles, "*default*")[0];
        safeModeWatcher = new FileSystemWatcher(defaultProfile, "compatibility.ini");
        safeModeWatcher.NotifyFilter = NotifyFilters.LastWrite;
        safeModeWatcher.Changed += delegate(object s, FileSystemEventArgs e)
        {
            if (File.ReadAllText(e.FullPath).Contains("LastVersion=Safe Mode"))
            {
                // safe mode!
                System.Diagnostics.Trace.WriteLine("safe mode detected!");
                // TODO kill Firefox and launch again, or whatever makes sense for you
            }
        };
        safeModeWatcher.EnableRaisingEvents = true;
        // ...
        // TODO Dispose safeModeWatcher when done
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top