From: aeghn <aeghn@outlook.com>
Hello, I think it's better if we could set window title when we start
it, it is more flexible than only set it in the config file.
So, I add an option `-w <window_title>' to set it.
Sorry for the incorrect format of my previous patch email.
---
doc/imv.1.txt | 3 +++
src/imv.c | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/imv.1.txt b/doc/imv.1.txt
index 37d60c0..e06c179 100644
--- a/doc/imv.1.txt
+++ b/doc/imv.1.txt
@@ -70,6 +70,9 @@ Options
*-u* <linear|nearest_neighbour>::
Set upscaling method used by imv.
+*-w* <windowtitle>::
+ Set window title when starting imv.
+
*-x*::
Disable looping of input paths.
diff --git a/src/imv.c b/src/imv.c
index c56a1ca..8380a12 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -731,6 +731,17 @@ static bool parse_upscaling_method(struct imv *imv, const char *method)
return false;
}
+static bool parse_window_title(struct imv *imv, const char *name)
+{
+ if (strcmp(name, "")) {
+ free(imv->title_text);
+ imv->title_text = strdup(name);
+ return true;
+ }
+
+ return false;
+}
+
static bool parse_initial_pan(struct imv *imv, const char *pan_params)
{
char *next_val;
@@ -823,7 +834,7 @@ bool imv_parse_args(struct imv *imv, int argc, char **argv)
int o;
/* TODO getopt_long */
- while ((o = getopt(argc, argv, "frdxhvlu:s:n:b:t:c:")) != -1) {
+ while ((o = getopt(argc, argv, "frdxhvlu:s:n:b:t:c:w:")) != -1) {
switch(o) {
case 'f': imv->start_fullscreen = true; break;
case 'r': imv->recursive_load = true; break;
@@ -864,6 +875,7 @@ bool imv_parse_args(struct imv *imv, int argc, char **argv)
}
break;
case 'c': list_append(imv->startup_commands, optarg); break;
+ case 'w': parse_window_title(imv, optarg); break;
case '?':
imv_log(IMV_ERROR, "Unknown argument '%c'. Aborting.\n", optopt);
return false;
--
2.34.1