(KDE folks should note that this is cross-posted to vim-devel and should remove that address unless you have a reason not to.)

Mikolaj Machowski wrote:
Is it possible to recognize if window or tab of Konsole lost focus
through termcap/terminfo sequence?

Or is it at least possible with dcop or any other way?

I am investigating ways to support Vim FocusGain/FocusLost autoevents.

Long answer (short answer below):
---------------------------------

Hooboy... assuming there is not currently a way (Bram - or anyone else that knows - I am an ignoramus here, does vim support these for ANY 'real consoles', or just in the GUI's?), I think making a console vim that is based on KDE/dcop is a horrible idea, because it will, naturally, depend on DCOP running. Which means it will only build if KDE is around, and that in 6-12 months it will be obsolete (when KDE4 comes out using DBUS). Which means it will only run locally, and then only in certain circumstances (e.g. you have not used 'su' or changed your home directory*), and will of course depend on dcop running which basically means you have to run it in Konsole (ok, that was the point, but...). And if DCOP doesn't even support this, forget trying to change Konsole now that KDE development is geared mostly toward KDE4.

(* you can get around this with hacks, but it isn't pretty... believe me, I know, I /do/ it.)

In short, don't even think about using DCOP. Use gVim instead; if you can use DCOP to talk to Konsole, you /should/ be able to run an X application, but not necessarily the other way around.

I wouldn't expect DBUS to be much better in this regard (maybe I am wrong?). IMO you would be better off getting term* sequences implemented, since these could be standardized, and then people could sit on e.g. xterm to support them, and then once vim works with one terminal emulator, it will 'magically' work with others as they add support. But it still means Konsole needs to change.

Now, I don't know what the impact of adding capabilities to existing terminfo entries is, if it breaks existing things that don't know about them, or what, but you are probably talking about adding sequences to at least the 'xterm' and 'linux' entries (since I don't think it is unreasonable to use 'linux' in Konsole... I certainly do, anyway; I *always* avoid xterm). If you can't just add stuff, then you will have to invent a new terminfo entry. Either way I am guessing this will only work if you have a terminfo db that knows about this functionality, and I couldn't tell you if this sort of thing is going to work at all over remote connections or not.


Short answer:
-------------

Unless you are really, REALLY desperate and inclined to patch your local vim with something almost guaranteed not to be accepted upstream, then you are stuck with Thiago's suggestion of polling for focus. Keep in mind the caveats above; this will only work in rather limited situations, and you would be better off using gVim (or KWrite).

That said, asking for DBUS signals would be worthwhile on its own merits, but to use it in vim, you'll have at least some of the same problems as with DCOP. Certainly it won't work over some (if not all) remote connections, plus the only way you could use it is if it can be turned off by configure, since not all platforms will have DBUS.

--
Matthew
You are in a dark room. The only exit is a door to the east.
> GO EAST
There's a door in your way. Maybe you should open it first?

Reply via email to