aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteramako2010-12-12 22:55:23 +0900
committerteramako2010-12-12 22:55:23 +0900
commit04ce6ec260f94ad9aed6ae4627d678eac4b71d9a (patch)
treef8257ab6a29d0c6821ec28a69ef9f065664b8747
parentf27ecd2f6df13d8515e30f894dc22c266a5ed48d (diff)
downloadvimperator-plugins-04ce6ec260f94ad9aed6ae4627d678eac4b71d9a.tar.bz2
add subcommand 'settitle'
-rw-r--r--panorama.js45
1 files changed, 44 insertions, 1 deletions
diff --git a/panorama.js b/panorama.js
index 9d7b148..7780835 100644
--- a/panorama.js
+++ b/panorama.js
@@ -2,7 +2,7 @@
* Use at your OWN RISK.
*/
let INFO = <>
-<plugin name="panorama" version="0.6"
+<plugin name="panorama" version="0.6.1"
href="https://github.com/vimpr/vimperator-plugins/blob/master/panorama.js"
summary="Add supports for Panorama"
lang="en-US"
@@ -94,6 +94,14 @@ let INFO = <>
<p>pull a tab from the other group</p>
</description>
</item>
+ <item>
+ <tags>settitle</tags>
+ <spec>settitle <a>title</a> <oa>GroupName</oa></spec>
+ <description>
+ <p>update <a>GroupName</a>'s title to <a>title</a>.</p>
+ <p>if omitted <a>GroupName</a>, update the current group.</p>
+ </description>
+ </item>
</plugin>
</>;
@@ -412,6 +420,23 @@ function removeTab (tab, count, focusLeftTab, quitOnLastTab) {
}
} // }}}
+/**
+ * setGroupTitile {{{
+ * @param {String} title
+ * @param {GroupItem} group
+ */
+function setGroupTitle (title, group) {
+ let activeGroup = tabView.GroupItems.getActiveGroupItem();
+ if (!group)
+ group = activeGroup;
+ liberator.assert(group, "Missing group");
+ group.setTitle(title);
+ if (title && group.$title.hasClass("defaultName"))
+ group.$title.removeClass("defaultName");
+ if (group === activeGroup)
+ gBrowser.updateTitlebar();
+} // }}}
+
// ============================================================================
// Mappings {{{
// ============================================================================
@@ -670,6 +695,24 @@ let subCmds = [
literal: 0,
completer: function (context) completion.buffer(context, completion.buffer.GROUPS | completion.buffer.ORPHANS),
}, true) // }}}
+ ,
+ /**
+ * SubCommand settitle {{{
+ */
+ new Command(["settitle"], "set group title",
+ function (args) {
+ let title = args[0],
+ groupName = args.literalArg;
+ let group = getGroupByName(groupName)[0];
+ setGroupTitle(title, group);
+ }, {
+ literal: 1,
+ completer: function (context, args) {
+ if (args.length > 1) {
+ completion.tabgroup(context, false);
+ }
+ },
+ }, true) // }}}
];
/**