diff options
author | Stevan Andjelkovic <stevan.andjelkovic@strath.ac.uk> | 2012-01-02 17:01:43 +0100 |
---|---|---|
committer | Stevan Andjelkovic <stevan.andjelkovic@strath.ac.uk> | 2012-01-02 17:01:43 +0100 |
commit | aaa662ab618b91db438999fcbed5abade18e72c3 (patch) | |
tree | ce3cd3d33d446c5dc968e963fa990bfd6c6383c7 | |
parent | 0e584a9c1e8aa505708d8c1bf21668ced2441f76 (diff) | |
download | xombrero-aaa662ab618b91db438999fcbed5abade18e72c3.tar.gz |
Simplify and normalise the config file
ok marco@
-rwxr-xr-x | config-checker.pl | 2 | ||||
-rw-r--r-- | settings.c | 44 | ||||
-rw-r--r-- | xxxterm.1 | 14 | ||||
-rw-r--r-- | xxxterm.conf | 290 | ||||
-rw-r--r-- | xxxterm.h | 5 |
5 files changed, 250 insertions, 105 deletions
diff --git a/config-checker.pl b/config-checker.pl index 7e649c3..f8fd02e 100755 --- a/config-checker.pl +++ b/config-checker.pl @@ -29,7 +29,7 @@ use constant MAIN => "xxxterm.c"; # should be the default value. sub follows_the_rule { - my ($setting_value, $config_value) = @_; + my ($default_value, $config_value) = @_; # Boolean setting. if ($default_value =~ /^(0|1)$/) { diff --git a/settings.c b/settings.c index a8da3d5..a9b3517 100644 --- a/settings.c +++ b/settings.c @@ -34,6 +34,7 @@ int enable_socket = 0; int single_instance = 0; /* only allow one xxxterm to run */ int fancy_bar = 1; /* fancy toolbar */ int browser_mode = XT_BM_NORMAL; +int gui_mode = XT_GM_CLASSIC; int enable_localstorage = 1; char *statusbar_elems = NULL; @@ -176,6 +177,12 @@ struct special s_browser_mode = { NULL }; +struct special s_gui_mode = { + set_gui_mode, + get_gui_mode, + NULL +}; + struct special s_cookie = { set_cookie_policy, get_cookie_policy, @@ -259,6 +266,7 @@ struct settings rs[] = { { "append_next", XT_S_INT, 0, &append_next, NULL, NULL }, { "autofocus_onload", XT_S_INT, 0, &autofocus_onload, NULL, NULL }, { "browser_mode", XT_S_INT, 0, NULL, NULL,&s_browser_mode }, + { "gui_mode", XT_S_INT, 0, NULL, NULL,&s_gui_mode }, { "color_visited_uris", XT_S_INT, 0, &color_visited_uris, NULL, NULL }, { "cookie_policy", XT_S_INT, 0, NULL, NULL,&s_cookie }, { "cookies_enabled", XT_S_INT, 0, &cookies_enabled, NULL, NULL }, @@ -454,6 +462,42 @@ get_browser_mode(struct settings *s) } int +set_gui_mode(struct settings *s, char *val) +{ + if (!strcmp(val, "classic")) { + fancy_bar = 1; + show_tabs = 1; + tab_style = XT_TABS_NORMAL; + show_url = 1; + show_statusbar = 0; + } else if (!strcmp(val, "minimal")) { + fancy_bar = 0; + show_tabs = 1; + tab_style = XT_TABS_COMPACT; + show_url = 0; + show_statusbar = 1; + } else + return (1); + + return (0); +} + +char * +get_gui_mode(struct settings *s) +{ + char *r = NULL; + + if (gui_mode == XT_GM_CLASSIC) + r = g_strdup("classic"); + else if (browser_mode == XT_GM_MINIMAL) + r = g_strdup("minimal"); + else + return (NULL); + + return (r); +} + +int set_cookie_policy(struct settings *s, char *val) { if (!strcmp(val, "no3rdparty")) diff --git a/xxxterm.1 b/xxxterm.1 index b9c2b14..b9a405f 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -1049,6 +1049,20 @@ the command widget, is term you want to search for using search_string If the string does not contain a dot nor a slash, is not a path to a local file and does not resolves to an IP then it is assumed to be a search term. +.It Cm gui_mode +To simplify configuring +.Nm +allows you pick between two GUI modes: +.Pa classic +(the default) and +.Pa minimal . +In the +.Pa classic +mode the GUI looks similar to that of most mainstream browsers. While in +.Pa minimal +mode the GUI looks more vi-like. One can get a GUI between the two by +tweaking the low-level GUI settings found under the advanced GUI setting +section in the configuration file. .It Cm history_autosave When enabled .Nm diff --git a/xxxterm.conf b/xxxterm.conf index 10bda14..de632de 100644 --- a/xxxterm.conf +++ b/xxxterm.conf @@ -1,134 +1,200 @@ # $xxxterm$ -# NOTE: browser_mode MUST be the first entry in this file! +## +## GENERAL SETTINGS +## -# normal browser operation (default) +# NOTE: browser_mode and gui_mode MUST be the first entries in this +# file! + +# Normal browser operation (default). # browser_mode = normal -# prevent tracking operation +# Prevent tracking operation. # browser_mode = whitelist +# Classic GUI (default). +# gui_mode = classic + +# Minimalistic GUI. +# gui_mode = minimal + # home = https://www.cyphertite.com -# ctrl_click_focus = 0 -# append_next = 1 # download_dir = ~/downloads +# window_maximize = 1 +# window_width = 1024 +# window_height = 768 +# enable_spell_checking = 1 +# spell_check_languages = en_US # default_zoom_level = 1.0 -# fancy_bar = 1 -# refresh_interval = 10 +# encoding = UTF-8 # ssl_ca_file = /etc/ssl/cert.pem -# ssl_strict_certs = 0 -# enable_socket = 0 -# enable_localstorage = 0 -# single_instance = 0 -# color_visited_uris = 1 -# save_global_history = 0 -# show_tabs = 1 -# statusbar_elems = BP -# tab_style = normal -# show_url = 1 -# show_statusbar = 0 -# session_autosave = 0 -# guess_search = 0 -# url_regex = ^[[:blank:]]*[^[:blank:]]*([[:alnum:]-]+\.)+[[:alnum:]-][^[:blank:]]*[[:blank:]]*$ -# enable_spell_checking = 0 -# spell_check_languages = en_US -# xterm_workaround = 1 +# ssl_strict_certs = 1 +# ctrl_click_focus = 1 +# append_next = 0 +# save_global_history = 1 +# color_visited_uris = 0 +# guess_search = 1 +# session_autosave = 1 # history_autosave = 1 # autofocus_onload = 1 -# encoding = UTF-8 +# xterm_workaround = 1 +# single_instance = 1 +# enable_socket = 1 # js_autorun_enabled = 0 -# auto_load_images = 1 +# auto_load_images = 0 +# enable_localstorage = 0 +# userstyle_global = 1 +# See http://www.xroxy.com/proxylist.php for a good list of open +# proxies. # -# default_script points to a script executed by the run_script command. -# the only argument passed to this script is the current uri +# http_proxy = http://127.0.0.1:80 + +# Search engines; uncomment one of these lines for you favorite search +# engine. +# +# Scroogle (default) +# search_string = https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s +# search_string = http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=%s +# +# Google +# search_string = http://www.google.com/search?q=%s&&client=xxxterm +# +# Yahoo +# search_string = http://search.yahoo.com/search?p=%s + +# "default_script" points to a script executed by the run_script +# command. The only argument passed to this script is the current URI. # # default_script = ~/.xxxterm/playflash.sh -# NOTE: webkit 1.4.x overwrites these values! -# max_host_connections = 5 -# max_connections = 25 +# "user_agent" can be set to just about anything, for a comprehensive +# list see: http://www.useragentstring.com/pages/All/ . If more than one +# "user_agent" is given, then xxxterm will use them in a round-robin +# fashion for each request. +# +# user_agent = Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US)) +# user_agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; de-de) AppleWebKit/534.15+ (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4 +# user_agent = Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729) -# cmd_font = monospace normal 9 -# oops_font = monospace normal 9 -# statusbar_font = monospace normal 9 -# tabbar_font = monospace normal 9 -# -# resource_dir = /usr/local/share/xxxterm/ -# icon_size = 2 -# window_width = 1024 -# window_height = 768 -# window_maximize = 0 +## +## ALIASES +## +# Aliases are given in the following format: # -# user_agent can bet set to just about anything -# for a comprehensive list see: http://www.useragentstring.com/pages/All/ +# alias = <alias>, <link> # -#user_agent = Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US)) -#user_agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; de-de) AppleWebKit/534.15+ (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4 -#user_agent = Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729) +# Where the link part might contain "%s", the "%s" will be substituted +# with the user's input when the alias is expanded. -# -# see http://www.xroxy.com/proxylist.php for a good list of open proxies -# http_proxy = http://127.0.0.1:80 +# alias = s, https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s +# alias = w, https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%3ASearch&search=%s +# alias = ports, http://openports.se/search.php?so=%s -# -# search engines -# uncomment one of these lines for you favorite search engine -# -# scroogle (default) -# search_string = https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s -# search_string = http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=%s -# google -# search_string = http://www.google.com/search?q=%s&&client=xxxterm -# yahoo -# search_string = http://search.yahoo.com/search?p=%s -# -# alias support, %s is substituded with user input -# alias,link+action -# alias = ports,http://openports.se/search.php?so=%s +## +## COOKIE, JAVASCRIPT AND PLUGIN WHITE LISTS +## + +# Add the domains you trust. + +# cookie_wl = .conformal.com +# cookie_wl = .peereboom.us + +# js_wl = .conformal.com +# js_wl = .peereboom.us + +# pl_wl = .conformal.com +# pl_wl = .peereboom.us + + +## +## MIME TYPES +## + +# PDF, note that xpdf can't load a URI directly; use "@" in front of +# mime_type to indicate to download the file first. -# -# pdf, note that xpdf can't load a URI directly -# use @ in front of mime_type to indicate to download the file first # mime_type = application/pdf,kpdf # mime_type = @application/pdf,xpdf -# -# specific mime type for video +# Specific MIME type for video. # mime_type = video/x-ms-wmv,mplayer # mime_type = video/quicktime,mplayer -# default mime type for video +# Default MIME type for video. # mime_type = video/*,mplayer -# default mime type for audio +# Default MIME type for audio. # mime_type = audio/*,vlc -# word docs +# Word documents. # mime_type = application/msword,soffice -# ignoring flash can be done by using a non-existent binary name +# Ignoring flash can be done by using a non-existent binary name. # mime_type = application/x-shockwave-flash,donothing -# -# advanced cookie and JS settings, don't touch unless you know what you are doing -# -# the settings for "browser_mode = whitelist" are as follows: -# allow_volatile_cookies = 0 -# cookie_policy = no3rdparty -# cookies_enabled = 1 -# enable_cookie_whitelist = 1 -# read_only_cookies = 0 -# save_rejected_cookies = 0 -# session_timeout = 3600 -# enable_scripts = 0 -# enable_js_whitelist = 1 -# enable_localstorage = 0 -# -# the settings for "browser_mode = normal" are as follows + +## +## ADVANCED SETTINGS +## + +# resource_dir = /usr/local/share/xxxterm/ +# refresh_interval = 10 +# url_regex = ^[[:blank:]]*[^[:blank:]]*([[:alnum:]-]+\.)+[[:alnum:]-][^[:blank:]]*[[:blank:]]*$ + +# NOTE: webkit 1.4.x overwrites these values! +# max_host_connections = 5 +# max_connections = 25 + + +## +## ADVANCED GUI SETTINGS +## + +# The following low-level GUI settings are set by the high-level setting +# "gui_mode". + +# The settings for "gui_mode = classic" are as follows: + +# fancy_bar = 1 +# show_tabs = 1 +# tab_style = normal +# show_url = 1 +# show_statusbar = 0 + +# The settings for "gui_mode = minimal" are as follows: + +# fancy_bar = 0 +# show_tabs = 1 +# tab_style = compact +# show_url = 0 +# show_statusbar = 1 + +# The following are settings shared between "classic" and "minimal" +# "gui_mode": + +# statusbar_elems = BP +# icon_size = 2 +# cmd_font = monospace normal 9 +# oops_font = monospace normal 9 +# statusbar_font = monospace normal 9 +# tabbar_font = monospace normal 9 + + +## +## ADVANCED COOKIE AND JAVASCRIPT SETTINGS +## + +# The following low-level settings are set by the high-level setting +# "browser_mode", and shouldn't be tweaked manually unless you know what +# you are doing. + +# The settings for "browser_mode = normal" are as follows: + # allow_volatile_cookies = 0 # cookie_policy = allow # cookies_enabled = 1 @@ -139,30 +205,46 @@ # enable_scripts = 1 # enable_js_whitelist = 0 # enable_localstorage = 1 +# enable_plugins = 1 +# enable_plugin_whitelist = 0 -# cookie white list -# cookie_wl = .conformal.com -# cookie_wl = .peereboom.us +# The settings for "browser_mode = whitelist" are as follows: -# javascript white list -# js_wl = .conformal.com -# js_wl = .peereboom.us +# allow_volatile_cookies = 0 +# cookie_policy = no3rdparty +# cookies_enabled = 1 +# enable_cookie_whitelist = 1 +# read_only_cookies = 0 +# save_rejected_cookies = 0 +# session_timeout = 3600 +# enable_scripts = 0 +# enable_js_whitelist = 1 +# enable_localstorage = 0 +# enable_plugins = 0 +# enable_plugin_whitelist = 1 -# -# key bindings -# to delete all default keybindings use "keybinding = clearall" + +## +## KEY BINDINGS +## + +# To delete all default keybindings use "keybinding = clearall". # # keybinding = clearall # # Key names can be found at: -# http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms-compat.h -# just chop off the GDK_ part and you have the keyname. -# or look at -# http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h -# and chop off GDK_KEY_ +# +# http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms-compat.h +# +# Just chop off the "GDK_" part and you have the keyname. Or look at: +# +# http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h +# +# and chop off "GDK_KEY_". +# # Be aware that the names are case sensitive! # -# default keybindings +# The default keybindings are the following: # # keybinding = command,colon # keybinding = search,slash diff --git a/xxxterm.h b/xxxterm.h index 3558ed0..e510bc4 100644 --- a/xxxterm.h +++ b/xxxterm.h @@ -430,6 +430,9 @@ int command_mode(struct tab *, struct karg *); #define XT_BM_WHITELIST (1) #define XT_BM_KIOSK (2) +#define XT_GM_CLASSIC (0) +#define XT_GM_MINIMAL (1) + #define XT_TABS_NORMAL (0) #define XT_TABS_COMPACT (1) @@ -477,8 +480,10 @@ size_t get_settings_size(void); int settings_add(char *, char *); void setup_proxy(char *); int set_browser_mode(struct settings *, char *); +int set_gui_mode(struct settings *, char *); int set_cookie_policy(struct settings *, char *); char *get_browser_mode(struct settings *); +char *get_gui_mode(struct settings *); char *get_cookie_policy(struct settings *); void init_keybindings(void); void config_parse(char *, int); |