screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scriptable way to determine current display


From: Edward Faulkner
Subject: Scriptable way to determine current display
Date: Sun, 10 Aug 2008 15:24:31 -0400

I'm trying to find a scriptable way to determine the currently active
screen display.  I have multiple displays connected to a single screen
session, and I'd like to use the "at" command to send commands to a
particular display.

Specifically, I have a script like this:

#!/bin/bash
screen -r -X select emacs
emacsclient "$1" && screen -r -X select .

You can use it to open a file in an existing emacs process while
simultaneously switching to the "emacs" window.  Then when the file is
closed, emacsclient returns and we switch back to the window where we
started.

It works great when there's only one display connected to the session.
 But if there are multiple displays, the second screen command takes
effect on the display most recently created.  I know I can use "at" to
name a specific display, but I don't know how to determine which
display to name.

#!/bin/bash
screen -r -X select emacs
emacsclient "$1" && screen -r -X select .
CURRENT_DISPLAY=???
screen -r -X at $CURRENT_DISPLAY% select .

Any ideas?

Thanks,
Ed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]