Overview

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)
                |                 |