Commit 7b9ec512 authored by Victor Ananjevsky's avatar Victor Ananjevsky

add --workdir option

parent 4af907f5
......@@ -183,6 +183,9 @@ Use \fICMD\fP as uri handler. By default yad uses \fIopen-command\fP parameter f
.B \-\-f1-action=\fICMD\fP
Set the command running when F1 was pressed.
.TP
.B \-\-workdir=\fiPATH\fP
Set current working directory to \fIPATH\fP.
.TP
.B \-\-borders=\fINUM\fP
Set dialog window borders.
.TP
......
......@@ -780,6 +780,14 @@ main (gint argc, gchar ** argv)
}
yad_set_mode ();
/* set working directory */
if (options.data.workdir)
{
if (g_chdir (options.data.workdir) != 0)
g_printerr (_("Unable to change directory to %s: %s\n"),
options.data.workdir, strerror (errno));
}
/* check for current GDK backend */
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
......
......@@ -147,6 +147,8 @@ static GOptionEntry general_options[] = {
N_("Set URI handler"), N_("CMD") },
{ "f1-action", 0, 0, G_OPTION_ARG_STRING, &options.data.f1_action,
N_("Set command running when F1 was pressed"), N_("CMD") },
{ "workdir", 0, 0, G_OPTION_ARG_STRING, &options.data.workdir,
N_("Set working directory"), N_("PATH") },
/* window settings */
{ "sticky", 0, 0, G_OPTION_ARG_NONE, &options.data.sticky,
N_("Set window sticky"), NULL },
......@@ -1632,6 +1634,7 @@ yad_options_init (void)
options.data.uri_handler = OPEN_CMD;
#endif
options.data.f1_action = NULL;
options.data.workdir = NULL;
/* Initialize window options */
options.data.sticky = FALSE;
......
......@@ -257,6 +257,7 @@ typedef struct {
gchar *interp;
gchar *uri_handler;
gchar *f1_action;
gchar *workdir;
/* window settings */
gboolean sticky;
gboolean fixed;
......
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