From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 03B791F953 for ; Fri, 7 Jan 2022 05:36:11 +0000 (UTC) Received: from localhost ([::1]:50326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5hv8-0000lB-5n for e@80x24.org; Fri, 07 Jan 2022 00:36:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5hv6-0000km-7O for dtas-all@nongnu.org; Fri, 07 Jan 2022 00:36:08 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:50308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5hv4-0004NB-HX for dtas-all@nongnu.org; Fri, 07 Jan 2022 00:36:07 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 604AF1FA01 for ; Fri, 7 Jan 2022 05:35:44 +0000 (UTC) From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH 3/4] dtas-console: set X11 terminal title iff DISPLAY is set Date: Fri, 7 Jan 2022 05:35:43 +0000 Message-Id: <20220107053544.31240-4-e@80x24.org> In-Reply-To: <20220107053544.31240-1-e@80x24.org> References: <20220107053544.31240-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=64.71.152.64; envelope-from=e@80x24.org; helo=dcvr.yhbt.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" 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 +# Copyright (C) all contributors # License: GPL-3.0+ # 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)