Skip to content

Commit

Permalink
initial work on gnome-terminator#74
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrose committed Oct 1, 2020
1 parent e9eb89e commit 50cb0b9
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions terminatorlib/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import signal
import gi
import cairo
from gi.repository import GLib, GObject, Pango, Gtk, Gdk, GdkPixbuf
gi.require_version('Vte', '2.91') # vte-0.38 (gnome-3.14)
from gi.repository import Vte
Expand All @@ -31,6 +32,21 @@
from terminatorlib.layoutlauncher import LayoutLauncher
from . import regex

class Overpaint(Vte.Terminal):
def dim(self,bool):
if bool:
self.overpaint = Gdk.RGBA(0.0,0.0,0.0,0.5)
else:
self.overpaint = Gdk.RGBA(0.0,0.0,0.0,0.0)

def do_draw(self,cr):
Vte.Terminal.do_draw(self,cr)
# self.overpaint = Gdk.RGBA(0.0,0.0,0.0,0.0)
cr.set_operator(cairo.Operator.OVER)
Gdk.cairo_set_source_rgba(cr,self.overpaint)
cr.rectangle(0.0,0.0,self.get_allocated_width(),self.get_allocated_height())
cr.paint()

# pylint: disable-msg=R0904
class Terminal(Gtk.VBox):
"""Class implementing the VTE widget and its wrappings"""
Expand Down Expand Up @@ -135,7 +151,9 @@ def __init__(self):

self.pending_on_vte_size_allocate = False

self.vte = Vte.Terminal()
# self.vte = Vte.Terminal()
self.vte = Overpaint()
self.vte.dim(False)
self.background_image = None
if self.config['background_image'] != '':
try:
Expand Down Expand Up @@ -1296,9 +1314,10 @@ def on_vte_focus(self, _widget):

def on_vte_focus_in(self, _widget, _event):
"""Inform other parts of the application when focus is received"""
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
self.palette_active)
self.set_cursor_color()
self.vte.dim(False)
#self.vte.set_colors(self.fgcolor_active, self.bgcolor,
# self.palette_active)
#self.set_cursor_color()
if not self.terminator.doing_layout:
self.terminator.last_focused_term = self
if self.get_toplevel().is_child_notebook():
Expand All @@ -1312,9 +1331,10 @@ def on_vte_focus_in(self, _widget, _event):

def on_vte_focus_out(self, _widget, _event):
"""Inform other parts of the application when focus is lost"""
self.vte.set_colors(self.fgcolor_inactive, self.bgcolor,
self.palette_inactive)
self.set_cursor_color()
self.vte.dim(True)
#self.vte.set_colors(self.fgcolor_inactive, self.bgcolor,
# self.palette_inactive)
#self.set_cursor_color()
self.emit('focus-out')

def on_window_focus_out(self):
Expand Down

0 comments on commit 50cb0b9

Please sign in to comment.