0

I'm trying to embed xterm in a PyQt application window for tailing a log file. However, I want to block keyboard input from the user in the embedded terminal, so that they don't, for example, press CTRL-C or CTRL-D, and kill the process.

I'm able to embed the terminal just fine. Is there a setting for xterm or PyQt that can be used to block user input? I want this to be a read-only terminal, that just displays the content of the log file.

I've searched the manpage for xterm, and haven't found anything.

orodbhen
  • 2,644
  • 3
  • 20
  • 29

1 Answers1

1

The way to approach this would be to construct a transparent (actually "uncolored") window which overlays the embedded xterm window.

There is an example described in Basic X Window keyboard and mouse input blocking which is essentially a screensaver written in Python. For lower-level (X documentation) on window properties, the links in How to prevent an X Window from receiving user input? may be useful to you.

The main problems to solve would be (in your program) how to ensure that the overlaid window comes on top, and of course how to keep it transparent (since that diverges from the example). The latter is more complicated:

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Funny, I'd actually commented to a colleague that what we needed was an "impenetrable piece of glass" widget to put over the terminal. It didn't occur to me that it actually exists, but it makes sense now that you've explained it. Unfortunately, the idea of using embedded xterm was for the simplicity, and this seems pretty complicated. I opted instead to embed another Qt window running in a separate process. But I look forward to trying this solution out when I get the time. Thanks. – orodbhen Sep 14 '15 at 18:53