logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: a60529ec9f97663138e15d5f9598962c61f34d7e
parent: 27e52f39ecc17e934e642152117948321bd6abbe
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu,  2 Apr 2020 06:49:46 +0200

Add CSS Provider for styling the interface

Diffstat:

MMakefile1+
Mbadwolf.111+++++++++++
Mbadwolf.c26++++++++++++++++++++++++++
Ainterface.css1+
Mpo/messages.pot56++++++++++++++++++++++++++++----------------------------
5 files changed, 67 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -69,6 +69,7 @@ install: all cp -p badwolf.1 $(DESTDIR)$(MANDIR)/man1 mkdir -p $(DESTDIR)$(DATADIR)/locale cp -r locale/ $(DESTDIR)$(DATADIR) + cp interface.css $(DESTDIR)$(DATADIR) mkdir -p $(DESTDIR)$(APPSDIR) cp -p badwolf.desktop $(DESTDIR)$(APPSDIR)/ mkdir -p $(DESTDIR)$(DOCDIR) diff --git a/badwolf.1 b/badwolf.1 @@ -79,6 +79,17 @@ Examples of useful extensions may be found at: .Lk https://hacktivis.me/git/badwolf-extensions .Lk https://github.com/jun7/wyebadblock .El +.It Pa ${DATADIR:-/usr/local/share}/badwolf/interface.css +.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/interface.css +CSS files (respectively system and user-level) for styling badwolf interface. See +.Lk https://developer.gnome.org/gtk3/stable/chap-css-properties.html +for the properties being available. +.Pp +For testing your styles I would recommend using the +.Ev GTK_DEBUG=interactive +environment variable on launching +.Nm +and going to the CSS tab. .El .Sh BUGS You can submit contributions or tickets to diff --git a/badwolf.c b/badwolf.c @@ -13,6 +13,7 @@ #include <locale.h> /* LC_* */ #include <stdio.h> /* perror(), fprintf() */ #include <stdlib.h> /* malloc() */ +#include <unistd.h> /* access() */ const gchar *homepage = "https://hacktivis.me/projects/badwolf"; const gchar *version = VERSION; @@ -790,6 +791,31 @@ main(int argc, char *argv[]) GTK_WINDOW(window->main_window), BADWOLF_DEFAULT_WIDTH, BADWOLF_DEFAULT_HEIGHT); gtk_window_set_role(GTK_WINDOW(window->main_window), "browser"); + GtkCssProvider *css_provider_app = gtk_css_provider_new(); + gchar *provider_path_app = g_build_filename(DATADIR, "interface.css", NULL); + if(access(provider_path_app, R_OK) == 0) + { + gtk_css_provider_load_from_path(css_provider_app, provider_path_app, NULL); + gtk_style_context_add_provider_for_screen( + gtk_widget_get_screen(GTK_WIDGET(window->main_window)), + GTK_STYLE_PROVIDER(css_provider_app), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } + g_free(provider_path_app); + + GtkCssProvider *css_provider_user = gtk_css_provider_new(); + gchar *provider_path_user = + g_build_filename(g_get_user_data_dir(), "badwolf", "interface.css", NULL); + if(access(provider_path_user, R_OK) == 0) + { + gtk_css_provider_load_from_path(css_provider_user, provider_path_user, NULL); + gtk_style_context_add_provider_for_screen( + gtk_widget_get_screen(GTK_WIDGET(window->main_window)), + GTK_STYLE_PROVIDER(css_provider_user), + GTK_STYLE_PROVIDER_PRIORITY_USER); + } + g_free(provider_path_user); + gtk_widget_set_tooltip_text(window->new_tab, _("Open new tab")); gtk_notebook_set_action_widget(GTK_NOTEBOOK(window->notebook), window->new_tab, GTK_PACK_END); diff --git a/interface.css b/interface.css @@ -0,0 +1 @@ +#browser__location, #browser__statuslabel { font-family: monospace; } diff --git a/po/messages.pot b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 0.5.1+ge2338bb\n" +"Project-Id-Version: Badwolf 0.5.1+g1934146\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-03-31 05:48+0200\n" +"POT-Creation-Date: 2020-04-02 06:50+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,51 +17,51 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: badwolf.c:759 +#: badwolf.c:772 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:384 +#: badwolf.c:389 msgid "Continue" msgstr "" -#: badwolf.c:334 +#: badwolf.c:339 msgid "" "Couldn't verify the TLS certificate to ensure a better security of the " "connection. You might want to verify your machine and network.\n" "\n" msgstr "" -#: badwolf.c:95 +#: badwolf.c:96 msgid "Crashed" msgstr "" -#: badwolf.c:357 +#: badwolf.c:362 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:338 +#: badwolf.c:343 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:351 +#: badwolf.c:356 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:348 +#: badwolf.c:353 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:354 +#: badwolf.c:359 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:345 +#: badwolf.c:350 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:341 +#: badwolf.c:346 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" @@ -72,67 +72,67 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:688 +#: badwolf.c:701 msgid "New tab" msgstr "" -#: badwolf.c:781 +#: badwolf.c:819 msgid "Open new tab" msgstr "" -#: badwolf.c:99 +#: badwolf.c:100 msgid "Out of Memory" msgstr "" -#: badwolf.c:757 +#: badwolf.c:770 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:764 +#: badwolf.c:777 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:381 +#: badwolf.c:386 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:384 +#: badwolf.c:389 msgid "Temporarly Add Exception" msgstr "" -#: badwolf.c:573 +#: badwolf.c:586 msgid "Toggle javascript" msgstr "" -#: badwolf.c:103 +#: badwolf.c:104 msgid "Unknown Crash" msgstr "" -#: badwolf.c:614 +#: badwolf.c:627 msgid "search in current page" msgstr "" -#: badwolf.c:94 +#: badwolf.c:95 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:98 +#: badwolf.c:99 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:102 +#: badwolf.c:103 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:771 +#: badwolf.c:784 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:810 +#: badwolf.c:848 msgid "ΓΈ" msgstr ""