From da53f25b5275415ef50bb1b166f55c6471eb1f36 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Wed, 17 Jun 2020 14:11:20 -0400 Subject: [PATCH] launch new layouts directly from right-click menu --- terminatorlib/terminal_popup_menu.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index a0ab5393..29ca7751 100644 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -9,7 +9,7 @@ from .version import APP_NAME from .translation import _ from .encoding import TerminatorEncoding from .terminator import Terminator -from .util import err, dbg +from .util import err, dbg, spawn_new_terminator from .config import Config from .prefseditor import PrefsEditor from . import plugin @@ -238,8 +238,14 @@ class TerminalPopupMenu(object): def add_layout_launcher(self, menu): """Add the layout list to the menu""" item = Gtk.MenuItem.new_with_mnemonic(_('_Layouts...')) - item.connect('activate', lambda x: LayoutLauncher()) 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): """Add the encoding list to the menu"""