-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow actions in the new tab dropdown (#17281)
Allows the user to define entries in the new tab menu that execute actions, based on their action Id Closes #3759 Closes #9362
- Loading branch information
1 parent
d6b6aac
commit aeed078
Showing
13 changed files
with
178 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#include "pch.h" | ||
#include "ActionEntry.h" | ||
#include "JsonUtils.h" | ||
|
||
#include "ActionEntry.g.cpp" | ||
|
||
using namespace Microsoft::Terminal::Settings::Model; | ||
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation; | ||
|
||
static constexpr std::string_view ActionIdKey{ "id" }; | ||
|
||
ActionEntry::ActionEntry() noexcept : | ||
ActionEntryT<ActionEntry, NewTabMenuEntry>(NewTabMenuEntryType::Action) | ||
{ | ||
} | ||
|
||
Json::Value ActionEntry::ToJson() const | ||
{ | ||
auto json = NewTabMenuEntry::ToJson(); | ||
|
||
JsonUtils::SetValueForKey(json, ActionIdKey, _ActionId); | ||
|
||
return json; | ||
} | ||
|
||
winrt::com_ptr<NewTabMenuEntry> ActionEntry::FromJson(const Json::Value& json) | ||
{ | ||
auto entry = winrt::make_self<ActionEntry>(); | ||
|
||
JsonUtils::GetValueForKey(json, ActionIdKey, entry->_ActionId); | ||
|
||
return entry; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*++ | ||
Copyright (c) Microsoft Corporation | ||
Licensed under the MIT license. | ||
Module Name: | ||
- ActionEntry.h | ||
Abstract: | ||
- An action entry in the "new tab" dropdown menu | ||
Author(s): | ||
- Pankaj Bhojwani - May 2024 | ||
--*/ | ||
#pragma once | ||
|
||
#include "NewTabMenuEntry.h" | ||
#include "ActionEntry.g.h" | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Model::implementation | ||
{ | ||
struct ActionEntry : ActionEntryT<ActionEntry, NewTabMenuEntry> | ||
{ | ||
public: | ||
ActionEntry() noexcept; | ||
|
||
Json::Value ToJson() const override; | ||
static com_ptr<NewTabMenuEntry> FromJson(const Json::Value& json); | ||
|
||
WINRT_PROPERTY(winrt::hstring, ActionId); | ||
}; | ||
} | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Model::factory_implementation | ||
{ | ||
BASIC_FACTORY(ActionEntry); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters