How to disable the mouse?


#1

When I am working, I frequently switch between my MuPDF window and kak window where a TEX file is open. I need a mouse to scroll, zoom in and zoom out of the PDF file open in MuPDF and when I am done, I click anywhere within the terminal to bring it to focus so that I can start typing. In Vim, mouse is off my default so my cursor position doesn’t change and I just start typing.

In Kak, the cursor changes from the previous position to the position where I clicked my mouse. Kak is not Pluma/Gedit. I don’t want to move my mouse to that position, I just want to bring my Terminal into focus. g. takes me to my last buffer edit but not the last cursor position. I find it annoying to manually go back to the last position. So, how can I disable the mouse?

Many of Kak users are Vim refugees not Gedit’s, Kak has powerful (multi) selection tools that works better with keyboard than with the mouse, and many also hate the mouse. So, can we please get rid of the mouse support globally as a default?

P.S. Also, is it possible in Kak to go back to the last cursor position? I was a Vim user and by the force of habit, I frequently type x instead of d when I want to delete something. The x selects the whole line and I lose my position. (I have to press w, h, l keys several times to reach the position I was in.) This is particularly annoying when editing TEX files where the lines are very very long.


#2

To disable mouse support entirely in Kakoune, add something like this to your kakrc:

set -add global ui_options ncurses_enable_mouse=0

However, if you’re used to mouse-scrolling in MuPDF you may find it frustrating that mouse-scrolling no longer works in Kakoune.

If you’re worried about click-to-focus disturbing your text editor, you may wish to try you window manager’s focus-follows-mouse (“sloppy focus”) mode instead; it’s a lot more convenient to type into different windows if you don’t have to click on them all the time. Alternatively, you could flip between Kakoune and MuPDF with Alt+Tab and never have to touch the mouse at all.

Kakoune doesn’t have a way to undo the last cursor movement. There’s <c-o> to undo the last cursor jump, but that’s only relevant if you accidentally hit something like gg, not x.

Your TeX files don’t need to have long lines, semantic line breaks should work perfectly well there.


#3

Not trying to insult on your workflow, just mentioning something that might interest you.

Despite your particular problem, I’ve thought that every Linux desktop environment does scrolling without stealing focus (well XFCE does steal the focus, but you can disable it).

I know lot of people who find “focus follows mouse” feature really useful in this case. In my case I just switch focus with the keyboard and have system binding for navigating with keyboard.

Yeah this is super annoying, especially when you make a selections, and one wrong action makes you loose all the progress. There’s an old issue highlighting this problem: #898, but seems every one ok with this term: “It’s better to learn not to make mistakes, than to learn to fix mistakes all the time”


#4

That worked, thank you.

I use the Gnome 2 Mate desktop and scrolling doesn’t steal focus. I used to have this really nice minimalistic pdf viewer like mupdf that had Vi-bindings but I forgot the name of that package. So I use mupdf. I need to middle-drag to adjust the zoomed view of my pdf which definitely changes the focus.

Focus follows mouse feels very counterintuitive to me. I like scroll without changing focus and changing focus just for scrolling brings back bad memories from the time I was a Windows user.

Kak doesn’t (or does it?) even have Vim’s gj and gk counterparts that moves the cursor directly below the cursor position instead of going to the next line. That is very annoying. If you are somewhere in the middle of a long line and you accidentally press the the j or k followed by a movement, it’s very difficult to go back to that middle position again.