mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Make the feature default to be off
This commit is contained in:
@@ -14,6 +14,15 @@ namespace Microsoft.CmdPal.Ext.Indexer.Data;
|
||||
|
||||
internal sealed partial class IndexerListItem : ListItem
|
||||
{
|
||||
internal static readonly bool IsActionsFeatureEnabled = GetFeatureFlag();
|
||||
|
||||
private static bool GetFeatureFlag()
|
||||
{
|
||||
var env = System.Environment.GetEnvironmentVariable("CMDPAL_ENABLE_ACTIONS_LIST");
|
||||
return !string.IsNullOrEmpty(env) &&
|
||||
(env == "1" || env.Equals("true", System.StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
internal string FilePath { get; private set; }
|
||||
|
||||
public IndexerListItem(
|
||||
@@ -44,8 +53,8 @@ internal sealed partial class IndexerListItem : ListItem
|
||||
IContextItem[] moreCommands = [
|
||||
..context,
|
||||
new CommandContextItem(new OpenWithCommand(indexerItem))];
|
||||
/*
|
||||
if (ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
|
||||
|
||||
if (IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
|
||||
{
|
||||
var actionsListContextItem = new ActionsListContextItem(indexerItem.FullPath);
|
||||
if (actionsListContextItem.AnyActions())
|
||||
@@ -56,7 +65,6 @@ internal sealed partial class IndexerListItem : ListItem
|
||||
];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
MoreCommands = [
|
||||
.. moreCommands,
|
||||
|
||||
@@ -20,12 +20,10 @@ public partial class IndexerCommandsProvider : CommandProvider
|
||||
DisplayName = Resources.IndexerCommandsProvider_DisplayName;
|
||||
Icon = Icons.FileExplorer;
|
||||
|
||||
/*
|
||||
if (ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
|
||||
if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
|
||||
{
|
||||
_ = ActionRuntimeManager.InstanceAsync;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public override ICommandItem[] TopLevelCommands()
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace Microsoft.CmdPal.Ext.Indexer.Pages;
|
||||
|
||||
internal sealed partial class ActionsListContextItem : CommandContextItem, IDisposable
|
||||
{
|
||||
// private static ActionRuntime actionRuntime;
|
||||
private readonly string fullPath;
|
||||
private readonly List<CommandContextItem> actions = [];
|
||||
private static readonly Lock UpdateMoreCommandsLock = new();
|
||||
private static ActionRuntime actionRuntime;
|
||||
|
||||
public ActionsListContextItem(string fullPath)
|
||||
: base(new NoOpCommand())
|
||||
@@ -43,7 +43,6 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp
|
||||
|
||||
private void UpdateMoreCommands()
|
||||
{
|
||||
/*
|
||||
lock (UpdateMoreCommandsLock)
|
||||
{
|
||||
if (actionRuntime == null)
|
||||
@@ -96,12 +95,10 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp
|
||||
{
|
||||
Logger.LogError($"Error updating commands: {ex.Message}");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
/*
|
||||
lock (UpdateMoreCommandsLock)
|
||||
{
|
||||
if (actionRuntime != null)
|
||||
@@ -109,6 +106,5 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp
|
||||
actionRuntime.ActionCatalog.Changed -= ActionCatalog_Changed;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user