\hypertarget{md_src_plugins_mozprefs_autoconfig_README_src_plugins_mozprefs_autoconfig_README_md}{}\doxysection{Introduction}\label{md_src_plugins_mozprefs_autoconfig_README_src_plugins_mozprefs_autoconfig_README_md}
This file explains how Firefox preferences can be manipulated at run-\/time using Elektra’s intercept open and a custom autoconfig script.\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md351}{}\doxysection{Basics}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md351}
{\ttfamily kdb configure-\/firefox -\/s} will configure everything needed to get started.\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md352}{}\doxysubsection{Files}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md352}

\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}{0}
\DoxyCodeLine{user\_pref("{}elektra.config.file"{}, "{}/tmp/imnotreal.js"{});}
\DoxyCodeLine{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}\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md353}{}\doxysubsection{Setting Preferences}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md353}
\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md354}{}\doxysubsubsection{Guided Setup}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md354}
Running {\ttfamily kdb configure-\/firefox -\/a} provides a guided setup for adding http\+\_\+proxy and homepage preferences.


\begin{DoxyCode}{0}
\DoxyCodeLine{\% kdb configure-\/firefox -\/a}
\DoxyCodeLine{Add new preferences}
\DoxyCodeLine{Config Setup:}
\DoxyCodeLine{}
\DoxyCodeLine{1) Proxy}
\DoxyCodeLine{2) Homepage}
\DoxyCodeLine{0) Exit}
\DoxyCodeLine{1}
\DoxyCodeLine{}
\DoxyCodeLine{Setting up HTTP Proxy}
\DoxyCodeLine{1) lock}
\DoxyCodeLine{2) default}
\DoxyCodeLine{3) user}
\DoxyCodeLine{0) Exit}
\DoxyCodeLine{1}
\DoxyCodeLine{}
\DoxyCodeLine{Proxy Type}
\DoxyCodeLine{0) No Proxy}
\DoxyCodeLine{1) Manual Setup}
\DoxyCodeLine{2) PAC}
\DoxyCodeLine{4) Auto-\/detect}
\DoxyCodeLine{5) System Settings}
\DoxyCodeLine{1}
\DoxyCodeLine{}
\DoxyCodeLine{Set string to 1}
\DoxyCodeLine{Host/IP: 127.0.0.1}
\DoxyCodeLine{Port: 8080}
\DoxyCodeLine{Setting lockPref HTTP Proxy to 127.0.0.1:8080}

\end{DoxyCode}
\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md355}{}\doxysubsubsection{Manual Setup}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md355}
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}{0}
\DoxyCodeLine{kdb meta-\/set user:/prefs/lock/network/proxy/type type integer}
\DoxyCodeLine{kdb set user:/prefs/lock/network/proxy/type 1}
\DoxyCodeLine{kdb meta-\/set user:/prefs/lock/network/proxy/http type string}
\DoxyCodeLine{kdb set user:/prefs/lock/network/proxy/http 127.0.0.1}
\DoxyCodeLine{kdb meta-\/set user:/prefs/lock/network/proxy/http\_port type integer}
\DoxyCodeLine{kdb set user:/prefs/lock/network/proxy/http\_port 8080}

\end{DoxyCode}
\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md356}{}\doxysubsection{Test Setup}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md356}
Running {\ttfamily kdb configure-\/firefox -\/t} will set up some test values.


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb export /preload}
\DoxyCodeLine{\#> [open]}
\DoxyCodeLine{\#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js =}
\DoxyCodeLine{\#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js/generate = user:/prefs}
\DoxyCodeLine{\#> \(\backslash\)/tmp\(\backslash\)/imnotreal.js/generate/plugin = mozprefs}
\DoxyCodeLine{}
\DoxyCodeLine{kdb export user:/prefs}
\DoxyCodeLine{\#> [lock/a/lock]}
\DoxyCodeLine{\#> 1 = lock1}
\DoxyCodeLine{\#> 2 = lock2}
\DoxyCodeLine{\#> [pref/a/default]}
\DoxyCodeLine{\#> 1 = 1}
\DoxyCodeLine{\#> 2 = 2}
\DoxyCodeLine{\#> [user:/a/user]}
\DoxyCodeLine{\#> f = false}
\DoxyCodeLine{\#> t = true}
\DoxyCodeLine{}
\DoxyCodeLine{kdb export user:/prefs mozprefs}
\DoxyCodeLine{\#> lockPref("{}a.lock.1"{}, "{}lock1"{});}
\DoxyCodeLine{\#> lockPref("{}a.lock.2"{}, "{}lock2"{});}
\DoxyCodeLine{\#> pref("{}a.default.1"{}, 1);}
\DoxyCodeLine{\#> pref("{}a.default.2"{}, 2);}
\DoxyCodeLine{\#> user\_pref("{}a.user.f"{}, false);}
\DoxyCodeLine{\#> user\_pref("{}a.user.t"{}, true);}

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{kdb elektrify-\/open firefox-\/esr "{}about:config"{}}

\end{DoxyCode}





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

\end{DoxyCode}


\hypertarget{md_src_plugins_mozprefs_autoconfig_README_autotoc_md357}{}\doxysection{Limitations}\label{md_src_plugins_mozprefs_autoconfig_README_autotoc_md357}
Changing locked values doesn\textquotesingle{}t work without restarting. 