Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/cascadia/TerminalApp/AppActionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,4 +1633,37 @@ namespace winrt::TerminalApp::implementation
args.Handled(handled);
}
}

void TerminalPage::_HandleFocusBellTab(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
// Navigate to the next tab that has a bell indicator showing.
// If no tabs have bells, do nothing.
const auto tabCount = _tabs.Size();
if (tabCount == 0)
{
args.Handled(false);
return;
}

// Start searching from the tab after the current one
const auto currentIdx = _GetFocusedTabIndex().value_or(0);

for (uint32_t offset = 1; offset <= tabCount; offset++)
{
const auto idx = (currentIdx + offset) % tabCount;
if (const auto tab{ _tabs.GetAt(idx).try_as<Tab>() })
{
if (tab->TabStatus().BellIndicator())
{
_SelectTab(idx);
args.Handled(true);
return;
}
}
}

// No tabs with bells found
args.Handled(false);
}
}
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static constexpr std::string_view OpenScratchpadKey{ "experimental.openScratchpa
static constexpr std::string_view OpenAboutKey{ "openAbout" };
static constexpr std::string_view QuickFixKey{ "quickFix" };
static constexpr std::string_view OpenCWDKey{ "openCWD" };
static constexpr std::string_view FocusBellTabKey{ "focusBellTab" };

static constexpr std::string_view ActionKey{ "action" };

Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalSettingsModel/AllShortcutActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
ON_ALL_ACTIONS(OpenScratchpad) \
ON_ALL_ACTIONS(OpenAbout) \
ON_ALL_ACTIONS(QuickFix) \
ON_ALL_ACTIONS(OpenCWD)
ON_ALL_ACTIONS(OpenCWD) \
ON_ALL_ACTIONS(FocusBellTab)

#define ALL_SHORTCUT_ACTIONS_WITH_ARGS \
ON_ALL_ACTIONS_WITH_ARGS(AdjustFontSize) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
<data name="PrevTabCommandKey" xml:space="preserve">
<value>Previous tab</value>
</data>
<data name="FocusBellTabCommandKey" xml:space="preserve">
<value>Focus next bell tab</value>
</data>
<data name="RenameTabCommandKey" xml:space="preserve">
<value>Rename tab to "{0}"</value>
<comment>{0} will be replaced with a user-defined string</comment>
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@
{ "command": "duplicateTab", "id": "Terminal.DuplicateTab" },
{ "command": "nextTab", "id": "Terminal.NextTab" },
{ "command": "prevTab", "id": "Terminal.PrevTab" },
{ "command": "focusBellTab", "id": "Terminal.FocusBellTab", "keys": "ctrl+shift+b" },
{ "command": { "action": "switchToTab", "index": 0 }, "id": "Terminal.SwitchToTab0" },
{ "command": { "action": "switchToTab", "index": 1 }, "id": "Terminal.SwitchToTab1" },
{ "command": { "action": "switchToTab", "index": 2 }, "id": "Terminal.SwitchToTab2" },
Expand Down