launch new layouts directly from right-click menu

This commit is contained in:
Matt Rose 2020-06-17 14:11:20 -04:00
parent fae95a7e13
commit da53f25b52
1 changed files with 8 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from .version import APP_NAME
from .translation import _ from .translation import _
from .encoding import TerminatorEncoding from .encoding import TerminatorEncoding
from .terminator import Terminator from .terminator import Terminator
from .util import err, dbg from .util import err, dbg, spawn_new_terminator
from .config import Config from .config import Config
from .prefseditor import PrefsEditor from .prefseditor import PrefsEditor
from . import plugin from . import plugin
@ -238,8 +238,14 @@ class TerminalPopupMenu(object):
def add_layout_launcher(self, menu): def add_layout_launcher(self, menu):
"""Add the layout list to the menu""" """Add the layout list to the menu"""
item = Gtk.MenuItem.new_with_mnemonic(_('_Layouts...')) item = Gtk.MenuItem.new_with_mnemonic(_('_Layouts...'))
item.connect('activate', lambda x: LayoutLauncher())
menu.append(item) menu.append(item)
submenu = Gtk.Menu()
item.set_submenu(submenu)
layouts = self.config.list_layouts()
for layout in layouts:
item = Gtk.MenuItem(layout)
item.connect('activate', lambda x: spawn_new_terminator(self.terminator.origcwd, ['-u', '-l', layout]))
submenu.append(item)
def add_encoding_items(self, menu): def add_encoding_items(self, menu):
"""Add the encoding list to the menu""" """Add the encoding list to the menu"""