diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 4abc564b..1d62254c 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -250,6 +250,8 @@ DEFAULTS = { 'autoclean_groups' : True, 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], + 'background_image' : '', + 'background_alpha' : 0.0 }, }, 'layouts': { diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 95bbf473..c02dc27f 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -135,7 +135,14 @@ class Terminal(Gtk.VBox): self.pending_on_vte_size_allocate = False self.vte = Vte.Terminal() - self.background_image = GdkPixbuf.Pixbuf.new_from_file("/Users/mattrose/test.jpg") + self.background_image = None + if self.config['background_image'] != '': + try: + self.background_image = GdkPixbuf.Pixbuf.new_from_file(self.config['background_image']) + except Exception: + pass + + self.background_alpha = self.config['background_alpha'] self.vte.set_allow_hyperlink(True) self.vte._draw_data = None if not hasattr(self.vte, "set_opacity") or \ @@ -1128,6 +1135,11 @@ class Terminal(Gtk.VBox): widget._draw_data = None def background_draw(self, widget, cr): + if not self.background_image: + return(False) + print("bgcolor obj: %s" % self.bgcolor.alpha) + over = self.bgcolor + over.alpha = self.background_alpha rect = self.vte.get_allocation() xratio = float(rect.width) / float(self.background_image.get_width()) yratio = float(rect.height) / float(self.background_image.get_height()) @@ -1135,6 +1147,8 @@ class Terminal(Gtk.VBox): cr.scale(xratio,yratio) Gdk.cairo_set_source_pixbuf(cr, self.background_image, 0, 0) cr.paint() + Gdk.cairo_set_source_rgba(cr,over) + cr.paint() cr.restore() def on_draw(self, widget, context):