-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcopyall.py
32 lines (25 loc) · 1008 Bytes
/
copyall.py
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
#!/usr/bin/python
# Terminator by Chris Jones <[email protected]>
# GPL v2 only
"""copyall.py - Terminator Plugin to copy the terminal content into clipboard"""
import os
from gi.repository import Gtk
import terminatorlib.plugin as plugin
from terminatorlib.translation import _
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['CopyAll']
class CopyAll(plugin.MenuItem):
"""Add custom commands to the terminal menu"""
capabilities = ['terminal_menu']
def __init__(self):
plugin.MenuItem.__init__(self)
def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu"""
item = Gtk.MenuItem(_('Copy all to clipboard'))
item.connect("activate", self.copyall, terminal)
menuitems.append(item)
def copyall(self, _widget, terminal):
"""Select all text and copy it to the clipboard"""
terminal.vte.select_all()
terminal.vte.copy_clipboard()
terminal.vte.unselect_all()