From 59b4e29be904eda0048be1726147a9347e3a298f Mon Sep 17 00:00:00 2001
From: Den Delimarsky <1389609+dend@users.noreply.github.com>
Date: Thu, 8 Apr 2021 08:22:35 -0700
Subject: [PATCH] Cleanup of old content The old EspressoUI project was
misplaced and is no longer necessary.
---
PowerToys.sln | 10 +
src/espresso/EspressoUI/App.xaml | 9 -
src/espresso/EspressoUI/App.xaml.cs | 17 -
src/espresso/EspressoUI/AssemblyInfo.cs | 10 -
src/espresso/EspressoUI/EspressoUI.csproj | 34 --
src/espresso/EspressoUI/LocProject.json | 14 -
src/espresso/EspressoUI/MainWindow.xaml | 12 -
src/espresso/EspressoUI/MainWindow.xaml.cs | 28 --
src/espresso/EspressoUI/Themes/Dark.xaml | 18 -
.../EspressoUI/Themes/HighContrast1.xaml | 18 -
.../EspressoUI/Themes/HighContrast2.xaml | 19 -
.../EspressoUI/Themes/HighContrastBlack.xaml | 18 -
.../EspressoUI/Themes/HighContrastWhite.xaml | 18 -
src/espresso/EspressoUI/Themes/Light.xaml | 18 -
src/modules/espresso/Espresso/Espresso.rc | 32 ++
.../espresso/Espresso/Espresso.vcxproj | 126 +++++++
src/modules/espresso/Espresso/dllmain.cpp | 338 ++++++++++++++++++
src/modules/espresso/Espresso/pch.cpp | 2 +
src/modules/espresso/Espresso/pch.h | 5 +
src/modules/espresso/Espresso/resource.h | 0
src/modules/espresso/Espresso/trace.cpp | 29 ++
src/modules/espresso/Espresso/trace.h | 9 +
22 files changed, 551 insertions(+), 233 deletions(-)
delete mode 100644 src/espresso/EspressoUI/App.xaml
delete mode 100644 src/espresso/EspressoUI/App.xaml.cs
delete mode 100644 src/espresso/EspressoUI/AssemblyInfo.cs
delete mode 100644 src/espresso/EspressoUI/EspressoUI.csproj
delete mode 100644 src/espresso/EspressoUI/LocProject.json
delete mode 100644 src/espresso/EspressoUI/MainWindow.xaml
delete mode 100644 src/espresso/EspressoUI/MainWindow.xaml.cs
delete mode 100644 src/espresso/EspressoUI/Themes/Dark.xaml
delete mode 100644 src/espresso/EspressoUI/Themes/HighContrast1.xaml
delete mode 100644 src/espresso/EspressoUI/Themes/HighContrast2.xaml
delete mode 100644 src/espresso/EspressoUI/Themes/HighContrastBlack.xaml
delete mode 100644 src/espresso/EspressoUI/Themes/HighContrastWhite.xaml
delete mode 100644 src/espresso/EspressoUI/Themes/Light.xaml
create mode 100644 src/modules/espresso/Espresso/Espresso.rc
create mode 100644 src/modules/espresso/Espresso/Espresso.vcxproj
create mode 100644 src/modules/espresso/Espresso/dllmain.cpp
create mode 100644 src/modules/espresso/Espresso/pch.cpp
create mode 100644 src/modules/espresso/Espresso/pch.h
create mode 100644 src/modules/espresso/Espresso/resource.h
create mode 100644 src/modules/espresso/Espresso/trace.cpp
create mode 100644 src/modules/espresso/Espresso/trace.h
diff --git a/PowerToys.sln b/PowerToys.sln
index 21179a3f5d..cd22ab483c 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -312,6 +312,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings", "src\settings-ui\PowerToys.Settings\PowerToys.Settings.csproj", "{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "espresso", "espresso", "{A81DFA80-09EB-4464-A89A-DF4AEAC93527}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Espresso", "src\modules\espresso\Espresso\Espresso.vcxproj", "{5E7360A8-D048-4ED3-8F09-0BFD64C5529A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -634,6 +638,10 @@ Global
{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|x64.Build.0 = Debug|x64
{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|x64.ActiveCfg = Release|x64
{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|x64.Build.0 = Release|x64
+ {5E7360A8-D048-4ED3-8F09-0BFD64C5529A}.Debug|x64.ActiveCfg = Debug|x64
+ {5E7360A8-D048-4ED3-8F09-0BFD64C5529A}.Debug|x64.Build.0 = Debug|x64
+ {5E7360A8-D048-4ED3-8F09-0BFD64C5529A}.Release|x64.ActiveCfg = Release|x64
+ {5E7360A8-D048-4ED3-8F09-0BFD64C5529A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -729,6 +737,8 @@ Global
{4BABF3FE-3451-42FD-873F-3C332E18DCEF} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{0648DF05-5DDA-4BE1-B5F2-584926EBDB65} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
+ {A81DFA80-09EB-4464-A89A-DF4AEAC93527} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
+ {5E7360A8-D048-4ED3-8F09-0BFD64C5529A} = {A81DFA80-09EB-4464-A89A-DF4AEAC93527}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
diff --git a/src/espresso/EspressoUI/App.xaml b/src/espresso/EspressoUI/App.xaml
deleted file mode 100644
index 6e57c4e3e8..0000000000
--- a/src/espresso/EspressoUI/App.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/src/espresso/EspressoUI/App.xaml.cs b/src/espresso/EspressoUI/App.xaml.cs
deleted file mode 100644
index ed1eb28242..0000000000
--- a/src/espresso/EspressoUI/App.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace EspressoUI
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/src/espresso/EspressoUI/AssemblyInfo.cs b/src/espresso/EspressoUI/AssemblyInfo.cs
deleted file mode 100644
index 8b5504ecfb..0000000000
--- a/src/espresso/EspressoUI/AssemblyInfo.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Windows;
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
diff --git a/src/espresso/EspressoUI/EspressoUI.csproj b/src/espresso/EspressoUI/EspressoUI.csproj
deleted file mode 100644
index 41864b724f..0000000000
--- a/src/espresso/EspressoUI/EspressoUI.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
- WinExe
- netcoreapp3.1
- true
-
-
-
-
-
-
-
-
- $(DefaultXamlRuntime)
-
-
- $(DefaultXamlRuntime)
-
-
- $(DefaultXamlRuntime)
-
-
- $(DefaultXamlRuntime)
-
-
- $(DefaultXamlRuntime)
-
-
- $(DefaultXamlRuntime)
-
-
-
-
diff --git a/src/espresso/EspressoUI/LocProject.json b/src/espresso/EspressoUI/LocProject.json
deleted file mode 100644
index 98f95e8e31..0000000000
--- a/src/espresso/EspressoUI/LocProject.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "Projects": [
- {
- "LanguageSet": "Azure_Languages",
- "LocItems": [
- {
- "SourceFile": "src\\modules\\espresso\\EspressoUI\\Properties\\Resources.resx",
- "CopyOption": "LangIDOnName",
- "OutputPath": "src\\modules\\espresso\\EspressoUI\\Properties"
- }
- ]
- }
- ]
-}
diff --git a/src/espresso/EspressoUI/MainWindow.xaml b/src/espresso/EspressoUI/MainWindow.xaml
deleted file mode 100644
index 8e502b846e..0000000000
--- a/src/espresso/EspressoUI/MainWindow.xaml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/src/espresso/EspressoUI/MainWindow.xaml.cs b/src/espresso/EspressoUI/MainWindow.xaml.cs
deleted file mode 100644
index ba0b02dac0..0000000000
--- a/src/espresso/EspressoUI/MainWindow.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace EspressoUI
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/src/espresso/EspressoUI/Themes/Dark.xaml b/src/espresso/EspressoUI/Themes/Dark.xaml
deleted file mode 100644
index f0d0cb1339..0000000000
--- a/src/espresso/EspressoUI/Themes/Dark.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Dark.Accent1
- PowerToysImageResizer
- Accent1 (Dark)
- Dark
- Accent1
- Black
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/espresso/EspressoUI/Themes/HighContrast1.xaml b/src/espresso/EspressoUI/Themes/HighContrast1.xaml
deleted file mode 100644
index 7bfaf2e19d..0000000000
--- a/src/espresso/EspressoUI/Themes/HighContrast1.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- HighContrast.Accent2
- PowerToysImageResizer
- Accent2 (HighContrast)
- HighContrast
- Accent2
- White
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/espresso/EspressoUI/Themes/HighContrast2.xaml b/src/espresso/EspressoUI/Themes/HighContrast2.xaml
deleted file mode 100644
index 15f7f1b639..0000000000
--- a/src/espresso/EspressoUI/Themes/HighContrast2.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- HighContrast.Accent3
- PowerToysImageResizer
- Accent3 (HighContrast)
- HighContrast
- Accent3
- White
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/espresso/EspressoUI/Themes/HighContrastBlack.xaml b/src/espresso/EspressoUI/Themes/HighContrastBlack.xaml
deleted file mode 100644
index 3f5458dabb..0000000000
--- a/src/espresso/EspressoUI/Themes/HighContrastBlack.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- HighContrast.Accent4
- PowerToysImageResizer
- Accent4 (HighContrast)
- HighContrast
- Accent4
- White
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/espresso/EspressoUI/Themes/HighContrastWhite.xaml b/src/espresso/EspressoUI/Themes/HighContrastWhite.xaml
deleted file mode 100644
index 40ccf7f047..0000000000
--- a/src/espresso/EspressoUI/Themes/HighContrastWhite.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- HighContrast.Accent5
- PowerToysImageResizer
- Accent5 (HighContrast)
- HighContrast
- Accent5
- White
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/espresso/EspressoUI/Themes/Light.xaml b/src/espresso/EspressoUI/Themes/Light.xaml
deleted file mode 100644
index 9b8e55a430..0000000000
--- a/src/espresso/EspressoUI/Themes/Light.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- Light.Accent1
- PowerToysImageResizer
- Accent1 (Light)
- Light
- Accent1
- White
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/Espresso.rc b/src/modules/espresso/Espresso/Espresso.rc
new file mode 100644
index 0000000000..af288a92d3
--- /dev/null
+++ b/src/modules/espresso/Espresso/Espresso.rc
@@ -0,0 +1,32 @@
+1 VERSIONINFO
+ FILEVERSION 0,1,0,0
+ PRODUCTVERSION 0,1,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Company Name"
+ VALUE "FileDescription", "$projectname$ Module"
+ VALUE "FileVersion", "0.1.0.0"
+ VALUE "InternalName", "$projectname$"
+ VALUE "LegalCopyright", "Copyright (C) 2019 Company Name"
+ VALUE "OriginalFilename", "$projectname$.dll"
+ VALUE "ProductName", "$projectname$"
+ VALUE "ProductVersion", "0.1.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/Espresso.vcxproj b/src/modules/espresso/Espresso/Espresso.vcxproj
new file mode 100644
index 0000000000..7a45469124
--- /dev/null
+++ b/src/modules/espresso/Espresso/Espresso.vcxproj
@@ -0,0 +1,126 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 15.0
+ {5e7360a8-d048-4ed3-8f09-0bfd64c5529a}
+ Win32Proj
+ Espresso
+ 10.0.17134.0
+ Espresso
+
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)$(Platform)\$(Configuration)\modules\Espresso\
+
+
+ false
+ $(SolutionDir)$(Platform)\$(Configuration)\modules\
+
+
+
+ Use
+ Level3
+ Disabled
+ true
+ _DEBUG;EXAMPLEPOWERTOY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ pch.h
+ MultiThreadedDebug
+ stdcpplatest
+
+
+ Windows
+ true
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Use
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ NDEBUG;EXAMPLEPOWERTOY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ pch.h
+ MultiThreaded
+ stdcpplatest
+
+
+ Windows
+ true
+ true
+ true
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ $(SolutionDir)src\;$(SolutionDir)src\modules;$(SolutionDir)src\common\Telemetry;%(AdditionalIncludeDirectories)
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ pch.h
+ pch.h
+
+
+
+
+
+ {74485049-c722-400f-abe5-86ac52d929b3}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/dllmain.cpp b/src/modules/espresso/Espresso/dllmain.cpp
new file mode 100644
index 0000000000..be128ce14b
--- /dev/null
+++ b/src/modules/espresso/Espresso/dllmain.cpp
@@ -0,0 +1,338 @@
+#include "pch.h"
+#include
+#include
+#include
+#include
+#include "trace.h"
+
+extern "C" IMAGE_DOS_HEADER __ImageBase;
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ Trace::RegisterProvider();
+ break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ Trace::UnregisterProvider();
+ break;
+ }
+ return TRUE;
+}
+
+// The PowerToy name that will be shown in the settings.
+const static wchar_t* MODULE_NAME = L"$projectname$";
+// Add a description that will we shown in the module settings page.
+const static wchar_t* MODULE_DESC = L"";
+
+// These are the properties shown in the Settings page.
+struct ModuleSettings
+{
+ // Add the PowerToy module properties with default values.
+ // Currently available types:
+ // - int
+ // - bool
+ // - string
+
+ //bool bool_prop = true;
+ //int int_prop = 10;
+ //std::wstring string_prop = L"The quick brown fox jumps over the lazy dog";
+ //std::wstring color_prop = L"#1212FF";
+
+} g_settings;
+
+// Implement the PowerToy Module Interface and all the required methods.
+class $safeprojectname$ : public PowertoyModuleIface
+{
+private:
+ // The PowerToy state.
+ bool m_enabled = false;
+
+ // Load initial settings from the persisted values.
+ void init_settings();
+
+public:
+ // Constructor
+ $safeprojectname$()
+ {
+ init_settings();
+ };
+
+ // Destroy the powertoy and free memory
+ virtual void destroy() override
+ {
+ delete this;
+ }
+
+ // Return the display name of the powertoy, this will be cached by the runner
+ virtual const wchar_t* get_name() override
+ {
+ return MODULE_NAME;
+ }
+
+ // Return array of the names of all events that this powertoy listens for, with
+ // nullptr as the last element of the array. Nullptr can also be retured for empty
+ // list.
+ virtual const wchar_t** get_events() override
+ {
+ static const wchar_t* events[] = { nullptr };
+ // Available events:
+ // - ll_keyboard
+ // - win_hook_event
+ //
+ // static const wchar_t* events[] = { ll_keyboard,
+ // win_hook_event,
+ // nullptr };
+
+ return events;
+ }
+
+ // Return JSON with the configuration options.
+ virtual bool get_config(wchar_t* buffer, int* buffer_size) override
+ {
+ HINSTANCE hinstance = reinterpret_cast(&__ImageBase);
+
+ // Create a Settings object.
+ PowerToysSettings::Settings settings(hinstance, get_name());
+ settings.set_description(MODULE_DESC);
+
+ // Show an overview link in the Settings page
+ //settings.set_overview_link(L"https://");
+
+ // Show a video link in the Settings page.
+ //settings.set_video_link(L"https://");
+
+ // A bool property with a toggle editor.
+ //settings.add_bool_toogle(
+ // L"bool_toggle_1", // property name.
+ // L"This is what a BoolToggle property looks like", // description or resource id of the localized string.
+ // g_settings.bool_prop // property value.
+ //);
+
+ // An integer property with a spinner editor.
+ //settings.add_int_spinner(
+ // L"int_spinner_1", // property name
+ // L"This is what a IntSpinner property looks like", // description or resource id of the localized string.
+ // g_settings.int_prop, // property value.
+ // 0, // min value.
+ // 100, // max value.
+ // 10 // incremental step.
+ //);
+
+ // A string property with a textbox editor.
+ //settings.add_string(
+ // L"string_text_1", // property name.
+ // L"This is what a String property looks like", // description or resource id of the localized string.
+ // g_settings.string_prop // property value.
+ //);
+
+ // A string property with a color picker editor.
+ //settings.add_color_picker(
+ // L"color_picker_1", // property name.
+ // L"This is what a ColorPicker property looks like", // description or resource id of the localized string.
+ // g_settings.color_prop // property value.
+ //);
+
+ // A custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
+ // method should be overriden as well.
+ //settings.add_custom_action(
+ // L"custom_action_id", // action name.
+ // L"This is what a CustomAction property looks like", // label above the field.
+ // L"Call a custom action", // button text.
+ // L"Press the button to call a custom action." // display values / extended info.
+ //);
+
+ return settings.serialize_to_buffer(buffer, buffer_size);
+ }
+
+ // Signal from the Settings editor to call a custom action.
+ // This can be used to spawn more complex editors.
+ virtual void call_custom_action(const wchar_t* action) override
+ {
+ static UINT custom_action_num_calls = 0;
+ try
+ {
+ // Parse the action values, including name.
+ PowerToysSettings::CustomActionObject action_object =
+ PowerToysSettings::CustomActionObject::from_json_string(action);
+
+ //if (action_object.get_name() == L"custom_action_id") {
+ // // Execute your custom action
+ //}
+ }
+ catch (std::exception&)
+ {
+ // Improper JSON.
+ }
+ }
+
+ // Called by the runner to pass the updated settings values as a serialized JSON.
+ virtual void set_config(const wchar_t* config) override
+ {
+ try
+ {
+ // Parse the input JSON string.
+ PowerToysSettings::PowerToyValues values =
+ PowerToysSettings::PowerToyValues::from_json_string(config);
+
+ // Update a bool property.
+ //if (auto v = values.get_bool_value(L"bool_toggle_1")) {
+ // g_settings.bool_prop = *v;
+ //}
+
+ // Update an int property.
+ //if (auto v = values.get_int_value(L"int_spinner_1")) {
+ // g_settings.int_prop = *v;
+ //}
+
+ // Update a string property.
+ //if (auto v = values.get_string_value(L"string_text_1")) {
+ // g_settings.string_prop = *v;
+ //}
+
+ // Update a color property.
+ //if (auto v = values.get_string_value(L"color_picker_1")) {
+ // g_settings.color_prop = *v;
+ //}
+
+ // If you don't need to do any custom processing of the settings, proceed
+ // to persists the values calling:
+ values.save_to_settings_file();
+ // Otherwise call a custom function to process the settings before saving them to disk:
+ // save_settings();
+ }
+ catch (std::exception&)
+ {
+ // Improper JSON.
+ }
+ }
+
+ // Enable the powertoy
+ virtual void enable()
+ {
+ m_enabled = true;
+ }
+
+ // Disable the powertoy
+ virtual void disable()
+ {
+ m_enabled = false;
+ }
+
+ // Returns if the powertoys is enabled
+ virtual bool is_enabled() override
+ {
+ return m_enabled;
+ }
+
+ // Handle incoming event, data is event-specific
+ virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override
+ {
+ if (wcscmp(name, ll_keyboard) == 0)
+ {
+ auto& event = *(reinterpret_cast(data));
+ // Return 1 if the keypress is to be suppressed (not forwarded to Windows),
+ // otherwise return 0.
+ return 0;
+ }
+ else if (wcscmp(name, win_hook_event) == 0)
+ {
+ auto& event = *(reinterpret_cast(data));
+ // Return value is ignored
+ return 0;
+ }
+ return 0;
+ }
+
+ // This methods are part of an experimental features not fully supported yet
+ virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) override
+ {
+ }
+
+ virtual void signal_system_menu_action(const wchar_t* name) override
+ {
+ }
+};
+
+// Load the settings file.
+void $safeprojectname$::init_settings()
+{
+ try
+ {
+ // Load and parse the settings file for this PowerToy.
+ PowerToysSettings::PowerToyValues settings =
+ PowerToysSettings::PowerToyValues::load_from_settings_file($safeprojectname$::get_name());
+
+ // Load a bool property.
+ //if (auto v = settings.get_bool_value(L"bool_toggle_1")) {
+ // g_settings.bool_prop = *v;
+ //}
+
+ // Load an int property.
+ //if (auto v = settings.get_int_value(L"int_spinner_1")) {
+ // g_settings.int_prop = *v;
+ //}
+
+ // Load a string property.
+ //if (auto v = settings.get_string_value(L"string_text_1")) {
+ // g_settings.string_prop = *v;
+ //}
+
+ // Load a color property.
+ //if (auto v = settings.get_string_value(L"color_picker_1")) {
+ // g_settings.color_prop = *v;
+ //}
+ }
+ catch (std::exception&)
+ {
+ // Error while loading from the settings file. Let default values stay as they are.
+ }
+}
+
+// This method of saving the module settings is only required if you need to do any
+// custom processing of the settings before saving them to disk.
+//void $projectname$::save_settings() {
+// try {
+// // Create a PowerToyValues object for this PowerToy
+// PowerToysSettings::PowerToyValues values(get_name());
+//
+// // Save a bool property.
+// //values.add_property(
+// // L"bool_toggle_1", // property name
+// // g_settings.bool_prop // property value
+// //);
+//
+// // Save an int property.
+// //values.add_property(
+// // L"int_spinner_1", // property name
+// // g_settings.int_prop // property value
+// //);
+//
+// // Save a string property.
+// //values.add_property(
+// // L"string_text_1", // property name
+// // g_settings.string_prop // property value
+// );
+//
+// // Save a color property.
+// //values.add_property(
+// // L"color_picker_1", // property name
+// // g_settings.color_prop // property value
+// //);
+//
+// // Save the PowerToyValues JSON to the power toy settings file.
+// values.save_to_settings_file();
+// }
+// catch (std::exception ex) {
+// // Couldn't save the settings.
+// }
+//}
+
+extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()
+{
+ return new $safeprojectname$();
+}
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/pch.cpp b/src/modules/espresso/Espresso/pch.cpp
new file mode 100644
index 0000000000..a83d3bb2cc
--- /dev/null
+++ b/src/modules/espresso/Espresso/pch.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#pragma comment(lib, "windowsapp")
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/pch.h b/src/modules/espresso/Espresso/pch.h
new file mode 100644
index 0000000000..769a37b377
--- /dev/null
+++ b/src/modules/espresso/Espresso/pch.h
@@ -0,0 +1,5 @@
+#pragma once
+#define WIN32_LEAN_AND_MEAN
+#include
+#include
+#include
\ No newline at end of file
diff --git a/src/modules/espresso/Espresso/resource.h b/src/modules/espresso/Espresso/resource.h
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/modules/espresso/Espresso/trace.cpp b/src/modules/espresso/Espresso/trace.cpp
new file mode 100644
index 0000000000..d8c81500f8
--- /dev/null
+++ b/src/modules/espresso/Espresso/trace.cpp
@@ -0,0 +1,29 @@
+#include "pch.h"
+#include "trace.h"
+
+TRACELOGGING_DEFINE_PROVIDER(
+ g_hProvider,
+ "Microsoft.PowerToys",
+ // {38e8889b-9731-53f5-e901-e8a7c1753074}
+ (0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
+ TraceLoggingOptionProjectTelemetry());
+
+void Trace::RegisterProvider()
+{
+ TraceLoggingRegister(g_hProvider);
+}
+
+void Trace::UnregisterProvider()
+{
+ TraceLoggingUnregister(g_hProvider);
+}
+
+void Trace::MyEvent()
+{
+ TraceLoggingWrite(
+ g_hProvider,
+ "PowerToyName_MyEvent",
+ ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
+ TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
+ TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
+}
diff --git a/src/modules/espresso/Espresso/trace.h b/src/modules/espresso/Espresso/trace.h
new file mode 100644
index 0000000000..3939f62fd1
--- /dev/null
+++ b/src/modules/espresso/Espresso/trace.h
@@ -0,0 +1,9 @@
+#pragma once
+
+class Trace
+{
+public:
+ static void RegisterProvider();
+ static void UnregisterProvider();
+ static void MyEvent();
+};