From bedb9fe355e8e827b865df41137dad95f3a561e1 Mon Sep 17 00:00:00 2001 From: Alexandre Arnt Date: Thu, 11 Nov 2021 23:01:15 -0300 Subject: [PATCH] BugFixes in keybidings and dark mode --- README.md | 2 +- badwolf.c | 6 ++++- keybindings.c | 36 ++++++++++++++-------------- po/messages.pot | 62 ++++++++++++++++++++++++------------------------- 4 files changed, 55 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index fdd458f..ae32d9f 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,12 @@ Ctrl+H | Return focus to page Ctrl+I | Toggle show images on/off Ctrl+J | Toggle enable javascript on/off Ctrl+L | Goto location widget -Ctrl+N | Open link in new tab Ctrl+P | Show print dialog Ctrl+Q | Quit LRRH Ctrl+R | Reload page Ctrl+Shift+C | Copy statusbar text (hyperlink) to clipboard Ctrl+Shift+G | Find previous +Ctrl+Shift+N | Open link in new tab Ctrl+T | Open new empty tab Ctrl+W | Close current tab Ctrl+Z | Translate selected text to pt-br using Google Translator diff --git a/badwolf.c b/badwolf.c index 4e86f63..b86cff9 100644 --- a/badwolf.c +++ b/badwolf.c @@ -21,7 +21,11 @@ gchar *web_extensions_directory; const gchar *homepage = "https://hacktivis.me/projects/badwolf"; const gchar *version = VERSION; gboolean g_dark_mode = FALSE; -static gchar *source = "a { color: lightgreen !important; } body, form, h1, h2, h3, h4, h5, div, iframe, input, label, li, option, p, pre, root, select, span, table, td, th, tr, ul { background: none !important; background-color: #212529 !important; color: #899095 !important; }"; +static gchar *source = "a { color: lightgreen !important; }" + "article, aside, body, dd, dl, dt, form, " + "h1, h2, h3, h4, h5, header, div, iframe, input, label, " + "li, option, p, pre, root, select, span, table, td, th, tr, ul " + "{ background: none !important; background-color: #212529 !important; color: #aeb3b7 !important; }"; //#a3aaaf #899095 static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); diff --git a/keybindings.c b/keybindings.c index 2f20fc1..dc86798 100644 --- a/keybindings.c +++ b/keybindings.c @@ -191,7 +191,10 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * { if(browser != NULL) { - switch(((GdkEventKey *)event)->keyval) + gboolean jsEnabled = gtk_toggle_button_get_active((GtkToggleButton *)browser->javascript); + gboolean imgEnabled = gtk_toggle_button_get_active((GtkToggleButton *)browser->auto_load_images); + + switch(((GdkEventKey *)event)->keyval) { case GDK_KEY_C: statusLabel = strdup(gtk_label_get_text(GTK_LABEL(browser->statuslabel))); @@ -204,6 +207,20 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * case GDK_KEY_ISO_Left_Tab: goto_prev_tab(notebook); return TRUE; + case GDK_KEY_N: + nbrowser = new_browser(window, + gtk_label_get_text(GTK_LABEL(browser->statuslabel)), + NULL); + if (nbrowser != NULL) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nbrowser->javascript), jsEnabled); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nbrowser->auto_load_images), imgEnabled); + + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), nbrowser, FALSE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook), + gtk_notebook_get_current_page(notebook)+1); + } + return TRUE; case GDK_KEY_plus: zoom = webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(browser->webView)); zoom += zoom * 0.1; @@ -219,9 +236,6 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * { if(browser != NULL) { - gboolean jsEnabled = gtk_toggle_button_get_active((GtkToggleButton *)browser->javascript); - gboolean imgEnabled = gtk_toggle_button_get_active((GtkToggleButton *)browser->auto_load_images); - switch(((GdkEventKey *)event)->keyval) { case GDK_KEY_F4: @@ -260,20 +274,6 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * case GDK_KEY_l: gtk_widget_grab_focus(browser->location); return TRUE; - case GDK_KEY_n: - nbrowser = new_browser(window, - gtk_label_get_text(GTK_LABEL(browser->statuslabel)), - NULL); - if (nbrowser != NULL) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nbrowser->javascript), jsEnabled); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(nbrowser->auto_load_images), imgEnabled); - - badwolf_new_tab(GTK_NOTEBOOK(window->notebook), nbrowser, FALSE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook), - gtk_notebook_get_current_page(notebook)+1); - } - return TRUE; case GDK_KEY_p: webkit_print_operation_run_dialog(webkit_print_operation_new(browser->webView), GTK_WINDOW(browser->window)); diff --git a/po/messages.pot b/po/messages.pot index 12336da..2797298 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.3+g5e1689f.main\n" +"Project-Id-Version: Badwolf 1.0.3+ge846cab.main\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2021-11-11 19:36-0300\n" +"POT-Creation-Date: 2021-11-11 23:00-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -44,23 +44,23 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:1090 +#: badwolf.c:1094 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:454 +#: badwolf.c:458 msgid "Continue" msgstr "" -#: badwolf.c:404 +#: badwolf.c:408 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:108 +#: badwolf.c:112 msgid "Crashed" msgstr "" @@ -72,31 +72,31 @@ msgstr "" msgid "Downloads" msgstr "" -#: badwolf.c:427 +#: badwolf.c:431 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:408 +#: badwolf.c:412 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:421 +#: badwolf.c:425 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:418 +#: badwolf.c:422 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:424 +#: badwolf.c:428 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:415 +#: badwolf.c:419 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:411 +#: badwolf.c:415 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" @@ -104,79 +104,79 @@ msgstr "" msgid "LRRH Downloads" msgstr "" -#: badwolf.c:996 +#: badwolf.c:1000 msgid "New tab" msgstr "" -#: badwolf.c:1145 +#: badwolf.c:1149 msgid "Open new tab" msgstr "" -#: badwolf.c:112 +#: badwolf.c:116 msgid "Out of Memory" msgstr "" -#: badwolf.c:1088 +#: badwolf.c:1092 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:1095 +#: badwolf.c:1099 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:451 +#: badwolf.c:455 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:454 +#: badwolf.c:458 msgid "Temporarily Add Exception" msgstr "" -#: badwolf.c:737 +#: badwolf.c:741 msgid "Toggle javascript" msgstr "" -#: badwolf.c:742 +#: badwolf.c:746 msgid "Toggle loading images automatically" msgstr "" -#: badwolf.c:116 +#: badwolf.c:120 msgid "Unknown Crash" msgstr "" -#: badwolf.c:740 +#: badwolf.c:744 msgid "_IMG" msgstr "" -#: badwolf.c:735 +#: badwolf.c:739 msgid "_JS" msgstr "" -#: badwolf.c:853 +#: badwolf.c:857 msgid "search in current page" msgstr "" -#: badwolf.c:107 +#: badwolf.c:111 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:111 +#: badwolf.c:115 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:115 +#: badwolf.c:119 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:1107 +#: badwolf.c:1111 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1191 +#: badwolf.c:1195 msgid "ΓΈ" msgstr ""