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

Re: recognizing an xterm running only bash from the CLI



Mike McClain wrote: 
> On Sun, Aug 10, 2025 at 11:28:08PM -0400, Greg Wooledge wrote:
> <snip>
> > I'm having trouble understanding what you're saying here.  When you
> > say "copy my entry", does that mean you want to type stuff on one
> > terminal, and have it appear on the other terminal?
> 
> Sorry I wasn't clear, I'll try again.
> I've defined to9 () { echo "$1" > /dev/tty9 } to be used from an xterm.
> I'd like to have a similar function toX() to be used on a virtual
> terminal that would print some text on the xterm running only bash
> but that xterm varies which /dev/pts/? it's running on and so far
> I've not found a way without manually going into X and entering 'tty'
> on that xterm to find out which /dev/pts to direct an echo to.
> If I can learn how to determine which /dev/pts/? is running only bash
> and not mc or something else then I can write toX() to just work.

Is your actual question, then:

How can I use a command line command to write something
semi-ephemeral to something displaying in X?

Options that come to mind:
	- lsof /dev/pts/*
		(if you have to go down this path: create a symlink of
bash named specialbash, and only run specialbash in the terminal
you want to look for.)

	- use a notifications demon (e.g. xfce4-notifyd)

	- write to a file you control, and run tail -f filename in
your selected xterm


The last two are probably closest to a sane approach.

-dsr-


Reply to: