BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Locating specific terminal windows by pty number?
- Subject: [Discuss] Locating specific terminal windows by pty number?
- From: dsr at randomstring.org (Dan Ritter)
- Date: Mon, 8 Jan 2024 19:40:29 -0500
- In-reply-to: <CAFv2jcbh69R7uCG_yTyG4o6v7Cazs49o8JuT2gGfbvY789AyFg@mail.gmail.com>
- References: <CAFv2jcbh69R7uCG_yTyG4o6v7Cazs49o8JuT2gGfbvY789AyFg@mail.gmail.com>
John Abreau wrote: > I usuallyto have many terminal windows open at a time, with most windows > having multiple tabs. > > Every once in a while I go to edit a file in nvi, only to discover it's > already locked by another instance of nvi. > > I can find the other instance with "ps x | grep [n]vi", and find its pty id > (pty/34), but it would take an inordinate amount of time to dig through all > the open terminals and tabs to locate it. > > Given the pty number and/or the process id, is there a way to quickly > locate the offending window and raise it to the foreground? Preferably from > the command line? >From a command line which can access the X display, xwininfo -root -tree -wm should produce a large list of windows and their properties. One of these properties is _NET_WM_PID, which is the pid of the owner of the window. Another property is the Window ID. Now it's a simple matter* of looking backwards from the PID to the Window ID and run xdotool windowfocus $XWINDOW_ID to get it focus. Whether or not focus implies raising it is a matter for your window manager, but it probably does. wmctrl or https://pypi.org/project/ruamel.ewmh/ might help out, too. -dsr- * I have not tried this.
- References:
- [Discuss] Locating specific terminal windows by pty number?
- From: abreauj at gmail.com (John Abreau)
- [Discuss] Locating specific terminal windows by pty number?
- Prev by Date: [Discuss] Locating specific terminal windows by pty number?
- Next by Date: [Discuss] Locating specific terminal windows by pty number?
- Previous by thread: [Discuss] Locating specific terminal windows by pty number?
- Next by thread: [Discuss] Locating specific terminal windows by pty number?
- Index(es):