Commit 90d5801f authored by Victor Ananjesky's avatar Victor Ananjesky

understand %s in the command for dnd dialog

parent 4e72219f
......@@ -292,7 +292,7 @@ In RGBA mode opacity have values from 0.0 to 1.0.
Use dialog text as a tooltip for Drag-and-Drop box.
.TP
.B \-\-command=\fICMD\fP
Run command when data received. Data strings pass to command as an argument.
Run command when data received. Data strings pass to command as an argument or replace \fI%s\fP modifier in a command.
By default data just prints to stdout.
.TP
.B \-\-exit-on-drop=\fINUMBER\fP
......
......@@ -44,7 +44,12 @@ drop_data_cb (GtkWidget * w, GdkDragContext * dc, gint x, gint y,
gchar *dstr = g_uri_unescape_string (uris[i], NULL);
if (options.common_data.command)
{
gchar *action = g_strdup_printf ("%s '%s'", options.common_data.command, dstr);
gchar *action;
if (g_strstr_len (options.common_data.command, -1, "%s"))
action = g_strdup_printf (options.common_data.command, dstr);
else
action = g_strdup_printf ("%s '%s'", options.common_data.command, dstr);
g_spawn_command_line_async (action, NULL);
g_free (action);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment