Adrian Fita | 3 Feb 12:48
Picon

Identifier matching in the at command

Hi.

I can't seem to find anything regarding the syntax for the
"identifier" from the at command. So far I discovered that
- I can match the windows that have the title begin with the same characters or
- I can match only one window by complete title or number or
- I can match all the windows.

I'm interested in matching only a list of windows (title or numbers)
or a range of numbers. Is this possible? If yes, how?

Thanks.
--
Fita Adrian
Adrian Fita | 5 Feb 19:57
Picon

Re: Identifier matching in the at command

On Fri, Feb 3, 2012 at 13:48, Adrian Fita <adrian.fita@...> wrote:
>
> [...]
>
> I'm interested in matching only a list of windows (title or numbers)
> or a range of numbers. Is this possible? If yes, how?

Seeing there doesn't seem to be an answer too soon, I poked around in
the source code at http://git.savannah.gnu.org/cgit/screen.git and I
think I found the code that parses the identifier in the "at" command.
It's located in the file process.c and begins at line no 1587. There,
at line 1605 I found the following:

if (strncmp(args[0], fore->w_title, n))
		      continue;

It seems that the title is only matched with a srtcnmp, not at all
with some regexp which would allow some advanced expressions for
matching the title. So I guess I'll have to make do with the three
matching methods I mentioned in the previous message. Am i right?

--

-- 
Fita Adrian
Artur Skonecki | 5 Feb 20:20
Picon
Gravatar

Re: Identifier matching in the at command

Just out of pure curiosity. What are you trying to accomplish?

On Sun, 5 Feb 2012, Adrian Fita wrote:

> On Fri, Feb 3, 2012 at 13:48, Adrian Fita <adrian.fita@...> wrote:
>>
>> [...]
>>
>> I'm interested in matching only a list of windows (title or numbers)
>> or a range of numbers. Is this possible? If yes, how?
>
> Seeing there doesn't seem to be an answer too soon, I poked around in
> the source code at http://git.savannah.gnu.org/cgit/screen.git and I
> think I found the code that parses the identifier in the "at" command.
> It's located in the file process.c and begins at line no 1587. There,
> at line 1605 I found the following:
>
> if (strncmp(args[0], fore->w_title, n))
> 		      continue;
>
> It seems that the title is only matched with a srtcnmp, not at all
> with some regexp which would allow some advanced expressions for
> matching the title. So I guess I'll have to make do with the three
> matching methods I mentioned in the previous message. Am i right?
Adrian Fita | 5 Feb 21:57
Picon

Re: Identifier matching in the at command

I want to send commands to a selection of open windows in screen. The
command to do that is the "at" command, but it doesn't allow a
sufficiently flexible syntax for selecting the windows to which to
send the commands. I can't match something like a list, let's say I
want to send the command to the windows numbered 1,3,4,6,10, or match
a range of numbers, ex: 3-9 or select the windows based on the titles
like "*string" (supposing you have some windows titled with "string"
at the end). The most flexible way to match the windows for now is
naming the windows with the same string in the front. Also, the
documentation is lacking in clearly describing what is the syntax of
the "identifier" parameter is.

--
Fita Adrian

On Sun, Feb 5, 2012 at 21:20, Artur Skonecki <skoneka <at> gmail.com> wrote:
> Just out of pure curiosity. What are you trying to accomplish?
>
>
>
> On Sun, 5 Feb 2012, Adrian Fita wrote:
>
>> On Fri, Feb 3, 2012 at 13:48, Adrian Fita <adrian.fita <at> gmail.com> wrote:
>>>
>>>
>>> [...]
>>>
>>> I'm interested in matching only a list of windows (title or numbers)
>>> or a range of numbers. Is this possible? If yes, how?
>>
(Continue reading)

Artur Skonecki | 5 Feb 22:44
Picon
Gravatar

Re: Identifier matching in the at command

The development version of GNU Screen has -Q flag which may be used
to query results of some commands.  Also there is -X flag for sending
arbitrary commands to a session, e.g. "screen -p 1 -Q title" will yield
the title of window 1.  Unfortunately, sending commands to every window
separately is much slower than using "at" command.

<shameless auto-promotion>
If you are willing to compile Screen on your own you might as well
install screen-session https://github.com/skoneka/screen-session/downloads
and grep "screen-session dump" output for window titles.
</shameless auto-promotion>

On Sun, 5 Feb 2012, Adrian Fita wrote:

> I want to send commands to a selection of open windows in screen. The
> command to do that is the "at" command, but it doesn't allow a
> sufficiently flexible syntax for selecting the windows to which to
> send the commands. I can't match something like a list, let's say I
> want to send the command to the windows numbered 1,3,4,6,10, or match
> a range of numbers, ex: 3-9 or select the windows based on the titles
> like "*string" (supposing you have some windows titled with "string"
> at the end). The most flexible way to match the windows for now is
> naming the windows with the same string in the front. Also, the
> documentation is lacking in clearly describing what is the syntax of
> the "identifier" parameter is.

Gmane