Skip to content

Commit ec160d1

Browse files
committed
feat: add tooltip for the pin icon in tab bar
1 parent 9eb9b48 commit ec160d1

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/extensionsIntegrated/TabBar/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,20 @@ define(function (require, exports, module) {
544544
$(this).attr("title", closeTabTooltip);
545545
});
546546

547+
// add listener for tab pin icon to show the tooltip along with the keybinding
548+
$(document).on("mouseenter", ".phoenix-tab-bar .tab-pin", function () {
549+
const pinBindings = KeyBindingManager.getKeyBindings(Commands.FILE_PIN);
550+
const pinShortcut = pinBindings.length > 0
551+
? KeyBindingManager.formatKeyDescriptor(pinBindings[pinBindings.length - 1].displayKey)
552+
: "";
553+
554+
const unpinTabTooltip = pinShortcut
555+
? `${Strings.UNPIN_TAB_TOOLTIP} (${pinShortcut})`
556+
: Strings.UNPIN_TAB_TOOLTIP;
557+
558+
$(this).attr("title", unpinTabTooltip);
559+
});
560+
547561
// open tab on mousedown event
548562
$(document).on("mousedown", ".phoenix-tab-bar .tab", function (event) {
549563
if ($(event.target).hasClass("fa-times") || $(event.target).closest(".tab-close").length) {

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ define({
502502
"CLOSE_ALL_TABS": "Close All Tabs",
503503
"CLOSE_SAVED_TABS": "Close Saved Tabs",
504504
"CLOSE_TAB_TOOLTIP": "Close Tab",
505+
"UNPIN_TAB_TOOLTIP": "Unpin Tab",
505506

506507
// CodeInspection: errors/warnings
507508
"ERRORS_NO_FILE": "No File Open",

0 commit comments

Comments
 (0)