Re: Konsole: lost focus of window or tab
Dnia piątek 19 styczeń 2007, Matthew Woehlke napisał: > So, just to make sure I am following, Vim does or does not currently > understand any escape sequences for focus events? It sounds like "no", > but then what about A.J.'s comment about reacting to "[focus] events for > 'the GUI and a few console versions where this can be detected'"? > From placement of focus related functions in Vim source looks like currently such events are supported only in GUI and Win32 console. There is no general code. m.
Re: Konsole: lost focus of window or tab
Bram Moolenaar wrote: Mikolaj Machowski wrote: Dnia czwartek 18 styczeñ 2007, Bram Moolenaar napisa³: Note that we also need one to enable/disable getting these events. A program should only get the events when asked for. Are you talking here about Vim part or Konsole part? Both. The terminal emulater needs to support enable/disable for sending focus events. Vim must send the enable/disable when appropriate (e.g., it needs to be disabled when executing a shell command). Although this can perhaps be part of the already existing t_ke and t_ks codes. So, just to make sure I am following, Vim does or does not currently understand any escape sequences for focus events? It sounds like "no", but then what about A.J.'s comment about reacting to "[focus] events for 'the GUI and a few console versions where this can be detected'"? -- I wonder how much deeper the ocean would be without sponges. It would be less deep, of course, since the sponges take up volume! :-) -- Matthew "What a wonderful smell you've discovered!" -- Princess Leia Organa
Re: Konsole: lost focus of window or tab
Mikolaj Machowski wrote: > Dnia czwartek 18 styczeñ 2007, Bram Moolenaar napisa³: > > Note that we also need one to enable/disable getting these events. A > > program should only get the events when asked for. > > Are you talking here about Vim part or Konsole part? Both. The terminal emulater needs to support enable/disable for sending focus events. Vim must send the enable/disable when appropriate (e.g., it needs to be disabled when executing a shell command). Although this can perhaps be part of the already existing t_ke and t_ks codes. -- I wonder how much deeper the ocean would be without sponges. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Konsole: lost focus of window or tab
Dnia czwartek 18 styczeń 2007, Bram Moolenaar napisał: > Note that we also need one to enable/disable getting these events. A > program should only get the events when asked for. Are you talking here about Vim part or Konsole part? m.
Re: Konsole: lost focus of window or tab
Dnia czwartek 18 styczeń 2007, Matthew Woehlke napisał: > ...I am not a Vim hacker, but if you can rig Vim to handle some escape > sequence, I may be able to help make Konsole understand/send them. A > start might be to write a simple application that sends the sequence to > turn on the function and then listens for them and takes some action > (like beeping and/or printing a message with a time stamp) when it > receives a notification. You could use that to test Konsole. (Read: if > you write that, it will make me much more motivated to help you with > hacking on Konsole :-).) I am not Vim hacker, not even programmer. The only I am able to do is simple shell thingy: #!/bin/bash read key if [ `echo $key | grep '24' ` ]; then echo -e 'you got it' fi 24 should be replaced by escape code, if code is coming from terminal maybe it should be ``read -e``, not just ``read``. In addition you have to manually press enter to go further :( Works with codes of function keys. m.
Re: Konsole: lost focus of window or tab
Mikolaj Machowski wrote: > Dnia Åroda 17 styczeÅ 2007, Matthew Woehlke napisaÅ: > > > > I'm willing to (try to, at least) help get this working in 3.5.x if you > > can dig up what the needed escapes are (it sounds like there are already > > existing examples?)... it probably won't be accepted but you could use > > it locally, and of course submit it for porting to KDE4. > > On kde-devel R. Knight said he can accept it to 3.5.7 release and later > maintain it for KDE 4. > > Now, some start. I don't know much about term internals. I read > something yesterday and today so forgive me if I wrote something stupid. > Just seed for further discussion: > > Base info according to man terminfo: > > Variable String: focus_lost > Cap name:flo > TCapcode:fL > Description: terminal lost focus > > Escape sequence: \E[1fl > > Variable String: focus_gained > Cap name:fga > TCapcode:fG > Description: terminal gained focus > > Escape sequence: \E[1fg > > These sequences and names don't conflict with any other entry defined in > my /etc/termcap or /usr/share/terminfo/** . There are some rules about escape sequences, I think ending in "fl" or "fg" is not good. Try asking Thomas Dickey, he has a good overview of the codes. Note that we also need one to enable/disable getting these events. A program should only get the events when asked for. -- hundred-and-one symptoms of being an internet addict: 38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail on the way back to bed. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Konsole: lost focus of window or tab
Mikolaj Machowski wrote: Dnia ¶roda 17 styczeñ 2007, Matthew Woehlke napisa³: Matthew Woehlke wrote: Robert Knight says we should be able to add escape sequences to Konsole to support this. I might be able to help with the patching (although it is KDE4 that will really get the fix, anything for KDE3 does not seem likely to be accepted, so you would be patching your own local version), I was waiting 2 years for Lists in VimL so I can wait several months for KDE 4 ;) Actually, he also corrected me and said it might be OK for 3.5.7... :-) Anyway... but someone Vim-side needs to tell us what Konsole needs to provide... Looks like it should be similar communication like with mouse events. Proper escape codes - I suppose there is no standard at the moment. If Konsole would be first to do it there is chance that will become standard. ...I am not a Vim hacker, but if you can rig Vim to handle some escape sequence, I may be able to help make Konsole understand/send them. A start might be to write a simple application that sends the sequence to turn on the function and then listens for them and takes some action (like beeping and/or printing a message with a time stamp) when it receives a notification. You could use that to test Konsole. (Read: if you write that, it will make me much more motivated to help you with hacking on Konsole :-).) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated.
Re: Konsole: lost focus of window or tab
Dnia środa 17 styczeń 2007, Matthew Woehlke napisał: > > I'm willing to (try to, at least) help get this working in 3.5.x if you > can dig up what the needed escapes are (it sounds like there are already > existing examples?)... it probably won't be accepted but you could use > it locally, and of course submit it for porting to KDE4. On kde-devel R. Knight said he can accept it to 3.5.7 release and later maintain it for KDE 4. Now, some start. I don't know much about term internals. I read something yesterday and today so forgive me if I wrote something stupid. Just seed for further discussion: Base info according to man terminfo: Variable String: focus_lost Cap name:flo TCapcode:fL Description: terminal lost focus Escape sequence: \E[1fl Variable String: focus_gained Cap name:fga TCapcode:fG Description: terminal gained focus Escape sequence: \E[1fg These sequences and names don't conflict with any other entry defined in my /etc/termcap or /usr/share/terminfo/** . m.
Re: Konsole: lost focus of window or tab
Dnia środa 17 styczeń 2007, Matthew Woehlke napisał: > Matthew Woehlke wrote: > > 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. > > > > [snip long answer] > > [...and short answer, too] > > Robert Knight says we should be able to add escape sequences to Konsole > to support this. I might be able to help with the patching (although it > is KDE4 that will really get the fix, anything for KDE3 does not seem > likely to be accepted, so you would be patching your own local version), I was waiting 2 years for Lists in VimL so I can wait several months for KDE 4 ;) > but someone Vim-side needs to tell us what Konsole needs to provide... Looks like it should be similar communication like with mouse events. Proper escape codes - I suppose there is no standard at the moment. If Konsole would be first to do it there is chance that will become standard. > Does Vim already support notifications for some terminal emulators? If > so, how do we go about adding Konsole to that list? Comment in :ui.c:3010: says: /* * Called when focus changed. Used for the GUI or for systems where this can * be done in the console (Win32). */ m.
Re: Konsole: lost focus of window or tab
Matthew Woehlke wrote: > Matthew Woehlke wrote: > > 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. > > > > [snip long answer] > > [...and short answer, too] > > Robert Knight says we should be able to add escape sequences to Konsole > to support this. I might be able to help with the patching (although it > is KDE4 that will really get the fix, anything for KDE3 does not seem > likely to be accepted, so you would be patching your own local version), > but someone Vim-side needs to tell us what Konsole needs to provide... > > Does Vim already support notifications for some terminal emulators? If > so, how do we go about adding Konsole to that list? Vim does check for some events, such as the xterm version response. We need to add termcap/terminfo codes for this internally (won't work anywhere else). Thus if you follow what's there in Vim it should not be too complicated. -- To define recursion, we must first define recursion. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Konsole: lost focus of window or tab
Matthew Woehlke wrote: Matthew Woehlke wrote: 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. [snip long answer] [...and short answer, too] Robert Knight says we should be able to add escape sequences to Konsole to support this. I might be able to help with the patching (although it is KDE4 that will really get the fix, anything for KDE3 does not seem likely to be accepted, so you would be patching your own local version), but someone Vim-side needs to tell us what Konsole needs to provide... Does Vim already support notifications for some terminal emulators? If so, how do we go about adding Konsole to that list? Sure. At the very least, it reacts to the notifications that a key has been pressed, or the mouse moved or clicked ;-) or, more seriously, to FocusGained and FocusLost events for "the GUI and a few console versions where this can be detected". I suppose any notification mechanism would be OK, as long as Vim can be made to listen to it and trigger its (already defined) FocusGained and FocusLost events (q.v.). Do the termcap/terminfo libraries provide for representation of focus-related event signals? I don't know, but IMHO it would be easiest if they did; however, even if they don't, I suppose an appropriate event handler could be programmed into Vim, provided that there existed _any_ method to communicate those events unambiguously to a running program. If there are several incompatible ways to do it depending on OS and terminal, then I suppose it could be implemented via a configure argument and/or a configure library search, the way mouse handlers are already included or excluded at compile (or more precisely configure) time: see vim --version | grep mouse Best regards, Tony.
Re: Konsole: lost focus of window or tab
Matthew Woehlke wrote: 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. [snip long answer] [...and short answer, too] Robert Knight says we should be able to add escape sequences to Konsole to support this. I might be able to help with the patching (although it is KDE4 that will really get the fix, anything for KDE3 does not seem likely to be accepted, so you would be patching your own local version), but someone Vim-side needs to tell us what Konsole needs to provide... Does Vim already support notifications for some terminal emulators? If so, how do we go about adding Konsole to that list? -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated.
Re: Konsole: lost focus of window or tab
On 1/17/07, Matthew Woehlke <[EMAIL PROTECTED]> wrote: Nikolai Weibull wrote: > On 1/17/07, Matthew Woehlke wrote: >> 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): > > [snip really long answer] > Sorry, but I just had to ask, what exactly are you responding to? I > saw no suggestion of using DCOP in the vim-dev thread. Did someone on > the kde list suggest it? Just curious on what they were suggesting. Mikolaj Machowski though of it (see his original e-mail to kde-devel, quoted above). Ouch, missed that part. I just figured you quoted his mail to this list. Sorry, I got confused. nikolai
Re: Konsole: lost focus of window or tab
Nikolai Weibull wrote: On 1/17/07, Matthew Woehlke wrote: 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): [snip really long answer] Hi! Sorry, but I just had to ask, what exactly are you responding to? I saw no suggestion of using DCOP in the vim-dev thread. Did someone on the kde list suggest it? Just curious on what they were suggesting. Mikolaj Machowski though of it (see his original e-mail to kde-devel, quoted above). So this is a follow up of the previous thread, "FocusLost and terminal functionality"; also it raised a number of curiosity questions (about Vim) on my part, so I cross-posted. :-) (And because we are talking about Vim, of course.) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS > HIPPOS seem somewhat placated.
Re: Konsole: lost focus of window or tab
On 1/17/07, Matthew Woehlke <[EMAIL PROTECTED]> wrote: 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): [A really long answer] Hi! Sorry, but I just had to ask, what exactly are you responding to? I saw no suggestion of using DCOP in the vim-dev thread. Did someone on the kde list suggest it? Just curious on what they were suggesting. Thanks! nikolai
Re: Konsole: lost focus of window or tab
(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?