Recently, more and more GUI applications (okular and inkscape, among others) started disabling terminal echo while they are active. This seems unnecessary at best (if you don't background the process, you wouldn't type in it anyway and if you did, who cares? And if you background it, it has no effect anyway). But what is worse is, that if you happen to do something wrong and instinctively kill it with ctrl-C (I do that if I accidentally call okular on many files, for instance), the echo stays disabled. It's not the end of the world, but needing to blindly type stty echo every time this happens is making me nervous.

Is there a way to tell the terminal to disable toggling these settings? I think it might be possible to modify the termcap but that's where my knowledge about it ends. Of course, this probably makes invisible password visible but I want to know how to do it anyway, having one tamper-proof terminal open would be enough.


echo is a setting of the terminal device (the discipline part in the tty kernel driver), termcap is about controlling the terminal (real or emulator) via escape sequences, it's two separate things.

Here you want to prevent the application to do a specific ioctl. One way could be by detaching it from the terminal.

socat - exec:okular,pty,raw

Would run okular attached to a different pseudo-terminal device and socat would pass along data from your terminal to that one.

To pass arbitrary arguments, with zsh, bash or ksh93:

okular() {
  CODE=$(printf '%q ' exec okular "$@"
        ) socat - 'system:"eval \"$CODE\"",pty,raw'

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.