aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-04 15:59:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-04 15:59:40 +0000
commitfcb60abc132b12ccf8fb8ff215acc924a44773d6 (patch)
tree9d68b8d95483f165521f479caba872d6a41c6d5a
parentterm: rows printed to now defaults to having a hard linebreak (diff)
config: add locked-title=no|yes
Closes #386
-rw-r--r--CHANGELOG.md5
-rw-r--r--config.c3
-rw-r--r--config.h1
-rw-r--r--doc/foot.ini.5.scd4
-rw-r--r--foot.ini4
-rw-r--r--terminal.c4
-rw-r--r--terminal.h1
7 files changed, 22 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc969826..db325da7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,11 @@
## Unreleased
### Added
+
+* `locked-title=no|yes` to `foot.ini`
+ (https://codeberg.org/dnkl/foot/issues/386).
+
+
### Changed
* Non-empty lines are now considered to have a hard linebreak,
diff --git a/config.c b/config.c
index e02ca3de..92582f2c 100644
--- a/config.c
+++ b/config.c
@@ -643,6 +643,9 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->title = xstrdup(value);
}
+ else if (strcmp(key, "locked-title") == 0)
+ conf->locked_title = str_to_bool(value);
+
else if (strcmp(key, "app-id") == 0) {
free(conf->app_id);
conf->app_id = xstrdup(value);
diff --git a/config.h b/config.h
index 2300a0ad..190ea427 100644
--- a/config.h
+++ b/config.h
@@ -77,6 +77,7 @@ struct config {
wchar_t *word_delimiters;
bool login_shell;
bool no_wait;
+ bool locked_title;
struct {
enum conf_size_type type;
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index 3ca08e84..6ceaf3b9 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -224,6 +224,10 @@ in this order:
*title*
Initial window title. Default: _foot_.
+*locked-title*
+ Boolean. If enabled, applications are not allowed to change the
+ title at run-time. Default: _no_.
+
*app-id*
Value to set the *app-id* property on the Wayland window to. The
compositor can use this value to e.g. group multiple windows, or
diff --git a/foot.ini b/foot.ini
index 8a200d4b..31167cd5 100644
--- a/foot.ini
+++ b/foot.ini
@@ -4,6 +4,10 @@
# term=foot (or xterm-256color if built with -Dterminfo=disabled)
# login-shell=no
+# app-id=foot
+# title=foot
+# locked-title=no
+
# font=monospace:size=8
# font-bold=<bold variant of regular font>
# font-italic=<italic variant of regular font>
diff --git a/terminal.c b/terminal.c
index bede6811..488ac316 100644
--- a/terminal.c
+++ b/terminal.c
@@ -2634,9 +2634,13 @@ term_xcursor_update(struct terminal *term)
void
term_set_window_title(struct terminal *term, const char *title)
{
+ if (term->conf->locked_title && term->window_title_has_been_set)
+ return;
+
free(term->window_title);
term->window_title = xstrdup(title);
render_refresh_title(term);
+ term->window_title_has_been_set = true;
}
void
diff --git a/terminal.h b/terminal.h
index 385b36e0..94c1cf75 100644
--- a/terminal.h
+++ b/terminal.h
@@ -382,6 +382,7 @@ struct terminal {
bool sixel_cursor_right_of_graphics:1;
} xtsave;
+ bool window_title_has_been_set;
char *window_title;
tll(char *) window_title_stack;