Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

She sells cshs by the cshore.


devel / comp.unix.shell / Re: Get terminal/window title

SubjectAuthor
* Re: Get terminal/window titleJanis Papanagnou
`* Re: Get terminal/window titleSpiros Bousbouras
 +* Re: Get terminal/window titleJanis Papanagnou
 |+- Re: Get terminal/window titleSpiros Bousbouras
 |`- Re: Get terminal/window titleJanis Papanagnou
 `- Re: Get terminal/window titleJanis Papanagnou

1
Re: Get terminal/window title

<s6idd0$duj$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3715&group=comp.unix.shell#3715

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Date: Sat, 1 May 2021 04:11:44 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 31
Message-ID: <s6idd0$duj$1@news-1.m-online.net>
References: <s5la58$2ok$1@news-1.m-online.net>
<s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
NNTP-Posting-Host: 2001:a61:252a:da01:a5a8:531d:4a78:a3e8
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1619835104 14291 2001:a61:252a:da01:a5a8:531d:4a78:a3e8 (1 May 2021 02:11:44 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sat, 1 May 2021 02:11:44 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <s5mcnb$c92$1@news-1.m-online.net>
 by: Janis Papanagnou - Sat, 1 May 2021 02:11 UTC

On 20.04.2021 13:08, Janis Papanagnou wrote:
> On 20.04.2021 07:18, Kenny McCormack wrote:
>> In article <s5la58$2ok$1@news-1.m-online.net>,
>> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>>>
>>> Is there an equally simple way to _interrogate_ the window title by
>>> a shell command?
>>
>> xdotool getactivewindow getwindowname
>>
>> should do it (at least as long as the calling window is the active window.
>
> I'll try incorporating that tool. Thanks!

In a specific scenario I noticed a corrupting effect when using this
code

xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"

in a shell function in .kshrc that is triggered by a trap on EXIT.

When I use a shell escape from some programs that allow that (often by
using a '!' as escape command), like vim or nethack (ksh->nethack->ksh),
then an exit from the innermost shell instance will hang (in case of an
escape from nethack) or corrupt the I/O (in case of an escape from vim).
What could be the reason for that effect?

(What works fine is a plain shell instance nesting, ksh->ksh->ksh.)

Janis

Re: Get terminal/window title

<nethackvim@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3716&group=comp.unix.shell#3716

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx17.ams4.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Message-ID: <nethackvim@bongo-ra.co>
References: <s5la58$2ok$1@news-1.m-online.net> <s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
<s6idd0$duj$1@news-1.m-online.net>
In-Reply-To: <s6idd0$duj$1@news-1.m-online.net>
X-Organisation: Weyland-Yutani
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Lines: 33
X-Complaints-To: http://netreport.virginmedia.com
NNTP-Posting-Date: Sat, 01 May 2021 07:19:48 UTC
Organization: virginmedia.com
Date: Sat, 01 May 2021 07:19:48 GMT
X-Received-Bytes: 1868
 by: Spiros Bousbouras - Sat, 1 May 2021 07:19 UTC

On Sat, 1 May 2021 04:11:44 +0200
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> In a specific scenario I noticed a corrupting effect when using this
> code
>
> xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
>
> in a shell function in .kshrc that is triggered by a trap on EXIT.
>
> When I use a shell escape from some programs that allow that (often by
> using a '!' as escape command), like vim or nethack (ksh->nethack->ksh),
> then an exit from the innermost shell instance will hang (in case of an
> escape from nethack)

Is it the inner ksh which hangs or nethack ? Does file
"${HOME}/.sh_title_${TTYNR}" get written ?

> or corrupt the I/O (in case of an escape from vim).
> What could be the reason for that effect?

What does "corrupt the I/O" mean ?

> (What works fine is a plain shell instance nesting, ksh->ksh->ksh.)

In both situations what happens if the xdotool ... command is not part
of a trap ? For example what happens if from nethack or vim you call
something like

#!/usr/bin/ksh

xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"

?

Re: Get terminal/window title

<s6j137$jcr$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3717&group=comp.unix.shell#3717

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Date: Sat, 1 May 2021 09:47:51 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 48
Message-ID: <s6j137$jcr$1@news-1.m-online.net>
References: <s5la58$2ok$1@news-1.m-online.net>
<s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
<s6idd0$duj$1@news-1.m-online.net> <nethackvim@bongo-ra.co>
NNTP-Posting-Host: 2001:a61:252a:da01:a5d8:2cca:3335:dfa8
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1619855271 19867 2001:a61:252a:da01:a5d8:2cca:3335:dfa8 (1 May 2021 07:47:51 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sat, 1 May 2021 07:47:51 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <nethackvim@bongo-ra.co>
 by: Janis Papanagnou - Sat, 1 May 2021 07:47 UTC

On 01.05.2021 09:19, Spiros Bousbouras wrote:
> On Sat, 1 May 2021 04:11:44 +0200
> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>> In a specific scenario I noticed a corrupting effect when using this
>> code
>>
>> xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
>>
>> in a shell function in .kshrc that is triggered by a trap on EXIT.
>>
>> When I use a shell escape from some programs that allow that (often by
>> using a '!' as escape command), like vim or nethack (ksh->nethack->ksh),
>> then an exit from the innermost shell instance will hang (in case of an
>> escape from nethack)
>
> Is it the inner ksh which hangs or nethack ? Does file
> "${HOME}/.sh_title_${TTYNR}" get written ?

(I'll reinstall the code and check that.)

>> or corrupt the I/O (in case of an escape from vim).
>> What could be the reason for that effect?
>
> What does "corrupt the I/O" mean ?

On returning from the '!'-shell session back into vim I cannot edit the
file any more. Every keystroke creates sequences of control characters
(bold-face light blue codes) it seems. It is still possible to type :q!
and leave vim (but I don't see the typed characters but something else).

>> (What works fine is a plain shell instance nesting, ksh->ksh->ksh.)
>
> In both situations what happens if the xdotool ... command is not part
> of a trap ? For example what happens if from nethack or vim you call
> something like
>
> #!/usr/bin/ksh
>
> xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
>
> ?

I'm not sure what you suggest here. Do you mean to invoke that call
using the '!cmd' mechanism, or to create an executable shebang file
and call that from within the tools? (I'll try the latter.)

Janis

Re: Get terminal/window title

<oCjikCOw7yhX3Sml@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3718&group=comp.unix.shell#3718

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer04.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx46.ams4.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Message-ID: <oCjikCOw7yhX3Sml@bongo-ra.co>
References: <s5la58$2ok$1@news-1.m-online.net> <s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
<s6idd0$duj$1@news-1.m-online.net> <nethackvim@bongo-ra.co> <s6j137$jcr$1@news-1.m-online.net>
In-Reply-To: <s6j137$jcr$1@news-1.m-online.net>
X-Organisation: Weyland-Yutani
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Lines: 60
X-Complaints-To: http://netreport.virginmedia.com
NNTP-Posting-Date: Sat, 01 May 2021 07:58:40 UTC
Organization: virginmedia.com
Date: Sat, 01 May 2021 07:58:40 GMT
X-Received-Bytes: 3381
 by: Spiros Bousbouras - Sat, 1 May 2021 07:58 UTC

On Sat, 1 May 2021 09:47:51 +0200
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> On 01.05.2021 09:19, Spiros Bousbouras wrote:
> > On Sat, 1 May 2021 04:11:44 +0200
> > Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> >> In a specific scenario I noticed a corrupting effect when using this
> >> code
> >>
> >> xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
> >>
> >> in a shell function in .kshrc that is triggered by a trap on EXIT.
> >>
> >> When I use a shell escape from some programs that allow that (often by
> >> using a '!' as escape command), like vim or nethack (ksh->nethack->ksh),
> >> then an exit from the innermost shell instance will hang (in case of an
> >> escape from nethack)
> >
> > Is it the inner ksh which hangs or nethack ? Does file
> > "${HOME}/.sh_title_${TTYNR}" get written ?
>
> (I'll reinstall the code and check that.)
>
> >> or corrupt the I/O (in case of an escape from vim).
> >> What could be the reason for that effect?
> >
> > What does "corrupt the I/O" mean ?
>
> On returning from the '!'-shell session back into vim I cannot edit the
> file any more. Every keystroke creates sequences of control characters
> (bold-face light blue codes) it seems. It is still possible to type :q!
> and leave vim (but I don't see the typed characters but something else).

Does vim run on a terminal emulator ? If yes then likely what is happening
is that the ksh instance you invoke from within vim somehow changes the
settings of the terminal driver and vim doesn't know about it. Try running
a graphical vim (i.e. one which opens its own X Windows window) and invoke
ksh from that.

> >> (What works fine is a plain shell instance nesting, ksh->ksh->ksh.)
> >
> > In both situations what happens if the xdotool ... command is not part
> > of a trap ? For example what happens if from nethack or vim you call
> > something like
> >
> > #!/usr/bin/ksh
> >
> > xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
> >
> > ?
>
> I'm not sure what you suggest here. Do you mean to invoke that call
> using the '!cmd' mechanism, or to create an executable shebang file
> and call that from within the tools? (I'll try the latter.)

I meant create an executable , say /pahtname/test , with content

#!/usr/bin/ksh
xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"

and from within vim or nethack do !/pahtname/test .

Re: Get terminal/window title

<s6j9tp$lse$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3719&group=comp.unix.shell#3719

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Date: Sat, 1 May 2021 12:18:33 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 11
Message-ID: <s6j9tp$lse$1@news-1.m-online.net>
References: <s5la58$2ok$1@news-1.m-online.net>
<s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
<s6idd0$duj$1@news-1.m-online.net> <nethackvim@bongo-ra.co>
<s6j137$jcr$1@news-1.m-online.net>
NNTP-Posting-Host: 2001:a61:252a:da01:a5d8:2cca:3335:dfa8
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1619864313 22414 2001:a61:252a:da01:a5d8:2cca:3335:dfa8 (1 May 2021 10:18:33 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sat, 1 May 2021 10:18:33 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <s6j137$jcr$1@news-1.m-online.net>
 by: Janis Papanagnou - Sat, 1 May 2021 10:18 UTC

> On 01.05.2021 09:19, Spiros Bousbouras wrote:
>> On Sat, 1 May 2021 04:11:44 +0200
>>
>> Is it the inner ksh which hangs or nethack ? [...]

I haven't yet checked it, but I just recalled that the shell
had consumed significantly more CPU% than to be expected, so
I suppose it was the shell that hung.

Janis

Re: Get terminal/window title

<s6lteb$e16$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3720&group=comp.unix.shell#3720

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Get terminal/window title
Date: Sun, 2 May 2021 12:03:55 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 31
Message-ID: <s6lteb$e16$1@news-1.m-online.net>
References: <s5la58$2ok$1@news-1.m-online.net>
<s5lo7g$1bch6$1@news.xmission.com> <s5mcnb$c92$1@news-1.m-online.net>
<s6idd0$duj$1@news-1.m-online.net> <nethackvim@bongo-ra.co>
NNTP-Posting-Host: 2001:a61:252a:da01:c2d:f113:9c7:233e
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1619949835 14374 2001:a61:252a:da01:c2d:f113:9c7:233e (2 May 2021 10:03:55 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sun, 2 May 2021 10:03:55 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <nethackvim@bongo-ra.co>
 by: Janis Papanagnou - Sun, 2 May 2021 10:03 UTC

On 01.05.2021 09:19, Spiros Bousbouras wrote:
>
> In both situations what happens if the xdotool ... command is not part
> of a trap ? For example what happens if from nethack or vim you call
> something like
>
> #!/usr/bin/ksh
>
> xdotool getactivewindow getwindowname >"${HOME}/.sh_title_${TTYNR}"
>
> ?

From vim I can call that command in a file abc by :r!abc or by :!abc
without issues, a .sh_title_x file will be written. From nethack I can
only start a shell instance by the !-command and can then call that abc
executable script without issues. No side effects with both cases.

So I suppose the issue is something odd with the .kshrc contents

function save_terminal_context
{
pwd > "${HOME}/.sh_pwdstat_${TTYNR}"
# xdotool getactivewindow getwindowname > "${HOME}/.sh_title_${TTYNR}"
}

trap 'save_terminal_context' EXIT

Janis

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor