/* add current url if requested */
if (VP_INPUT_CURRENT_URI == arg->i
- && (url = webkit_web_view_get_uri(vp.gui.webview))
+ && (url = CURRENT_URL())
) {
/* append the current url to the input message */
gchar* input = g_strconcat(arg->s, url, NULL);
return TRUE;
}
+gboolean command_yank(const Arg* arg)
+{
+ const gchar* uri = CURRENT_URL();
+ if (!uri) {
+ return TRUE;
+ }
+
+ vp_set_clipboard(uri, arg->i);
+
+ return TRUE;
+}
+
static void command_write_input(const gchar* str)
{
gint pos = 0;
static void vp_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec, gpointer user_data)
{
Gui* gui = &vp.gui;
- const char* uri = webkit_web_view_get_uri(gui->webview);
+ const char* uri = CURRENT_URL();
switch (webkit_web_view_get_load_status(gui->webview)) {
case WEBKIT_LOAD_PROVISIONAL:
GtkWidget* window;
GtkWidget* view;
- title = g_strdup_printf("Inspect page - %s", webkit_web_view_get_uri(web_view));
+ title = g_strdup_printf("Inspect page - %s", CURRENT_URL());
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass(GTK_WINDOW(window), PROJECT, PROJECT);
gtk_window_set_title(GTK_WINDOW(window), title);
#define CLEAN_MODE(mode) ((mode) & ~(VP_MODE_COMPLETE))
#define GET_CLEAN_MODE() (CLEAN_MODE(vp.state.mode))
#define CLEAR_INPUT() (vp_echo(VP_MSG_NORMAL, ""))
+#define CURRENT_URL() webkit_web_view_get_uri(vp.gui.webview)
#define IS_ESCAPE_KEY(k, s) ((k == GDK_Escape && s == 0) || (k == GDK_c && s == GDK_CONTROL_MASK))
#define CLEAN_STATE_WITH_SHIFT(e) ((e)->state & (GDK_MOD1_MASK|GDK_MOD4_MASK|GDK_SHIFT_MASK|GDK_CONTROL_MASK))