Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-03-03 18:08:57

vstuart
Member
From: Vancouver, B.C., Canada
Registered: 2018-03-03
Posts: 3
Website

xfce4-terminal -- disable Ctrl-Z

Hello.  Whenever I accidentally hit Ctrl-z in a Python session in xfce4-terminal,

    [victoria@victoria ~]$ python
        ...
    >>>  ## accidental Ctrl-z keypress here
        [1]+  Stopped                 python
    [victoria@victoria ~]$

... I stop/kill the process.

How can I disable the Ctrl-z kepyress in xfce4-terminal?

Offline

#2 2018-03-03 18:38:25

vstuart
Member
From: Vancouver, B.C., Canada
Registered: 2018-03-03
Posts: 3
Website

Re: xfce4-terminal -- disable Ctrl-Z

Solution!  Call this bash script via a ~/.bashrc alias:

# bash script (python-ctrl-z-disabled.sh):

  #!/bin/bash
  # /mnt/Vancouver/Programming/scripts/python-ctrl-z-disabled.sh

  #     Issue: Ctrl-Z keypress in xfce4-terminal was killing running Python instance.
  # Solution: disable Ctrl+z by launching Python via this script:

  trap '' INT TSTP
  python


~/.bashrc alias:

  alias P="/mnt/Vancouver/Programming/scripts/python-ctrl-z-disabled.sh"

Now, launching Python (P) in my terminal in host environment or my Python 2.7
and Python 3.6 virtual environments (venv) allow that Python instance to run
with Ctrl-z disabled, in that python session.

For normal usage, just launch Python in the normal way (python).

Last edited by vstuart (2018-03-03 18:39:20)

Offline

#3 2018-03-03 18:38:55

alcornoqui
Member
Registered: 2014-07-28
Posts: 258

Re: xfce4-terminal -- disable Ctrl-Z

It's not an Xfce or xfce4-terminal issue, but see if this helps:

stty susp undef

will disable the keyboard-initiated suspend signal for most programs, however commands like vim and emacs that have specific bindings for Ctrl-Z will have to be reconfigured individually.

You can add that stty command to your ~/.bash_profile or ~/.profile, logout, login again.

(from Disabling job control in bash (CTRL-Z))

Bonus: What's different between Ctrl+Z and Ctrl+C in Unix command line

Offline

#4 2018-03-03 18:40:56

alcornoqui
Member
Registered: 2014-07-28
Posts: 258

Re: xfce4-terminal -- disable Ctrl-Z

Jinx! smile

Offline

#5 2018-03-03 18:44:06

vstuart
Member
From: Vancouver, B.C., Canada
Registered: 2018-03-03
Posts: 3
Website

Re: xfce4-terminal -- disable Ctrl-Z

@alcornoqui: lol, that's also great - thanks!  big_smile

Offline

Board footer

Powered by FluxBB