Implemented the show/hide feature
added the following options to make terminator able to behave like a drop-down terminal: hide from taskbar always on top hide on lose focus (experimental) sticky (Show on all workspaces)
This commit is contained in:
parent
f02f08314e
commit
b956c0ede3
|
@ -85,6 +85,10 @@ DEFAULTS = {
|
|||
'close_button_on_tab' : True,
|
||||
'hide_tabbar' : False,
|
||||
'scroll_tabbar' : False,
|
||||
'hide_from_taskbar' : False,
|
||||
'always_on_top' : False,
|
||||
'hide_on_lose_focus' : False,
|
||||
'sticky' : False,
|
||||
'try_posix_regexp' : platform.system() != 'Linux',
|
||||
'title_transmit_fg_color' : '#ffffff',
|
||||
'title_transmit_bg_color' : '#c80003',
|
||||
|
|
|
@ -278,7 +278,7 @@
|
|||
<child>
|
||||
<object class="GtkTable" id="global_config_table">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">6</property>
|
||||
<property name="n_rows">10</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
|
@ -469,6 +469,126 @@
|
|||
<property name="x_padding">20</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label24">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Hide from taskbar</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hidefromtaskbcheck">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_hidefromtaskbcheck_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label25">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Always on top</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label26">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Hide on lose focus</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="alwaysontopcheck">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_alwaysontopcheck_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hideonlosefocuscheck">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_hideonlosefocuscheck_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label27">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show on all workspaces</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="stickycheck">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_stickycheck_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
|
@ -207,6 +207,18 @@ class PrefsEditor:
|
|||
else:
|
||||
active = 0
|
||||
widget.set_active(active)
|
||||
#Hide from taskbar
|
||||
widget = guiget('hidefromtaskbcheck')
|
||||
widget.set_active(self.config['hide_from_taskbar'])
|
||||
#Always on top
|
||||
widget = guiget('alwaysontopcheck')
|
||||
widget.set_active(self.config['always_on_top'])
|
||||
#Hide on lose focus
|
||||
widget = guiget('hideonlosefocuscheck')
|
||||
widget.set_active(self.config['hide_on_lose_focus'])
|
||||
#Show on all workspaces
|
||||
widget = guiget('stickycheck')
|
||||
widget.set_active(self.config['sticky'])
|
||||
|
||||
## Profile tab
|
||||
# Populate the profile list
|
||||
|
@ -496,6 +508,26 @@ class PrefsEditor:
|
|||
self.config['borderless'] = not widget.get_active()
|
||||
self.config.save()
|
||||
|
||||
def on_hidefromtaskbcheck_toggled(self, widget):
|
||||
"""Hide from taskbar setting changed"""
|
||||
self.config['hide_from_taskbar'] = widget.get_active()
|
||||
self.config.save()
|
||||
|
||||
def on_alwaysontopcheck_toggled(self, widget):
|
||||
"""Always on top setting changed"""
|
||||
self.config['always_on_top'] = widget.get_active()
|
||||
self.config.save()
|
||||
|
||||
def on_hideonlosefocuscheck_toggled(self, widget):
|
||||
"""Hide on lose focus setting changed"""
|
||||
self.config['hide_on_lose_focus'] = widget.get_active()
|
||||
self.config.save()
|
||||
|
||||
def on_stickycheck_toggled(self, widget):
|
||||
"""Sticky setting changed"""
|
||||
self.config['sticky'] = widget.get_active()
|
||||
self.config.save()
|
||||
|
||||
def on_allow_bold_checkbutton_toggled(self, widget):
|
||||
"""Allow bold setting changed"""
|
||||
self.config['allow_bold'] = widget.get_active()
|
||||
|
|
|
@ -145,7 +145,7 @@ class Terminator(Borg):
|
|||
window = maker.make('Window')
|
||||
terminal = maker.make('Terminal')
|
||||
window.add(terminal)
|
||||
window.show()
|
||||
window.show(True)
|
||||
terminal.spawn_child()
|
||||
|
||||
return(window, terminal)
|
||||
|
|
|
@ -32,8 +32,11 @@ class Window(Container, gtk.Window):
|
|||
title = None
|
||||
isfullscreen = None
|
||||
ismaximised = None
|
||||
iswithdrawn = None
|
||||
hidebound = None
|
||||
hidefunc = None
|
||||
position = None
|
||||
ignore_startup_show = None
|
||||
|
||||
zoom_data = None
|
||||
term_zoomed = gobject.property(type=bool, default=False)
|
||||
|
@ -99,6 +102,10 @@ class Window(Container, gtk.Window):
|
|||
fullscreen = self.config['window_state'] == 'fullscreen'
|
||||
hidden = self.config['window_state'] == 'hidden'
|
||||
borderless = self.config['borderless']
|
||||
skiptaskbar = self.config['hide_from_taskbar']
|
||||
alwaysontop = self.config['always_on_top']
|
||||
hideonlosefocus = self.config['hide_on_lose_focus']
|
||||
sticky = self.config['sticky']
|
||||
|
||||
if options:
|
||||
if options.maximise:
|
||||
|
@ -113,9 +120,13 @@ class Window(Container, gtk.Window):
|
|||
self.set_fullscreen(fullscreen)
|
||||
self.set_maximised(maximise)
|
||||
self.set_borderless(borderless)
|
||||
self.set_always_on_top(alwaysontop)
|
||||
self.set_hide_on_lose_focus(hideonlosefocus)
|
||||
self.set_real_transparency()
|
||||
self.set_sticky(sticky)
|
||||
if self.hidebound:
|
||||
self.set_hidden(hidden)
|
||||
self.set_skip_taskbar_hint(skiptaskbar)
|
||||
else:
|
||||
self.set_iconified(hidden)
|
||||
|
||||
|
@ -203,8 +214,18 @@ class Window(Container, gtk.Window):
|
|||
|
||||
def on_hide_window(self, data=None):
|
||||
"""Handle a request to hide/show the window"""
|
||||
# FIXME: Implement or drop, or explain why its empty
|
||||
pass
|
||||
if self.iswithdrawn == True:
|
||||
if self.position:
|
||||
self.move(self.position[0], self.position[1])
|
||||
self.present()
|
||||
else:
|
||||
self.position = self.get_position()
|
||||
self.hidefunc()
|
||||
|
||||
def on_lose_focus(self, widget, event):
|
||||
"""Handle when window lose focus"""
|
||||
self.position = self.get_position()
|
||||
self.hidefunc()
|
||||
|
||||
# pylint: disable-msg=W0613
|
||||
def on_window_state_changed(self, window, event):
|
||||
|
@ -213,8 +234,11 @@ class Window(Container, gtk.Window):
|
|||
gtk.gdk.WINDOW_STATE_FULLSCREEN)
|
||||
self.ismaximised = bool(event.new_window_state &
|
||||
gtk.gdk.WINDOW_STATE_MAXIMIZED)
|
||||
dbg('Window::on_window_state_changed: fullscreen=%s, maximised=%s' %
|
||||
(self.isfullscreen, self.ismaximised))
|
||||
self.iswithdrawn = bool(event.new_window_state &
|
||||
gtk.gdk.WINDOW_STATE_WITHDRAWN)
|
||||
dbg('Window::on_window_state_changed: fullscreen=%s, maximised=%s,\
|
||||
withdrawn=%s' %
|
||||
(self.isfullscreen, self.ismaximised, self.iswithdrawn))
|
||||
|
||||
return(False)
|
||||
|
||||
|
@ -238,13 +262,29 @@ class Window(Container, gtk.Window):
|
|||
|
||||
def set_hidden(self, value):
|
||||
"""Set the visibility of the window from the supplied value"""
|
||||
# FIXME: Implement or drop this
|
||||
pass
|
||||
if value == True:
|
||||
self.ignore_startup_show = True
|
||||
else:
|
||||
self.ignore_startup_show = False
|
||||
|
||||
def set_iconified(self, value):
|
||||
"""Set the minimised state of the window from the value"""
|
||||
# FIXME: Implement or drop this
|
||||
pass
|
||||
"""Set the minimised state of the window from the supplied value"""
|
||||
if value == True:
|
||||
self.iconify()
|
||||
|
||||
def set_always_on_top(self, value):
|
||||
"""Set the always on top window hint from the supplied value"""
|
||||
self.set_keep_above(value)
|
||||
|
||||
def set_sticky(self, value):
|
||||
"""Set the sticky hint from the supplied value"""
|
||||
if value == True:
|
||||
self.stick()
|
||||
|
||||
def set_hide_on_lose_focus(self,value):
|
||||
"""Registers the callback for lost focus from the supplied value"""
|
||||
if value == True:
|
||||
self.connect('focus-out-event', self.on_lose_focus)
|
||||
|
||||
def set_real_transparency(self, value=True):
|
||||
"""Enable RGBA if supported on the current screen"""
|
||||
|
@ -261,6 +301,14 @@ class Window(Container, gtk.Window):
|
|||
|
||||
if colormap:
|
||||
self.set_colormap(colormap)
|
||||
|
||||
def show(self, startup=False):
|
||||
"""Undo the startup show request if started in hidden mode"""
|
||||
gtk.Window.show(self)
|
||||
#Window must be shown, then hidden for the hotkeys to be registered
|
||||
if (self.ignore_startup_show and startup == True):
|
||||
self.hide()
|
||||
|
||||
|
||||
def add(self, widget):
|
||||
"""Add a widget to the window by way of gtk.Window.add()"""
|
||||
|
|
Loading…
Reference in New Issue