- Create new tab group named GroupName.
+ Create new tab group named GroupName. And then, switch to the group.
If specified !, move the current tab to the group.
@@ -428,15 +428,30 @@ let (cmd = commands.get("buffer")) {
cmd.completer = function (context) completion.buffer(context, true);
}
+/**
+ * make a group and switch to the group
+ * if add ! (bang), take up the current tab to the group
+ */
commands.addUserCommand(["mkg[roup]"], "create Group",
function (args) {
let groupName = args.literalArg;
let group = createGroup(groupName);
+ let currentTab = tabs.getTab();
if (args.bang) {
- let currentTab = tabs.getTab();
if (!currentTab.pinned)
TV.moveTabTo(currentTab, group.id);
}
+ let apps = appTabs,
+ child = group.getChild(0);
+ if (child) {
+ tabView.GroupItems.setActiveGroupItem(group);
+ tabView.UI.goToTab(child.tab);
+ } else if (apps.length == 0) {
+ group.newTab();
+ } else {
+ tabView.GroupItems.setActiveGroupItem(group);
+ tabView.UI.goToTab(currentTab.pinned ? currentTab : apps[apps.length - 1]);
+ }
}, {
argCount: "1",
bang: true,
--
cgit v1.2.3