summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-25 20:37:37 +0200
committerwm4 <wm4@nowhere>2020-05-25 20:39:37 +0200
commitb1d16a2300c99fd6bf847b6b3374280f9aafa87d (patch)
tree8fcddcfbd8a03f25d462a437fd32edd5b610a4ab /player/osd.c
parentb83bdd1d17cc90b4d8cd2a32321cd7c5cc306422 (diff)
downloadmpv-b1d16a2300c99fd6bf847b6b3374280f9aafa87d.tar.bz2
mpv-b1d16a2300c99fd6bf847b6b3374280f9aafa87d.tar.xz
player: add --term-title option
This simply printf()s a concatenation of the provided string and the relevant escape sequences. No idea what exactly defines this escape sequence (is it just a xterm thing that is now supported relatively widely?), and this simply uses information provided on the linked github issue. Not much of an advantage over --term-status-msg, though at least this can have a lower update frequency. Also I may consider setting a default value, and then it shouldn't conflict with the status message. Fixes: #1725
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/player/osd.c b/player/osd.c
index 0e8fd2a0e7..5bf7fa699b 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -96,6 +96,21 @@ static void term_osd_update(struct MPContext *mpctx)
}
}
+static void term_osd_update_title(struct MPContext *mpctx)
+{
+ if (!mpctx->opts->use_terminal)
+ return;
+
+ char *s = mp_property_expand_escaped_string(mpctx, mpctx->opts->term_title);
+ if (bstr_equals(bstr0(s), bstr0(mpctx->term_osd_title))) {
+ talloc_free(s);
+ return;
+ }
+
+ mp_msg_set_term_title(mpctx->statusline, s);
+ mpctx->term_osd_title = talloc_steal(mpctx, s);
+}
+
void term_osd_set_subs(struct MPContext *mpctx, const char *text)
{
if (mpctx->video_out || !text || !mpctx->opts->subs_rend->sub_visibility)
@@ -260,6 +275,7 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
+ term_osd_update_title(mpctx);
update_window_title(mpctx, false);
update_vo_playback_state(mpctx);