Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-07-09 09:41:29

neverdimed
Member
Registered: 2022-07-04
Posts: 26

ctrl d shortcut defined where? [SOLVED]

ctrl d closes tabs in guake and xfce terminal. I cannot find where this shortcut key is defined so i can disable it. It messes up ranger which uses ctrl d to scroll down half a page. In xfce terminal i disabled access keys and shortcut keys. Im using mx linux and dont have the same issue with guake on ubuntu, so it is something with xfce i guess.

ctrl d works fine in vim in guake and xfce terminal, but in ranger it doesnt

Last edited by neverdimed (2022-07-09 20:29:48)

Offline

#2 2022-07-09 11:23:12

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: ctrl d shortcut defined where? [SOLVED]

Ctrl+d is a bash setting that kills the interactive session. You can control the behaviour of this function with the environment variable:

export IGNOREEOF=3

...the value at the end will indicate the number of consecutive presses before bash acts on the close signal.

From "man bash":

IGNOREEOF
              Controls the action of an interactive shell on receipt of an EOF
              character as the sole input.  If set, the value is the number of
              consecutive EOF characters which must  be  typed  as  the  first
              characters  on an input line before bash exits.  If the variable
              exists but does not have a numeric value, or has no  value,  the
              default  value  is  10.  If it does not exist, EOF signifies the
              end of input to the shell.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-07-09 12:19:40

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: ctrl d shortcut defined where? [SOLVED]

It's actually not bash-specific. It's defined in a terminal interface, regardless of the shell. A more shell-agnostic solution would be:

set -o ignoreeof

Put it in the ~/.profile and any Bourne-compatible login shell will pick it up (bash, dash, what have you). GNOME Terminal has this as a toggle. Considering Xfce terminal uses VTE, the same library GNOME Terminal is based on, this setting should also be exposed in the GUI, I think.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#4 2022-07-09 19:08:54

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: ctrl d shortcut defined where? [SOLVED]

bash supports it and may have even originated it.  it's just not bash exclusive (at least not anymore).  if you use bash, then you have bash do it.  if you use a different shell, it may or may not be supported.

once something becomes a (de-facto) standard.  it often gets used in a similar way in other places, either by the same name, or by the same mechanism, or both.

i don't use it and don't want it to end my shell if it gets pressed by accident.  so i have:

export IGNOREEOF=32767

Last edited by Skaperen (2022-07-09 19:12:44)

Offline

#5 2022-07-09 20:29:08

neverdimed
Member
Registered: 2022-07-04
Posts: 26

Re: ctrl d shortcut defined where? [SOLVED]

many thanks for your responses. I ran both suggestions, but neither affected the behaviour in ranger. I thought it must be a ranger problem then and added this to my rc.conf:

copymap <PAGEDOWN> <C-D>
copymap <PAGEUP>   <C-U>

works perfectly

ps, is it possible to check the value assigned to ingoreeof? when i ran your suggestions there was no output, it doesnt seem to recognise ignoreeof(?)

Last edited by neverdimed (2022-07-09 20:32:12)

Offline

#6 2022-07-10 01:17:02

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: ctrl d shortcut defined where? [SOLVED]

Skaperen, like I already said, it's not a shell-specific thing. Just like pressing Enter isn't. Even csh has the ignoreeof setting and it's not even a descendant of the original Bourne shell. Control codes had been around long before bash or any other "shell" even existed. Any terminal, or terminal emulator in our world, sets up its attributes through the termios struct. See the ASCII table: man ascii. The EOT (end of transmission) character is 004, 4, 0x04 (oct, dec, hex). That's the ^D character (on the same line as the D character).

neverdimed, what's Ranger? Is that a terminal emulator?


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#7 2022-07-10 17:35:57

neverdimed
Member
Registered: 2022-07-04
Posts: 26

Re: ctrl d shortcut defined where? [SOLVED]

ranger is a file manager for the terminal with vim-like key bindings

Offline

#8 2022-07-11 02:37:44

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: ctrl d shortcut defined where? [SOLVED]

Ah, I think I understand what you're trying to do. Here's my suggestion.

  1. Create an empty file in ~/bin. If that directory doesn't exist, create it too.

  2. Open it in your favorite text editor and put these lines:

    #!/bin/sh
    # A simple wrapper to Ranger, to disable the ^D control character.
    
    stty eof ""                  # disable it for the duration of Ranger
    /absolute/path/to/ranger     # you MUST point to the absolute pathname of its executable
    stty eof "^D"                # re-enable it after Ranger session is closed
  3. Turn on the execution bit:

    chmod +x ~/bin/ranger
  4. Check if your ~/.profile is set to include ~/bin in the PATH variable. If it doesn't, append the following lines:

    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
  5. Source the file for the changes to apply to your current session:

    . ~/.profile

    Don't worry, ~/.profile is read every time your login shell starts up, so it should persistent from now on.

Try this and let us know how it goes.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 553.55 KiB (Peak: 570.84 KiB) ]