I would like to be able to click the mouse button in konsole to position the cursor in bash. How do I do it?
1 Answer
In konsole 22.08 onwards, there is the ability to click the left mouse button to position the cursor in bash (a feature not present in Gnome's or Cinnamon's terminals). I had some trouble getting it to work so thought I'd share my solution.
You have to do two things get it working. One is change a setting in konsole settings and the second is to add some lines to .bashrc
. It sounds easy, but the first is hindered by a bug and the second just didn't work for me.
The konsole setting can be found in Settings -> Configure Konsole. A new window opens and you go to Profiles in there. For me, the built in profile is read only so I had to make a new profile, but I could not save the new profile. Every time I exited, the profile disappeared. I found a workaround to the bug here: basically you never click "Apply" when creating the profile only "Ok", close settings window and konsole, then reopen.
In the profile, under General, there is a tab "Semantic Integration". "Mouse click in input line" needs to be selected.
In the konsole, you are supposed to press Ctrl+Alt+I then search for "semantic integration" and put what appears there in your .bashrc
to make it permanent. However, that didn't work for me even though those same lines executed manually in bash in konsole worked fine temporarily. I had to add 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 (that also offers click to position cursor) into ~/.local/share/DomTerm
. Those files can be found here.
I have found this setup works when using bash-it themes.