From 04ce6ec260f94ad9aed6ae4627d678eac4b71d9a Mon Sep 17 00:00:00 2001 From: teramako Date: Sun, 12 Dec 2010 22:55:23 +0900 Subject: add subcommand 'settitle' --- panorama.js | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'panorama.js') 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 = <> -

pull a tab from the other group

+ + settitle + settitle title GroupName + +

update GroupName's title to title.

+

if omitted GroupName, update the current group.

+
+
; @@ -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) // }}} ]; /** -- cgit v1.2.3