Keep a window from acquiring focus

Hi,

I'm using neovim + vimtex plugin for LaTeX work. Okular is used for a viewer. vimtex and synctex supply forward and inverse search (you can navigate pdf loaded into Okular via Vim). Naturally, but very unfortunately, as soon as pdf gets forwarded, focus goes to Okular. This is extremely annoying. Is there a way to make it very hard for a particular window to get focus? At least, in KDE?

You can create a Window/Application Rule and select/modify the

image

Play around and see what's best for you.

Thanks! Unfortunately, I have no idea what do all those words mean. By the sound of them, they are all about keeping focus; I want rather opposite.

What would you try first?

Or should I try to prevent my console window from losing focus?

The other way around, you can set Octopi NOT to Steal focus ...
Focus Stealing Prevention = prevent that a window will Steal Focus :slight_smile:

Looks like nothing makes any difference. I created the only rule Do not steal focus, Okular; Window Title > Substring Match: Okular; Focus stealing prevention > Force > Extreme. Stealing still.

Alternatively, Window class (application): sakura (console app); Focus protection > Force > Extreme. Still losing it. Maybe I keep forgetting something?

I don't know. I use quite different way of the window rules.
maybe you have to edit the ~/.config/kwinrc and replace
FocusStealingPreventionLevel=2
with
FocusStealingPreventionLevel=4

I've been experimenting on global settings. Indeed, with Focus stealing prevention Extreme or High, Okular does not steal focus on opening. Unfortunately, on pdf forwarding it gets focus just the same.

Is there a way of talking in into giving the focus back, I wonder :blush: ?

When you don't like a Window/Application Rule, just delete it for that particular Application and all goes back to normal. Maybe is a simple thing to set, but needs a bit of investigation for your particular deman. :slight_smile:

There are some suggestions in the following pages/issues from vimtex GitHub that may work for you:

1 Like

Ah! Very interesting. Will take some time to explore.

It's a world of pain, probably. I opened two console windows first; in console 1 I opened nvim and checked :echo v:windowid, as suggested. 0, really? Closed nvim in console 1, opened in console 2; :echo v:windowid; zero again. Another avenue of research.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.