[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] dtas-console: set X11 terminal title iff DISPLAY is set
From: |
Eric Wong |
Subject: |
[PATCH 3/4] dtas-console: set X11 terminal title iff DISPLAY is set |
Date: |
Fri, 7 Jan 2022 05:35:43 +0000 |
This allows users running terminals in graphical environments to
navigate to the terminal running dtas-console more easily.
---
bin/dtas-console | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bin/dtas-console b/bin/dtas-console
index 0c56450..6172863 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-# Copyright (C) 2013-2021 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
#
@@ -26,6 +26,7 @@
c = DTAS::UNIXClient.new
cur = YAML.load(c.req('current'))
readable = [ se, w, $stdin ]
+set_title = ENV['DISPLAY'] ? $stdout : nil
# current rg mode
rg_mode = DTAS::RGState::RG_MODE.keys.unshift("off")
@@ -167,6 +168,10 @@ def may_fail(c, req, events)
# and risk mojibake...
infile.encode(enc_locale,
undef: :replace, invalid: :replace, replace: '?')
+ if set_title
+ dir, base = File.split(infile)
+ set_title.syswrite("\033]0;#{base} dtas-console\07")
+ end
Curses.setpos(lineno += 1, 0)
Curses.clrtoeol
Curses.addstr(infile)
[PATCH 4/4] dtas-console: add 'i' toggle to show comments (metadata), Eric Wong, 2022/01/07
[PATCH 5/4] splitfx: fix track_zpad with integer arg, Eric Wong, 2022/01/07
[PATCH 6/4] doc: drop ordered map from examples, Eric Wong, 2022/01/07