Tkabber plugins

Check-in [f51aa371d9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add new plugin: sensible-copy. This plugin modifies the behaviour of "copy selection" action in chat windows by copying the text from either the input chat window or the chat log window, depending on which one has a text selected.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f51aa371d9fdfc23fa4ee572f5d02d1bd2e6cfd2
User & Date: khomoutov 2017-03-28 07:45:46
Context
2023-03-30
09:23
Use TWAPI to generate random numbers in Windows if available. Leaf check-in: 3c09bced80 user: sgolovan tags: trunk
2017-03-28
07:45
Add new plugin: sensible-copy. This plugin modifies the behaviour of "copy selection" action in chat windows by copying the text from either the input chat window or the chat log window, depending on which one has a text selected. check-in: f51aa371d9 user: khomoutov tags: trunk
2017-03-27
12:13
Use zero padding when formatting an OTR fingerprint for display. check-in: 60440eddc0 user: sgolovan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added sensible-copy/AUTHORS.



>
1
Konstantin Khomoutov <flatworm@users.sourceforge.com>

Added sensible-copy/INSTALL.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
As usual, copy this directory under the ~/.tkabber/plugins directory
so that you get a hierarchy like this:
  ~/.tkabber/plugins
  ~/.tkabber/plugins/sensible_copy/
  ~/.tkabber/plugins/sensible_copy/sensible_copy.tcl

Restart Tkabber, to get the plugin loaded.

Consult the README file for the details about using this plugin.

Added sensible-copy/README.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"Sensible Copy" -- chat plugin for Tkabber.


I. The idea

This plugin modifies the way text is copied in Tkabber chat
windows.  By default, when a text copying event is generated in
the chat input window (via the Ctrl-C keyboard shortcut or the
corresponding context menu entry), only the selection in the
input window is considered.  This plugin changes this behaviour
by making Tkabber look for the selected text in the chat window
as well, so it's now possible to select text in the chat window
and hit Ctrl-C to make it copied to the clipboard.


II. Configuration

This plugins contains no configuration.


vim:et:ts=4:sw=4:tw=64

Added sensible-copy/license.terms.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Copyright (c) 2016 Konstantin Khomoutov <flatworm@users.sourceforge.net>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Added sensible-copy/msgs/ru.msg.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ru.msg --
#
#       Russian messages for the Sensible Copy Tkabber plugin.
#
# Author: Konstantin Khomoutov <flatworm@users.sourceforge.net>

::msgcat::mcset ru "This plugin copies the selected text from the chat log\
        window or the chat input window - depending on which one\
        contains the selection."\
        "Это расширение копирует выделенный текст либо из окна разговора,\
        либо из окна ввода текста - в зависимости от того, которое из них\
        содержит выделение."
::msgcat::mcset ru "Plugins options." "Настройки расширений."
::msgcat::mcset ru "Whether the sensible text copying plugin is loaded."\
        "Загружено ли расширение разумного копирования текста."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Added sensible-copy/sensible-copy.tcl.































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# sensible_copy.tcl --
#
#       "Sensible Copy" chat plugin for Tkabber.
#       Copies selected text from the chat window (containing the
#       log of the conversation) or the input windows -- depending
#       on which one contains the selection.
#
# Author: Konstantin Khomoutov <flatworm@users.sourceforge.net>
#
# See license.terms for the terms of distribution.
# See README for usage details.

package require msgcat

namespace eval sensible_copy {
    variable options

    ::msgcat::mcload [file join [file dirname [info script]] msgs]

    variable desc [::msgcat::mc \
            "This plugin copies the selected text from the chat log\
            window or the chat input window - depending on which one\
            contains the selection."]

    if {![::plugins::is_registered sensible_copy]} {
        ::plugins::register sensible_copy \
            -namespace [namespace current] \
            -source [info script] \
            -description [::msgcat::mc \
                "Whether the sensible text copying plugin is loaded."]\n$desc \
            -loadcommand [namespace code load] \
            -unloadcommand [namespace code unload]
        return
    }
}

proc sensible_copy::load {} {
    hook::add open_chat_post_hook [namespace current]::prepare_chat_window

    foreach chatid [chat::opened] {
        prepare_chat_window $chatid ?
    }
}

proc sensible_copy::unload {} {
    foreach chatid [chat::opened] {
        unprepare_chat_window $chatid
    }

    hook::remove open_chat_post_hook [namespace current]::prepare_chat_window
}

proc sensible_copy::prepare_chat_window {chatid type} {
    set iw [::chat::input_win $chatid]
    bind $iw <<_DefaultCopy>> [bind [winfo class $iw] <<Copy>>]
    bind $iw <<Copy>> \
         [list [namespace current]::copy [double% $chatid]]
}

proc sensible_copy::unprepare_chat_window {chatid} {
    set iw [::chat::input_win $chatid]
    bind $iw <<Copy>> {}
    bind $iw <<_DefaultCopy>> {}
}

proc sensible_copy::copy {chatid} {
    set cw [::chat::chat_win $chatid]
    set iw [::chat::input_win $chatid]

    set range [$cw tag ranges sel]
    if {$range == ""} {
        event generate $iw <<_DefaultCopy>>
        return
    }

    event generate $cw <<Copy>>
}

# vim:ts=8:sw=4:sts=4:et