gboolean downloadmanager_delete(GtkWidget *, gpointer);
void downloadmanager_setup(void);
gchar *ensure_uri_scheme(const gchar *);
-void external_handler_run(GSimpleAction *, GVariant *, gpointer);
void grab_environment_configuration(void);
void grab_feeds_finished(GObject *, GAsyncResult *, gpointer);
void hover_web_view(WebKitWebView *, WebKitHitTestResult *, guint, gpointer);
gboolean key_tablabel(GtkWidget *, GdkEvent *, gpointer);
gboolean key_web_view(GtkWidget *, GdkEvent *, gpointer);
void mainwindow_setup(void);
-gboolean menu_web_view(WebKitWebView *, WebKitContextMenu *, GdkEvent *,
- WebKitHitTestResult *, gpointer);
gboolean quit_if_nothing_active(void);
gboolean remote_msg(GIOChannel *, GIOCondition, gpointer);
void run_user_scripts(WebKitWebView *);
G_CALLBACK(changed_load_progress), c);
g_signal_connect(G_OBJECT(c->web_view), "create",
G_CALLBACK(client_new_request), NULL);
- g_signal_connect(G_OBJECT(c->web_view), "context-menu",
- G_CALLBACK(menu_web_view), c);
g_signal_connect(G_OBJECT(c->web_view), "close",
G_CALLBACK(client_destroy), c);
g_signal_connect(G_OBJECT(c->web_view), "decide-policy",
return g_strdup(t);
}
-void
-external_handler_run(GSimpleAction *simple, GVariant *param, gpointer data)
-{
- struct Client *c = (struct Client *)data;
- gchar *argv[] = { "lariza-external-handler", "-u", NULL, NULL };
- GPid pid;
- GError *err = NULL;
-
- (void)simple;
- (void)param;
-
- argv[2] = c->external_handler_uri;
- if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
- &pid, &err))
- {
- fprintf(stderr, __NAME__": Could not launch key handler: %s\n",
- err->message);
- g_error_free(err);
- }
- else
- g_spawn_close_pid(pid);
-}
-
void
grab_environment_configuration(void)
{
case GDK_KEY_c: /* reload trusted certs (left hand) */
trust_user_certs(wc);
return TRUE;
- case GDK_KEY_x: /* launch external handler (left hand) */
- if (c->external_handler_uri != NULL)
- g_free(c->external_handler_uri);
- c->external_handler_uri = g_strdup(
- webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)));
- external_handler_run(NULL, NULL, c);
- return TRUE;
case GDK_KEY_a: /* go one tab to the left (left hand) */
gtk_notebook_prev_page(GTK_NOTEBOOK(mw.notebook));
return TRUE;
gtk_container_add(GTK_CONTAINER(mw.win), mw.notebook);
}
-gboolean
-menu_web_view(WebKitWebView *web_view, WebKitContextMenu *menu, GdkEvent *ev,
- WebKitHitTestResult *ht, gpointer data)
-{
- struct Client *c = (struct Client *)data;
- GSimpleAction *action = NULL;
- WebKitContextMenuItem *mi = NULL;
- const gchar *uri = NULL;
-
- (void)ev;
-
- if (webkit_hit_test_result_context_is_link(ht))
- uri = webkit_hit_test_result_get_link_uri(ht);
- else if (webkit_hit_test_result_context_is_image(ht))
- uri = webkit_hit_test_result_get_image_uri(ht);
- else if (webkit_hit_test_result_context_is_media(ht))
- uri = webkit_hit_test_result_get_media_uri(ht);
-
- if (uri != NULL)
- {
- webkit_context_menu_append(menu, webkit_context_menu_item_new_separator());
-
- if (c->external_handler_uri != NULL)
- g_free(c->external_handler_uri);
- c->external_handler_uri = g_strdup(uri);
- action = g_simple_action_new("external_handler", NULL);
- g_signal_connect(G_OBJECT(action), "activate",
- G_CALLBACK(external_handler_run), data);
- mi = webkit_context_menu_item_new_from_gaction(G_ACTION(action),
- "Open with external handler",
- NULL);
- webkit_context_menu_append(menu, mi);
- g_object_unref(action);
- }
-
- /* FALSE = Show the menu. (TRUE = Don't ever show it.) */
- return FALSE;
-}
-
gboolean
quit_if_nothing_active(void)
{
-.TH lariza 1 "2020-04-28" "lariza" "User Commands"
+.TH lariza 1 "2020-04-29" "lariza" "User Commands"
.\" --------------------------------------------------------------------
.SH NAME
lariza.usage \- extended usage hints
These hotkeys work when either the location bar or the web view is being
focused.
.TP
-\fBMod1\fP + \fBx\fP
-Launch the external handler for the currently loaded URI.
-.TP
\fBMod1\fP + \fBq\fP
Close the current window. Quits the entire program if this was the last
window and if there are no more active downloads (download manager is
\fBmake\fP and installed on \fBmake install\fP. To use them, though,
make sure to link them to the directory mentioned above.
.\" --------------------------------------------------------------------
-.SH "EXTERNAL URI HANDLER"
-\fBlariza\fP can launch an executable called
-\fIlariza-external-handler\fP. It will be passed the \(lqselected\(rq
-URI as a command line argument:
-.P
-\f(CW
-.nf
-$ lariza-external-handler -u https://github.com
-.fi
-\fP
-.P
-This executable must be a user-supplied program. It can do anything it
-wants to with that URI. \fBlariza\fP ignores the exit code of the
-handler.
-.P
-The \fB\-u\fP will always be set. This allows you to use \fBgetopt\fP(1)
-like parameter parsing in your program.
-.P
-You can either use the appropriate hotkey (see list above) to launch the
-handler with the currently loaded URI, or you can perform a right click
-on any link, image or media file to use that URI.
-.P
-This mechanism allows you to implement a variety of functions. You might
-want to implement a bookmarking script or a password manager or you
-might simply load the current URI in a different browser. That's up to
-you.
-.\" --------------------------------------------------------------------
.SH "TRUSTED CERTIFICATES"
By default, \fBlariza\fP trusts whatever CAs are trusted by WebKit, i.e.
by your GnuTLS installation. If you wish to trust additional