3

I'm trying to ensure that the flow control, xon-xoff, Control-S Control-Q feature is turned off in all of my terminals/shells/tmux (so that I can reliably use Control-S for something else) It should work in X, urxvt, tmux, on consoles, ssh, ... everywhere.

In which dotfile should the configuration go? What should it be? My best guess:

# check xon/xoff settings
# stty -a | egrep -o -- '-?\<(ix\w*|start|stop)'

if [ -t 0 ]; then # term test?
    # Turn off TTY "start" and "stop" commands in all interactive shells.
    # They default to C-q and C-s, Bash uses C-s to do a forward history search.
    stty start ''
    stty stop  ''
    stty -ixon # disable XON/XOFF flow control
    stty ixoff # enable sending (to app) of start/stop characters
    stty ixany # let any character restart output, not only start character
fi

The examples I've found on my machine use .bash_profile, but that doesn't seem to catch my non-login shells. On the other hand, putting stty calls in .bashrc assumes there's a terminal, should I just test for a terminal ( if [ -t o ] ) or check $PS1?

Perhaps there's a better way to configure my terminal than "stty"? Perhaps I should make all bash instances login shells?

stty is one of those arcane mysteries that I'd like to avoid.

bsb
  • 1,847
  • 26
  • 24

1 Answers1

4

Using Control-S and the like, makes sense only in an interactive shell. So, I would put it into .bashrc, and to be sure test if the shell is really interactive.

Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198