mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
CmdPal: some dock data (#45832)
we want to know what the people want re: #45584
This commit is contained in:
@@ -45,6 +45,8 @@ public sealed partial class DockViewModel
|
||||
_pageContext = new(this);
|
||||
|
||||
_topLevelCommandManager.DockBands.CollectionChanged += DockBands_CollectionChanged;
|
||||
|
||||
EmitDockConfiguration();
|
||||
}
|
||||
|
||||
private void DockBands_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
@@ -612,6 +614,22 @@ public sealed partial class DockViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private void EmitDockConfiguration()
|
||||
{
|
||||
var isDockEnabled = _settingsModel.EnableDock;
|
||||
var dockSide = isDockEnabled ? _settings.Side.ToString().ToLowerInvariant() : "none";
|
||||
|
||||
static string FormatBands(List<DockBandSettings> bands) =>
|
||||
string.Join("\n", bands.Select(b => $"{b.ProviderId}/{b.CommandId}"));
|
||||
|
||||
var startBands = isDockEnabled ? FormatBands(_settings.StartBands) : string.Empty;
|
||||
var centerBands = isDockEnabled ? FormatBands(_settings.CenterBands) : string.Empty;
|
||||
var endBands = isDockEnabled ? FormatBands(_settings.EndBands) : string.Empty;
|
||||
|
||||
WeakReferenceMessenger.Default.Send(new TelemetryDockConfigurationMessage(
|
||||
isDockEnabled, dockSide, startBands, centerBands, endBands));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides an empty page context, for the dock's own context menu. We're
|
||||
/// building the context menu for the dock using literally our own cmdpal
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.CmdPal.UI.ViewModels.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Telemetry message sent when the dock is initialized.
|
||||
/// Captures the dock configuration for telemetry tracking.
|
||||
/// </summary>
|
||||
public record TelemetryDockConfigurationMessage(bool IsDockEnabled, string DockSide, string StartBands, string CenterBands, string EndBands);
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the dock configuration at startup.
|
||||
/// Purpose: Understand how users configure their dock - which side, which bands, and whether it's enabled.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
|
||||
public class CmdPalDockConfiguration : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether the dock is enabled.
|
||||
/// </summary>
|
||||
public bool IsDockEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dock side (top, bottom, left, right, none).
|
||||
/// "none" when the dock is disabled.
|
||||
/// </summary>
|
||||
public string DockSide { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start bands as a newline-delimited list of "{ProviderId}/{CommandId}".
|
||||
/// Empty if the dock is disabled.
|
||||
/// </summary>
|
||||
public string StartBands { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the center bands as a newline-delimited list of "{ProviderId}/{CommandId}".
|
||||
/// Empty if the dock is disabled.
|
||||
/// </summary>
|
||||
public string CenterBands { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end bands as a newline-delimited list of "{ProviderId}/{CommandId}".
|
||||
/// Empty if the dock is disabled.
|
||||
/// </summary>
|
||||
public string EndBands { get; set; }
|
||||
|
||||
public CmdPalDockConfiguration(bool isDockEnabled, string dockSide, string startBands, string centerBands, string endBands)
|
||||
{
|
||||
EventName = "CmdPal_DockConfiguration";
|
||||
IsDockEnabled = isDockEnabled;
|
||||
DockSide = dockSide;
|
||||
StartBands = startBands;
|
||||
CenterBands = centerBands;
|
||||
EndBands = endBands;
|
||||
}
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
@@ -20,13 +20,15 @@ internal sealed class TelemetryForwarder :
|
||||
ITelemetryService,
|
||||
IRecipient<TelemetryBeginInvokeMessage>,
|
||||
IRecipient<TelemetryInvokeResultMessage>,
|
||||
IRecipient<TelemetryExtensionInvokedMessage>
|
||||
IRecipient<TelemetryExtensionInvokedMessage>,
|
||||
IRecipient<TelemetryDockConfigurationMessage>
|
||||
{
|
||||
public TelemetryForwarder()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Register<TelemetryBeginInvokeMessage>(this);
|
||||
WeakReferenceMessenger.Default.Register<TelemetryInvokeResultMessage>(this);
|
||||
WeakReferenceMessenger.Default.Register<TelemetryExtensionInvokedMessage>(this);
|
||||
WeakReferenceMessenger.Default.Register<TelemetryDockConfigurationMessage>(this);
|
||||
}
|
||||
|
||||
// Message handlers for telemetry events from core layer
|
||||
@@ -56,6 +58,16 @@ internal sealed class TelemetryForwarder :
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(TelemetryDockConfigurationMessage message)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new CmdPalDockConfiguration(
|
||||
message.IsDockEnabled,
|
||||
message.DockSide,
|
||||
message.StartBands,
|
||||
message.CenterBands,
|
||||
message.EndBands));
|
||||
}
|
||||
|
||||
// Static method for logging session duration from UI layer
|
||||
public static void LogSessionDuration(
|
||||
ulong durationMs,
|
||||
|
||||
Reference in New Issue
Block a user