(trunk-1573) Global setting for changing the titlebar font (partially from Eli Zor branch), but expanded and improved (docs/GUI), plus some minor fixup from this.
This commit is contained in:
parent
e97f669b6e
commit
cf81fe937a
|
@ -118,6 +118,14 @@ Default value: \fB'#000000'\fR
|
||||||
Sets the colour of the background of the titlebar of any terminal that will \fBnot\fR receive input from the active terminal.
|
Sets the colour of the background of the titlebar of any terminal that will \fBnot\fR receive input from the active terminal.
|
||||||
Default value: \fB'#C0BEBF'\fR
|
Default value: \fB'#C0BEBF'\fR
|
||||||
.TP
|
.TP
|
||||||
|
.B title_use_system_font \fR(boolean)
|
||||||
|
Whether or not to use the GNOME default proportional font for titlebars.
|
||||||
|
Default value: \fBTrue\fR
|
||||||
|
.TP
|
||||||
|
.B title_font \fR(string)
|
||||||
|
An Pango font name. Examples are "Sans 12" or "Monospace Bold 14".
|
||||||
|
Default value: \fB"Sans 9"\fR
|
||||||
|
.TP
|
||||||
.B inactive_color_offset
|
.B inactive_color_offset
|
||||||
Controls how much to reduce the colour values of fonts in terminals that do not have focus. It is a simple multiplication
|
Controls how much to reduce the colour values of fonts in terminals that do not have focus. It is a simple multiplication
|
||||||
factor. A font colour that was RGB(200,200,200) with an inactive_color_offset of 0.5 would set inactive terminals to
|
factor. A font colour that was RGB(200,200,200) with an inactive_color_offset of 0.5 would set inactive terminals to
|
||||||
|
@ -388,7 +396,7 @@ Default value: \fBTrue\fR
|
||||||
.TP
|
.TP
|
||||||
.B font
|
.B font
|
||||||
An Pango font name. Examples are "Sans 12" or "Monospace Bold 14".
|
An Pango font name. Examples are "Sans 12" or "Monospace Bold 14".
|
||||||
Default value: \fBMono 8\fR
|
Default value: \fBMono 10\fR
|
||||||
.TP
|
.TP
|
||||||
.B foreground_color
|
.B foreground_color
|
||||||
Default colour of text in the terminal, as a colour specification (can be HTML-style hex digits, or a colour name such as "red"). \fBNote:\fR You may need to set \fBuse_theme_colors=False\fR to force this setting to take effect.
|
Default colour of text in the terminal, as a colour specification (can be HTML-style hex digits, or a colour name such as "red"). \fBNote:\fR You may need to set \fBuse_theme_colors=False\fR to force this setting to take effect.
|
||||||
|
|
|
@ -119,6 +119,8 @@ DEFAULTS = {
|
||||||
'APTURLHandler'],
|
'APTURLHandler'],
|
||||||
'suppress_multiple_term_dialog': False,
|
'suppress_multiple_term_dialog': False,
|
||||||
'always_split_with_profile': False,
|
'always_split_with_profile': False,
|
||||||
|
'title_use_system_font' : True,
|
||||||
|
'title_font' : 'Sans 9',
|
||||||
},
|
},
|
||||||
'keybindings': {
|
'keybindings': {
|
||||||
'zoom_in' : '<Control>plus',
|
'zoom_in' : '<Control>plus',
|
||||||
|
@ -259,7 +261,8 @@ class Config(object):
|
||||||
base = None
|
base = None
|
||||||
profile = None
|
profile = None
|
||||||
gconf = None
|
gconf = None
|
||||||
system_font = None
|
system_mono_font = None
|
||||||
|
system_prop_font = None
|
||||||
system_focus = None
|
system_focus = None
|
||||||
inhibited = None
|
inhibited = None
|
||||||
|
|
||||||
|
@ -341,38 +344,56 @@ class Config(object):
|
||||||
"""List all configured layouts"""
|
"""List all configured layouts"""
|
||||||
return(self.base.layouts.keys())
|
return(self.base.layouts.keys())
|
||||||
|
|
||||||
def get_system_font(self):
|
def get_system_prop_font(self):
|
||||||
"""Look up the system font"""
|
"""Look up the system font"""
|
||||||
if self.system_font is not None:
|
if self.system_prop_font is not None:
|
||||||
return(self.system_font)
|
return(self.system_prop_font)
|
||||||
elif 'gconf' not in globals():
|
elif 'GConf' not in globals():
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if self.gconf is None:
|
if self.gconf is None:
|
||||||
self.gconf = GConf.Client.get_default()
|
self.gconf = GConf.Client.get_default()
|
||||||
|
|
||||||
value = self.GConf.get(
|
value = self.gconf.get(
|
||||||
|
'/desktop/gnome/interface/font_name')
|
||||||
|
self.system_prop_font = value.get_string()
|
||||||
|
self.gconf.notify_add(
|
||||||
|
'/desktop/gnome/interface/font_name',
|
||||||
|
self.on_gconf_notify)
|
||||||
|
return(self.system_prop_font)
|
||||||
|
|
||||||
|
def get_system_mono_font(self):
|
||||||
|
"""Look up the system font"""
|
||||||
|
if self.system_mono_font is not None:
|
||||||
|
return(self.system_mono_font)
|
||||||
|
elif 'GConf' not in globals():
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if self.gconf is None:
|
||||||
|
self.gconf = GConf.Client.get_default()
|
||||||
|
|
||||||
|
value = self.gconf.get(
|
||||||
'/desktop/gnome/interface/monospace_font_name')
|
'/desktop/gnome/interface/monospace_font_name')
|
||||||
self.system_font = value.get_string()
|
self.system_mono_font = value.get_string()
|
||||||
self.GConf.notify_add(
|
self.gconf.notify_add(
|
||||||
'/desktop/gnome/interface/monospace_font_name',
|
'/desktop/gnome/interface/monospace_font_name',
|
||||||
self.on_gconf_notify)
|
self.on_gconf_notify)
|
||||||
return(self.system_font)
|
return(self.system_mono_font)
|
||||||
|
|
||||||
def get_system_focus(self):
|
def get_system_focus(self):
|
||||||
"""Look up the system focus setting"""
|
"""Look up the system focus setting"""
|
||||||
if self.system_focus is not None:
|
if self.system_focus is not None:
|
||||||
return(self.system_focus)
|
return(self.system_focus)
|
||||||
elif 'gconf' not in globals():
|
elif 'GConf' not in globals():
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if self.gconf is None:
|
if self.gconf is None:
|
||||||
self.gconf = GConf.Client.get_default()
|
self.gconf = GConf.Client.get_default()
|
||||||
|
|
||||||
value = self.GConf.get('/apps/metacity/general/focus_mode')
|
value = self.gconf.get('/apps/metacity/general/focus_mode')
|
||||||
if value:
|
if value:
|
||||||
self.system_focus = value.get_string()
|
self.system_focus = value.get_string()
|
||||||
self.GConf.notify_add('/apps/metacity/general/focus_mode',
|
self.gconf.notify_add('/apps/metacity/general/focus_mode',
|
||||||
self.on_gconf_notify)
|
self.on_gconf_notify)
|
||||||
return(self.system_focus)
|
return(self.system_focus)
|
||||||
|
|
||||||
|
|
|
@ -150,4 +150,9 @@ class EditableLabel(Gtk.EventBox):
|
||||||
def set_custom(self):
|
def set_custom(self):
|
||||||
"""Set the customness of the string to True"""
|
"""Set the customness of the string to True"""
|
||||||
self._custom = True
|
self._custom = True
|
||||||
|
|
||||||
|
def modify_font(self, fontdesc):
|
||||||
|
"""Set the label font using a pango.FontDescription"""
|
||||||
|
self._label.modify_font(fontdesc)
|
||||||
|
|
||||||
GObject.type_register(EditableLabel)
|
GObject.type_register(EditableLabel)
|
||||||
|
|
|
@ -1243,6 +1243,7 @@
|
||||||
<object class="GtkTable" id="table10">
|
<object class="GtkTable" id="table10">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="n_rows">3</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
<property name="column_spacing">12</property>
|
<property name="column_spacing">12</property>
|
||||||
<property name="row_spacing">6</property>
|
<property name="row_spacing">6</property>
|
||||||
|
@ -1259,6 +1260,78 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
<property name="y_options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="title_system_font_checkbutton">
|
||||||
|
<property name="label" translatable="yes">_Use the system font</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="on_title_system_font_checkbutton_toggled" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
<property name="y_options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment9">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkHBox" id="font_hbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="font_selector_label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">_Font:</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">font_selector</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFontButton" id="title_font_selector">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="focus_on_click">False</property>
|
||||||
|
<property name="title" translatable="yes">Choose A Titlebar Font</property>
|
||||||
|
<property name="use_font">True</property>
|
||||||
|
<signal name="font-set" handler="on_title_font_selector_font_set" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="bottom_attach">3</property>
|
||||||
<property name="y_options"/>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
|
@ -284,6 +284,19 @@ class PrefsEditor:
|
||||||
#Always split with profile
|
#Always split with profile
|
||||||
widget = guiget('always_split_with_profile')
|
widget = guiget('always_split_with_profile')
|
||||||
widget.set_active(self.config['always_split_with_profile'])
|
widget.set_active(self.config['always_split_with_profile'])
|
||||||
|
#Titlebar font selector
|
||||||
|
# Use system font
|
||||||
|
widget = guiget('title_system_font_checkbutton')
|
||||||
|
widget.set_active(self.config['title_use_system_font'])
|
||||||
|
self.on_title_system_font_checkbutton_toggled(widget)
|
||||||
|
# Font selector
|
||||||
|
widget = guiget('title_font_selector')
|
||||||
|
if self.config['title_use_system_font'] == True:
|
||||||
|
fontname = self.config.get_system_prop_font()
|
||||||
|
if fontname is not None:
|
||||||
|
widget.set_font_name(fontname)
|
||||||
|
else:
|
||||||
|
widget.set_font_name(self.config['title_font'])
|
||||||
|
|
||||||
## Profile tab
|
## Profile tab
|
||||||
# Populate the profile list
|
# Populate the profile list
|
||||||
|
@ -372,7 +385,7 @@ class PrefsEditor:
|
||||||
widget = guiget('font_selector')
|
widget = guiget('font_selector')
|
||||||
|
|
||||||
if self.config['use_system_font'] == True:
|
if self.config['use_system_font'] == True:
|
||||||
fontname = self.config.get_system_font()
|
fontname = self.config.get_system_mono_font()
|
||||||
if fontname is not None:
|
if fontname is not None:
|
||||||
widget.set_font_name(fontname)
|
widget.set_font_name(fontname)
|
||||||
else:
|
else:
|
||||||
|
@ -895,6 +908,11 @@ class PrefsEditor:
|
||||||
self.config['font'] = widget.get_font_name()
|
self.config['font'] = widget.get_font_name()
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
def on_title_font_selector_font_set(self, widget):
|
||||||
|
"""Titlebar Font changed"""
|
||||||
|
self.config['title_font'] = widget.get_font_name()
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
def on_title_receive_bg_color_color_set(self, widget):
|
def on_title_receive_bg_color_color_set(self, widget):
|
||||||
"""Title receive background colour changed"""
|
"""Title receive background colour changed"""
|
||||||
self.config['title_receive_bg_color'] = color2hex(widget)
|
self.config['title_receive_bg_color'] = color2hex(widget)
|
||||||
|
@ -1115,6 +1133,31 @@ class PrefsEditor:
|
||||||
self.config['use_system_font'] = value
|
self.config['use_system_font'] = value
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
if self.config['use_system_font'] == True:
|
||||||
|
fontname = self.config.get_system_mono_font()
|
||||||
|
if fontname is not None:
|
||||||
|
widget.set_font_name(fontname)
|
||||||
|
else:
|
||||||
|
widget.set_font_name(self.config['font'])
|
||||||
|
|
||||||
|
def on_title_system_font_checkbutton_toggled(self, checkbox):
|
||||||
|
"""Toggling the title_use_system_font checkbox needs to alter the
|
||||||
|
sensitivity of the font selector"""
|
||||||
|
guiget = self.builder.get_object
|
||||||
|
widget = guiget('title_font_selector')
|
||||||
|
value = checkbox.get_active()
|
||||||
|
|
||||||
|
widget.set_sensitive(not value)
|
||||||
|
self.config['title_use_system_font'] = value
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
|
if self.config['title_use_system_font'] == True:
|
||||||
|
fontname = self.config.get_system_prop_font()
|
||||||
|
if fontname is not None:
|
||||||
|
widget.set_font_name(fontname)
|
||||||
|
else:
|
||||||
|
widget.set_font_name(self.config['title_font'])
|
||||||
|
|
||||||
def on_reset_compatibility_clicked(self, widget):
|
def on_reset_compatibility_clicked(self, widget):
|
||||||
"""Reset the confusing and annoying backspace/delete options to the
|
"""Reset the confusing and annoying backspace/delete options to the
|
||||||
safest values"""
|
safest values"""
|
||||||
|
|
|
@ -623,7 +623,7 @@ class Terminal(Gtk.VBox):
|
||||||
if not self.custom_font_size:
|
if not self.custom_font_size:
|
||||||
try:
|
try:
|
||||||
if self.config['use_system_font'] == True:
|
if self.config['use_system_font'] == True:
|
||||||
font = self.config.get_system_font()
|
font = self.config.get_system_mono_font()
|
||||||
else:
|
else:
|
||||||
font = self.config['font']
|
font = self.config['font']
|
||||||
self.set_font(Pango.FontDescription(font))
|
self.set_font(Pango.FontDescription(font))
|
||||||
|
@ -1427,7 +1427,7 @@ class Terminal(Gtk.VBox):
|
||||||
def zoom_orig(self):
|
def zoom_orig(self):
|
||||||
"""Restore original font size"""
|
"""Restore original font size"""
|
||||||
if self.config['use_system_font'] == True:
|
if self.config['use_system_font'] == True:
|
||||||
font = self.config.get_system_font()
|
font = self.config.get_system_mono_font()
|
||||||
else:
|
else:
|
||||||
font = self.config['font']
|
font = self.config['font']
|
||||||
dbg("Terminal::zoom_orig: restoring font to: %s" % font)
|
dbg("Terminal::zoom_orig: restoring font to: %s" % font)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
from gi.repository import Gtk, Gdk
|
from gi.repository import Gtk, Gdk
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
from gi.repository import Pango
|
||||||
import random
|
import random
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
@ -106,6 +107,13 @@ class Titlebar(Gtk.EventBox):
|
||||||
else:
|
else:
|
||||||
self.label.set_text("%s %s" % (self.termtext, self.sizetext))
|
self.label.set_text("%s %s" % (self.termtext, self.sizetext))
|
||||||
|
|
||||||
|
if (not self.config['title_use_system_font']) and self.config['title_font']:
|
||||||
|
title_font = Pango.FontDescription(self.config['title_font'])
|
||||||
|
else:
|
||||||
|
title_font = Pango.FontDescription(self.config.get_system_prop_font())
|
||||||
|
self.label.modify_font(title_font)
|
||||||
|
self.grouplabel.modify_font(title_font)
|
||||||
|
|
||||||
if other:
|
if other:
|
||||||
term = self.terminal
|
term = self.terminal
|
||||||
terminator = self.terminator
|
terminator = self.terminator
|
||||||
|
|
Loading…
Reference in New Issue