Permalink
Browse files

Changes to make this plugin work with Terminator 1.91 and Ubuntu 16.04

  • Loading branch information...
Karol Tomala
Karol Tomala committed Oct 26, 2017
1 parent 1a2fc2e commit a89107bb9c83d266d87d94f93c658b4b67972ded
Showing with 8 additions and 3 deletions.
  1. +8 −3 searchplugin.py
View
@@ -1,4 +1,7 @@
import gtk
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
import urllib
import terminatorlib.plugin as plugin
import re
@@ -12,6 +15,8 @@
# AVAILABLE must contain a list of all the classes that you want exposed
AVAILABLE = ['SearchPlugin']
gtk = Gtk
_spaces = re.compile(" +")
# TODO: move some of the constants into a config object
@@ -25,15 +30,15 @@ def do_search(self, searchMenu):
return
base_uri = "http://www.google.com/search?q=%s"
uri = base_uri % urllib.quote(self.searchstring.encode("utf-8"))
gtk.show_uri(None, uri, gtk.gdk.CURRENT_TIME)
gtk.show_uri(None, uri, Gdk.CURRENT_TIME)
def callback(self, menuitems, menu, terminal):
"""Add our menu item to the menu"""
self.terminal = terminal
item = gtk.ImageMenuItem(gtk.STOCK_FIND)
item.connect('activate', self.do_search)
if terminal.vte.get_has_selection():
clip = gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY)
clip = gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
self.searchstring = clip.wait_for_text().strip()
self.searchstring = self.searchstring.replace("\n", " ")
self.searchstring = self.searchstring.replace("\t", " ")

0 comments on commit a89107b

Please sign in to comment.