ok, já que não parece possível, eu montei um proto-plugin para o gedit2 que funciona para mim no momento. Eu ainda espero que alguém tenha uma resposta melhor ...
~ / .gnome2 / gedit / plugins / mimeprefs.py
import gedit
class MimePrefsPlugin(gedit.Plugin):
def __init__(self):
gedit.Plugin.__init__(self)
def activate(self, window):
pass
def deactivate(self, window):
pass
def update_ui(self, window):
doc = window.get_active_document()
try:
mt = doc.get_mime_type()
except AttributeError:
return
view = window.get_active_view()
if 'x-tex' in mt:
view.set_font(False, 'Garamond 14')
elif 'x-python' in mt:
view.set_font(False, 'Monospace 12')
else:
view.set_font(True, 'Monospace 10')
~ / .gnome2 / gedit / plugins / mimeprefs.gedit-plugin
[Gedit Plugin]
Loader=python
Module=mimeprefs
IAge=2
Name=Mime-Prefs v1
Description=A plugin to set font preferences based on the mimetype of the document
Authors=-
Copyright=Public Domain
Website=None
EDIT: atualização para o gedit3:
os arquivos do plugin entram em ~/.local/share/gedit/plugins/
e são assim:
mimeprefs.plugin:
[Plugin]
Loader=python
Module=mimeprefs
IAge=3
Name=Mime-Prefs
Description=A plugin to set font preferences based on the mimetype of the document
Authors=Stefan Schwarzburg
Copyright=Public Domain
Website=None
Version=1.0.0
mimeprefs.py:
from gi.repository import GObject, Gedit
class MimePrefsPlugin(GObject.Object, Gedit.WindowActivatable):
__gtype_name__ = "MimePrefsPlugin"
window = GObject.property(type=Gedit.Window)
def __init__(self):
GObject.Object.__init__(self)
def do_activate(self):
pass
def do_deactivate(self):
pass
def do_update_state(self):
doc = self.window.get_active_document()
try:
mt = doc.get_mime_type()
except AttributeError:
return
view = self.window.get_active_view()
if 'x-tex' in mt:
view.set_font(False, 'Garamond 14')
elif 'x-python' in mt:
view.set_font(False, 'Monospace 12')
else:
view.set_font(True, 'Monospace 10')