This file explains how Firefox preferences can be manipulated at run-\/time using Elektra’s intercept open and a custom autoconfig script.

{\ttfamily kdb configure-\/firefox -\/s} will configure everything needed to get started.


\begin{DoxyItemize}
\item {\ttfamily /usr/lib/firefox} / {\ttfamily /usr/lib/firefox-\/esr}
\begin{DoxyItemize}
\item {\ttfamily defaults/pref/autoconfig.\+js} Loads {\ttfamily elektra.\+cfg}

``` pref(\char`\"{}general.\+config.\+filename\char`\"{}, \char`\"{}elektra.\+cfg\char`\"{}); pref(\char`\"{}general.\+config.\+obscure\+\_\+value\char`\"{}, 0); ```
\item {\ttfamily elektra.\+cfg} Contains the autoconfig code
\end{DoxyItemize}
\item {\ttfamily $\sim$/.mozilla/firefox/$<$profile$>$/prefs.js} Contains the user preferences. The configure-\/firefox script will append the config for our autoconfig script\+:
\end{DoxyItemize}


\begin{DoxyCode}
user\_pref("elektra.config.file", "/tmp/imnotreal.js");
user\_pref("elektra.config.reload\_trigger\_port", 65432);
\end{DoxyCode}


Every time the string {\ttfamily reload} is send to localhost\+:{\ttfamily elektra.\+config.\+reload\+\_\+trigger\+\_\+port} the autoconfig script will import the preferences from {\ttfamily elektra.\+config.\+file} ~\newline
 {\ttfamily elektry.\+config.\+file} contains the name of the dummy file for {\ttfamily intercept open}. {\ttfamily open} calls to this file will be intercepted and the content generated by {\ttfamily intercept open}

Running {\ttfamily kdb configure-\/firefox -\/a} provides a guided setup for adding http\+\_\+proxy and homepage preferences.


\begin{DoxyCode}
% kdb configure-firefox -a
Add new preferences
Config Setup:

1) Proxy
2) Homepage
0) Exit
1

Setting up HTTP Proxy
1) lock
2) default
3) user
0) Exit
1

Proxy Type
0) No Proxy
1) Manual Setup
2) PAC
4) Auto-detect
5) System Settings
1

Set string to 1
Host/IP: 127.0.0.1
Port: 8080
Setting lockPref HTTP Proxy to 127.0.0.1:8080
\end{DoxyCode}


This example shows how to manually setup a preferences. It\textquotesingle{}s equivalent to the example shown above in the {\ttfamily Guided setup}


\begin{DoxyCode}
kdb setmeta user/prefs/lock/network/proxy/type type integer
kdb set user/prefs/lock/network/proxy/type 1
kdb setmeta user/prefs/lock/network/proxy/http type string
kdb set user/prefs/lock/network/proxy/http 127.0.0.1
kdb setmeta user/prefs/lock/network/proxy/http\_port type integer
kdb set user/prefs/lock/network/proxy/http\_port 8080
\end{DoxyCode}


Running {\ttfamily kdb configure-\/firefox -\/t} will set up some test values.


\begin{DoxyCode}
kdb export /preload
#> [open]
#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js =
#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js/generate = user/prefs
#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js/generate/plugin = mozprefs

kdb export user/prefs
#> [lock/a/lock]
#> 1 = lock1
#> 2 = lock2
#> [pref/a/default]
#> 1 = 1
#> 2 = 2
#> [user/a/user]
#> f = false
#> t = true

kdb export user/prefs mozprefs
#> lockPref("a.lock.1", "lock1");
#> lockPref("a.lock.2", "lock2");
#> pref("a.default.1", 1);
#> pref("a.default.2", 2);
#> user\_pref("a.user.f", false);
#> user\_pref("a.user.t", true);
\end{DoxyCode}



\begin{DoxyCode}
kdb elektrify-open firefox-esr "about:config"
\end{DoxyCode}





\begin{DoxyCode}
kdb setmeta user/prefs/lock/a/lock/3 type boolean
kdb set user/prefs/lock/a/lock/3 true
kdb export user/prefs
#> [lock/a/lock]
#> 1 = lock1
#> 2 = lock2
#> 3 = true
#> [pref/a/default]
#> 1 = 1
#> 2 = 2
#> [user/a/user]
#> f = false
#> t = true
\end{DoxyCode}




Changing locked values doesn\textquotesingle{}t work without restarting. 