If a profile is configured to not show the titlebar, actually only show 2px of it until it's clicked on. Poor man's autohide, but it achieves all of my objectives - the colour is hinted to people with no visible titlebar and they can still summon the grouping menu
This commit is contained in:
parent
1a6f659a40
commit
f4b1c2cce0
|
@ -78,7 +78,6 @@ class Terminal(gtk.VBox):
|
|||
scrollbar_position = None
|
||||
titlebar = None
|
||||
searchbar = None
|
||||
border_boxes = None
|
||||
|
||||
group = None
|
||||
cwd = None
|
||||
|
@ -142,6 +141,7 @@ class Terminal(gtk.VBox):
|
|||
self.titlebar.connect('edit-done', self.on_edit_done)
|
||||
self.connect('title-change', self.titlebar.set_terminal_title)
|
||||
self.titlebar.connect('create-group', self.really_create_group)
|
||||
self.titlebar.show_all()
|
||||
|
||||
self.searchbar = Searchbar()
|
||||
self.searchbar.connect('end-search', self.on_search_done)
|
||||
|
@ -184,9 +184,6 @@ class Terminal(gtk.VBox):
|
|||
def create_terminalbox(self):
|
||||
"""Create a GtkHBox containing the terminal and a scrollbar"""
|
||||
|
||||
ebox1 = gtk.EventBox()
|
||||
ebox2 = gtk.EventBox()
|
||||
ebox1.add(ebox2)
|
||||
terminalbox = gtk.HBox()
|
||||
self.scrollbar = gtk.VScrollbar(self.vte.get_adjustment())
|
||||
self.scrollbar.set_no_show_all(True)
|
||||
|
@ -202,19 +199,9 @@ class Terminal(gtk.VBox):
|
|||
|
||||
func(self.vte)
|
||||
func(self.scrollbar, False)
|
||||
ebox2.add(terminalbox)
|
||||
ebox1.show_all()
|
||||
terminalbox.show_all()
|
||||
|
||||
self.border_boxes = (ebox1, ebox2)
|
||||
return(ebox1)
|
||||
|
||||
def terminal_border(self, width, colour=None):
|
||||
"""Show a border around the terminal and optionally colour it in"""
|
||||
ebox1, ebox2 = self.border_boxes
|
||||
|
||||
ebox2.set_border_width(width)
|
||||
if colour:
|
||||
ebox1.modify_bg(gtk.STATE_NORMAL, colour)
|
||||
return(terminalbox)
|
||||
|
||||
def update_url_matches(self, posix = True):
|
||||
"""Update the regexps used to match URLs"""
|
||||
|
@ -664,10 +651,6 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
self.config['alternate_screen_scroll'])
|
||||
|
||||
self.titlebar.update()
|
||||
if self.config['show_titlebar'] == True:
|
||||
self.titlebar.show()
|
||||
else:
|
||||
self.titlebar.hide()
|
||||
self.vte.queue_draw()
|
||||
|
||||
def get_window_title(self):
|
||||
|
|
|
@ -87,8 +87,7 @@ class Titlebar(gtk.EventBox):
|
|||
self.add(hbox)
|
||||
hbox.show_all()
|
||||
self.set_no_show_all(True)
|
||||
if self.config['show_titlebar'] == True:
|
||||
self.show()
|
||||
self.show()
|
||||
|
||||
self.connect('button-press-event', self.on_clicked)
|
||||
|
||||
|
@ -146,18 +145,28 @@ class Titlebar(gtk.EventBox):
|
|||
gtk.gdk.color_parse(group_fg))
|
||||
self.modify_bg(gtk.STATE_NORMAL,
|
||||
gtk.gdk.color_parse(title_bg))
|
||||
if not self.get_property('visible'):
|
||||
if not self.get_desired_visibility():
|
||||
if default_bg == True:
|
||||
color = term.get_style().bg[gtk.STATE_NORMAL]
|
||||
else:
|
||||
color = gtk.gdk.color_parse(title_bg)
|
||||
term.terminal_border(2, color)
|
||||
self.set_size_request(-1, 2)
|
||||
self.label.hide()
|
||||
else:
|
||||
term.terminal_border(0)
|
||||
self.set_size_request(-1, -1)
|
||||
self.label.show()
|
||||
self.ebox.modify_bg(gtk.STATE_NORMAL,
|
||||
gtk.gdk.color_parse(group_bg))
|
||||
self.set_from_icon_name(icon, gtk.ICON_SIZE_MENU)
|
||||
|
||||
def get_desired_visibility(self):
|
||||
"""Returns True if the titlebar is supposed to be visible. False if
|
||||
not"""
|
||||
if self.editing() == True:
|
||||
return(True)
|
||||
else:
|
||||
return(self.config['show_titlebar'])
|
||||
|
||||
def set_from_icon_name(self, name, size = gtk.ICON_SIZE_MENU):
|
||||
"""Set an icon for the group label"""
|
||||
if not name:
|
||||
|
@ -189,6 +198,8 @@ class Titlebar(gtk.EventBox):
|
|||
|
||||
def on_clicked(self, widget, event):
|
||||
"""Handle a click on the label"""
|
||||
self.set_size_request(-1, -1)
|
||||
self.label.show()
|
||||
self.emit('clicked')
|
||||
|
||||
def on_edit_done(self, widget):
|
||||
|
|
Loading…
Reference in New Issue