Source

selection-monitor /

Filename Size Date modified Message
lib
utils
20 B
1.8 KB
368 B
Selection monitor
=================

This tool is meant to secure You from pasting a multi-line text into 
a window. Most dangerous in terminals. This tool trims the text to just 
the first line. It can be temporarily disabled via a tray (notification 
area) icon.

It manipulates the ``PRIMARY`` and ``CUT_BUFFER0`` clipboards.



URXVT
-----

In urxvt You can actually just use one of the included Perl extensions.  
Add the following line to Your ``~/.Xdefaults``:

::

  URxvt.perl-ext-common: default,confirm-paste

Urxvt will now ask You whenever You want to paste more than a line.



CONFIGURATION
-------------

To change the behaviour of the selection monitor, edit the
``$XDG_CONFIG_DIRS/selection-monitor/config`` file.

Example:

::

  [Default]
  filter_oneliners_only=True



NOTE
----

This version of the application has been created also as an exercise of 
creating multi-threaded GUI (Gtk) applications.

The main idea looks like this:

::

                    |    other    |
                    |   threads   |
                    '--------|----'
  ----------------.          |      .-------------------------
                  |    event |      |
     GUI (Gtk)    |          |      |    Executor thread
    main thread   |          |      |
                  |          v      |
   .---- event -------> EventQueue --- event --> Executor
   |              |                 |               |
   |              |                 |               V
  GUI             |                 |         event.handle()
   ^              |                 |               |
   |              |                 |               V
   `-------------- main thread queue ---------- GUI helper
                  |                 |       (gobject.idle_add)
                  |                 |


.. vi: ft=rst