diff options
author | kostix <kostix@cc602e41-bd33-0410-9637-a208f32f1443> | 2009-01-23 02:28:49 +0000 |
---|---|---|
committer | kostix <kostix@cc602e41-bd33-0410-9637-a208f32f1443> | 2009-01-23 02:28:49 +0000 |
commit | 1c9e1b1da7a3ae2a5f76069e06bdc0d88767749a (patch) | |
tree | aae509cb253b4a5807035213459fb9b1684968da /urgent.tcl | |
parent | e6955f3fb7cfbfb288fced60b6395bbf4e4a5c1f (diff) | |
download | urgent-1c9e1b1da7a3ae2a5f76069e06bdc0d88767749a.tar.gz urgent-1c9e1b1da7a3ae2a5f76069e06bdc0d88767749a.tar.xz urgent-1c9e1b1da7a3ae2a5f76069e06bdc0d88767749a.zip |
urgent/urgent.tcl:
* Really fixed getting the right X Window ids for the
chat windows in the non-tabbed UI mode.
* Fixed an error in formatting the error message for the
case of unusable helper program.
* We now hold the urgency flag status in the per-chat-window
state to eliminate excessive calls to the helper program
on message floods and focus flipping (in WMs using
focus-follows-mouse/sloppy focus policy).
* The helper program is now called in background.
* "xwinids" array renamed to "state".
* Improved descriptions of Customize options.
urgent/urgent.c: Fixed build command example.
urgent/INSTALL: Added installation/building instructions.
Added "urgent" to the list of ignored files.
git-svn-id: http://svn.xmpp.ru/repos/tkabber-3rd-party/trunk/plugins/urgent@168 cc602e41-bd33-0410-9637-a208f32f1443
Diffstat (limited to 'urgent.tcl')
-rw-r--r-- | urgent.tcl | 49 |
1 files changed, 33 insertions, 16 deletions
@@ -2,8 +2,16 @@ namespace eval urgent { variable options + variable state - custom::defgroup Urgent [::msgcat::mc "Urgency hinting."] -group Plugins + custom::defgroup Urgent \ + [::msgcat::mc "Urgency hinting.\ + This plugin provides an ability to set the so called\ + \"urgency flag\" as a special hint to the window manager\ + on Tkabber's chat windows when new messages arrive.\ + ICCCM compliant window managers may use this hint\ + to somehow draw the user's attention to such a window."] \ + -group Plugins custom::defvar options(enabled) 1 \ [::msgcat::mc "Set the urgency hint on Tkabber's chat\ @@ -23,7 +31,7 @@ namespace eval urgent { -group Urgent custom::defvar options(handle_server_messages) 0 \ - [::msgcat::mc "React on messages generated by the server"] \ + [::msgcat::mc "React on messages generated by the server."] \ -type boolean \ -group Urgent } @@ -77,7 +85,7 @@ proc urgent::chat_message_notify {chatid from type body extras} { } proc urgent::xclientwinid {tkwin} { - # Parent window id: 0x2e0001e "Tkabber" + tkwait visibility $tkwin ;# seems to be needed by xwininfo set data [exec xwininfo -children -id [winfo id $tkwin]] if {[regexp {Parent window id: (\S+)} $data -> id]} { return $id @@ -92,34 +100,43 @@ proc urgent::root_xwinid {xwinid _chatid} { } proc urgent::chat_xwinid {chatid} { - #xclientwinid [chat::winid $chatid] - winfo id [chat::winid $chatid] + xclientwinid [chat::winid $chatid] } proc urgent::record_xwinid {chatid _type} { - variable xwinids - set xwinids($chatid) [xwinid $chatid] + variable state + set state(xwinid,$chatid) [xwinid $chatid] + set state(active,$chatid) false } proc urgent::forget_xwinid {chatid} { - variable xwinids - unset xwinids($chatid) + variable state + + unset state(xwinid,$chatid) + unset state(active,$chatid) } proc urgent::set_urgency_hint {chatid} { variable options - variable xwinids + variable state - exec $options(program) -set $xwinids($chatid) + if {!$state(active,$chatid)} { + exec $options(program) -set $state(xwinid,$chatid) & + set state(active,$chatid) true + } } proc urgent::clear_urgency_hint {winid} { - variable options - variable xwinids - set chatid [chat::winid_to_chatid $winid] + if {$chatid == ""} return + + variable options + variable state - exec $options(program) -clear $xwinids($chatid) + if {$state(active,$chatid)} { + set state(active,$chatid) false + exec $options(program) -clear $state(xwinid,$chatid) & + } } namespace eval urgent { @@ -132,7 +149,7 @@ namespace eval urgent { if {![file executable $options(program)]} { puts stderr [::msgcat::mc "Urgency hint setting program \"%s\"\ is not available or not executable by the current user.\ - The \"urgent\" plugin is disabled. Consult its README file." + The \"urgent\" plugin is disabled. Consult its README file." \ $options(program)] set options(enabled) 0 } |