Merge a branch from Stephen J Boddy. Adds some missing manpage entries. Allows setting of the WM_CLASS. Allows setting a custom window icon.
This commit is contained in:
commit
1981a39941
|
@ -56,10 +56,22 @@ Set the terminal's working directory
|
||||||
.B \-r, \-\-role=ROLE
|
.B \-r, \-\-role=ROLE
|
||||||
Set a custom WM_WINDOW_ROLE property on the window
|
Set a custom WM_WINDOW_ROLE property on the window
|
||||||
.TP
|
.TP
|
||||||
|
.B \-c, \-\-classname=CLASSNAME
|
||||||
|
Set a custom name (WM_CLASS) property on the window
|
||||||
|
.TP
|
||||||
.B \-l, \-\-layout=LAYOUT
|
.B \-l, \-\-layout=LAYOUT
|
||||||
Start Terminator with a specific layout. The argument here is the name
|
Start Terminator with a specific layout. The argument here is the name
|
||||||
of a saved layout.
|
of a saved layout.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-p, \-\-profile=PROFILE
|
||||||
|
Use a different profile as the default
|
||||||
|
.TP
|
||||||
|
.B \-i, \-\-icon=FORCEDICON
|
||||||
|
Set a custom icon for the window (by file or name)
|
||||||
|
.TP
|
||||||
|
.B \-u, \-\-no-dbus
|
||||||
|
Disable DBus
|
||||||
|
.TP
|
||||||
.B \-d, \-\-debug
|
.B \-d, \-\-debug
|
||||||
Enable debugging output (please use this when reporting bugs). This
|
Enable debugging output (please use this when reporting bugs). This
|
||||||
can be specified twice to enable a built-in python debugging server.
|
can be specified twice to enable a built-in python debugging server.
|
||||||
|
|
|
@ -66,9 +66,13 @@ command to execute inside the terminal, and its arguments'))
|
||||||
dest='working_directory', help=_('Set the working directory'))
|
dest='working_directory', help=_('Set the working directory'))
|
||||||
parser.add_option('-r', '--role', dest='role', help=_('Set a custom \
|
parser.add_option('-r', '--role', dest='role', help=_('Set a custom \
|
||||||
WM_WINDOW_ROLE property on the window'))
|
WM_WINDOW_ROLE property on the window'))
|
||||||
|
parser.add_option('-c', '--classname', dest='classname', help=_('Set a \
|
||||||
|
custom name (WM_CLASS) property on the window'))
|
||||||
parser.add_option('-l', '--layout', dest='layout', help=_('Select a layout'))
|
parser.add_option('-l', '--layout', dest='layout', help=_('Select a layout'))
|
||||||
parser.add_option('-p', '--profile', dest='profile', help=_('Use a \
|
parser.add_option('-p', '--profile', dest='profile', help=_('Use a \
|
||||||
different profile as the default'))
|
different profile as the default'))
|
||||||
|
parser.add_option('-i', '--icon', dest='forcedicon', help=_('Set a custom \
|
||||||
|
icon for the window (by file or name)'))
|
||||||
parser.add_option('-u', '--no-dbus', action='store_true', dest='nodbus',
|
parser.add_option('-u', '--no-dbus', action='store_true', dest='nodbus',
|
||||||
help=_('Disable DBus'))
|
help=_('Disable DBus'))
|
||||||
parser.add_option('-d', '--debug', action='count', dest='debug',
|
parser.add_option('-d', '--debug', action='count', dest='debug',
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Window(Container, gtk.Window):
|
||||||
self.register_signals(Window)
|
self.register_signals(Window)
|
||||||
|
|
||||||
self.set_property('allow-shrink', True)
|
self.set_property('allow-shrink', True)
|
||||||
self.apply_icon()
|
icon_to_apply=''
|
||||||
|
|
||||||
self.register_callbacks()
|
self.register_callbacks()
|
||||||
self.apply_config()
|
self.apply_config()
|
||||||
|
@ -76,12 +76,19 @@ class Window(Container, gtk.Window):
|
||||||
|
|
||||||
if options.role is not None:
|
if options.role is not None:
|
||||||
self.set_role(options.role)
|
self.set_role(options.role)
|
||||||
|
|
||||||
|
if options.classname is not None:
|
||||||
|
self.set_wmclass(options.classname, self.wmclass_class)
|
||||||
|
|
||||||
|
if options.forcedicon is not None:
|
||||||
|
icon_to_apply = options.forcedicon
|
||||||
|
|
||||||
if options.geometry is not None:
|
if options.geometry is not None:
|
||||||
if not self.parse_geometry(options.geometry):
|
if not self.parse_geometry(options.geometry):
|
||||||
err('Window::__init__: Unable to parse geometry: %s' %
|
err('Window::__init__: Unable to parse geometry: %s' %
|
||||||
options.geometry)
|
options.geometry)
|
||||||
|
|
||||||
|
self.apply_icon(icon_to_apply)
|
||||||
self.pending_set_rough_geometry_hint = False
|
self.pending_set_rough_geometry_hint = False
|
||||||
|
|
||||||
def do_get_property(self, prop):
|
def do_get_property(self, prop):
|
||||||
|
@ -156,15 +163,36 @@ class Window(Container, gtk.Window):
|
||||||
else:
|
else:
|
||||||
self.set_iconified(hidden)
|
self.set_iconified(hidden)
|
||||||
|
|
||||||
def apply_icon(self):
|
def apply_icon(self, requested_icon):
|
||||||
"""Set the window icon"""
|
"""Set the window icon"""
|
||||||
icon_theme = gtk.IconTheme()
|
icon_theme = gtk.IconTheme()
|
||||||
|
icon = None
|
||||||
try:
|
|
||||||
icon = icon_theme.load_icon(APP_NAME, 48, 0)
|
if requested_icon:
|
||||||
except (NameError, gobject.GError):
|
try:
|
||||||
dbg('Unable to load 48px Terminator icon')
|
self.set_icon_from_file(requested_icon)
|
||||||
icon = self.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)
|
icon = self.get_icon()
|
||||||
|
except (NameError, gobject.GError):
|
||||||
|
dbg('Unable to load 48px %s icon as file' % (repr(requested_icon)))
|
||||||
|
|
||||||
|
if requested_icon and icon is None:
|
||||||
|
try:
|
||||||
|
icon = icon_theme.load_icon(requested_icon, 48, 0)
|
||||||
|
except (NameError, gobject.GError):
|
||||||
|
dbg('Unable to load 48px %s icon' % (repr(requested_icon)))
|
||||||
|
|
||||||
|
if icon is None:
|
||||||
|
try:
|
||||||
|
icon = icon_theme.load_icon(self.wmclass_name, 48, 0)
|
||||||
|
except (NameError, gobject.GError):
|
||||||
|
dbg('Unable to load 48px %s icon' % (self.wmclass_name))
|
||||||
|
|
||||||
|
if icon is None:
|
||||||
|
try:
|
||||||
|
icon = icon_theme.load_icon(APP_NAME, 48, 0)
|
||||||
|
except (NameError, gobject.GError):
|
||||||
|
dbg('Unable to load 48px Terminator icon')
|
||||||
|
icon = self.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)
|
||||||
|
|
||||||
self.set_icon(icon)
|
self.set_icon(icon)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue