determining user focus
Frederik Dohr <[email protected]> Tue, 15 Feb 2011 12:43:56 +0100
| Newsgroups | gmane.network.irc.irssi.user |
|---|---|
| Message-ID | <[email protected]> |
Is there a simple way for a script to determine user focus (basically,
whether the Irssi window is active in the foreground)?
I understand this is tricky because Irssi is terminal-based and thus
doesn't care about window management, so I created a GTK wrapper for the
containing terminal window[1] - but that seems like a terribly
over-engineered workaround.
Essentially, all I want is to change the terminal title (as poor man's
persistent notification[2]) when a certain message is received (e.g. on
hilight), then reset the title when the user (un)focuses the terminal
window. The former is easy[3], but for the latter I'm stumped.
If no such focus event/signal exists, can anyone think of a sensible
workaround (e.g. binding Enter to trigger the reset[4])?
Any pointers would be greatly appreciated!
-- F.
[1] https://gist.github.com/822511 (at least it was educational for me)
[2] Growl-style notifications (e.g. notify-send) don't persist - I've
also explored (ab)using the terminal bell, to no avail.
[3] sig_printtext: parse, then print "\033]0;$title\007" to STDERR
[4] I've tried `/bind return multi <...>`, but only managed to disable
the send_line trigger in the process...