ctl-shift-v now pastes gtk/gnome clipboard to multiple terminals. github#12
This commit is contained in:
parent
edfa01e3e7
commit
2c1d53f5c6
20
crussh.py
20
crussh.py
@ -265,9 +265,23 @@ class CruSSH:
|
|||||||
self.EntryBox.set_visibility(False)
|
self.EntryBox.set_visibility(False)
|
||||||
self.EntryBox.set_invisible_char(' ')
|
self.EntryBox.set_invisible_char(' ')
|
||||||
|
|
||||||
|
# feed GNOME clipboard to all active terminals
|
||||||
|
def feed_paste(widget):
|
||||||
|
for host in self.Terminals:
|
||||||
|
if self.Terminals[host].copy_input:
|
||||||
|
self.Terminals[host].feed_child(self.Clipboard.wait_for_text())
|
||||||
|
self.EntryBox.props.buffer.delete_text(0, -1)
|
||||||
|
|
||||||
# forward key events to all terminals with copy_input set
|
# forward key events to all terminals with copy_input set
|
||||||
def feed_input(widget, event):
|
def feed_input(widget, event):
|
||||||
self.EntryBox.props.buffer.delete_text(0, -1)
|
self.EntryBox.props.buffer.delete_text(0, -1)
|
||||||
|
# check for paste key shortcut (ctl-shift-v)
|
||||||
|
if (event.type == gtk.gdk.KEY_PRESS) \
|
||||||
|
and (event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK) \
|
||||||
|
and (event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK) \
|
||||||
|
and (event.keyval == 86):
|
||||||
|
feed_paste(widget)
|
||||||
|
else:
|
||||||
# propagate to every terminal
|
# propagate to every terminal
|
||||||
for host in self.Terminals:
|
for host in self.Terminals:
|
||||||
t_event = event.copy()
|
t_event = event.copy()
|
||||||
@ -276,12 +290,6 @@ class CruSSH:
|
|||||||
# this stops regular handler from firing, switching focus.
|
# this stops regular handler from firing, switching focus.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def feed_paste(widget):
|
|
||||||
for host in self.Terminals:
|
|
||||||
if self.Terminals[host].copy_input:
|
|
||||||
self.Terminals[host].feed_child(self.Clipboard.wait_for_text())
|
|
||||||
self.EntryBox.props.buffer.delete_text(0, -1)
|
|
||||||
|
|
||||||
def click_handler(widget, event):
|
def click_handler(widget, event):
|
||||||
# if middle click
|
# if middle click
|
||||||
if event.button == 2:
|
if event.button == 2:
|
||||||
|
Loading…
Reference in New Issue
Block a user