ble.sh: [konsole] Doesn't work with semantic integration (mouse click to position cursor) in KDE's Konsole

ble version: 29cd8f1 Bash version: 5.2.15(1)-release (x86_64-pc-linux-gnu)

Thanks for a great project!

KDE’s Konsole supports semantic integration. This allows clicking the left mouse button to position the cursor in Bash. I am not able to get this to work with ble.sh unfortunately.

It is activated by adding this to .bashrc:

if [[ ! $PS1 =~ 133 ]] ; then
  PS1='\[\e]133;L\a\]\[\e]133;D;$?\]\[\e]133;A\a\]'$PS1'\[\e]133;B\a\]' ;
  PS2='\[\e]133;A\a\]'$PS2'\[\e]133;B\a\]' ;
  PS0='\[\e]133;C\a\]' ; 
fi

In the Konsole, you press Ctrl+Alt+I then search for “semantic integration” and put what appears there (the lines above) in your .bashrc to make it permanent.

I found that although those lines executed manually in bash in Konsole worked fine temporarily, they would not work in .bashrc, but I got it working by adding these lines at the end of my .bashrc instead:

if [[ ! $PS1 =~ 133 ]] ; then
    source ~/.local/share/DomTerm/bash-preexec.sh
    source ~/.local/share/DomTerm/shell-integration.bash
fi

bash-preexec.sh and shell-integration.bash are copied from another terminal called DomTerm (the first I’m aware of to offer click to position cursor) into ~/.local/share/DomTerm. Those files can be found here. cc @PerBothner: I think you may be interested in this topic.

I have click to position cursor working with Konsole and bash-it. I’d love to get it working with ble.sh as well. An increasing number of terminal emulators offer click to position cursor in bash (Konsole, Domterm, Kitty are the ones I’ve come across).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Thank you. OK, I can reproduce the problem in case 4. I haven’t checked the behavior in the second or later prompt. I’ll take a look.

For the other cases, case 1 is just fine. The behaviors in cases 2, 3, and 5 should be fixed by MR !951 that I submitted to Konsole.

I submitted MR !951 to the upstream Konsole. The next release cycle of KDE is 2024-02, so hopefully it will be fixed in the release next month. If it’s too late, I think it would be delayed until the 2024-08 release, unfortunately.