Skip to content

Commit 0be87e7

Browse files
betsegawudit3333
authored andcommitted
Import the source code for Window Walker (microsoft#1177)
Import the codebase for Window Walker - Not loaded into the module list - Not added it to the installer list.
1 parent ef7cf8a commit 0be87e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+14344
-0
lines changed

PowerToys.sln

+18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}"
77
ProjectSection(ProjectDependencies) = postProject
88
{48804216-2A0E-4168-A6D8-9CD068D14227} = {48804216-2A0E-4168-A6D8-9CD068D14227}
9+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6} = {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}
910
{74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3}
11+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB} = {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}
1012
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA} = {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}
1113
{07C389E3-6BC8-41CF-923E-307B1265FA2D} = {07C389E3-6BC8-41CF-923E-307B1265FA2D}
1214
EndProjectSection
@@ -103,6 +105,11 @@ EndProject
103105
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreview", "src\modules\previewpane\powerpreview\powerpreview.vcxproj", "{217DF501-135C-4E38-BFC8-99D4821032EA}"
104106
EndProject
105107
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreviewTest", "src\modules\previewpane\powerpreviewTest\powerpreviewTest.vcxproj", "{47310AB4-9034-4BD1-8D8B-E88AD21A171B}"
108+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windowwalker", "windowwalker", "{8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}"
109+
EndProject
110+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Window Walker", "src\modules\windowwalker\app\Window Walker\Window Walker.csproj", "{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}"
111+
EndProject
112+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowWalker", "src\modules\windowwalker\dll\WindowWalker.vcxproj", "{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}"
106113
EndProject
107114
Global
108115
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -210,6 +217,14 @@ Global
210217
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Debug|x64.Build.0 = Debug|x64
211218
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Release|x64.ActiveCfg = Release|x64
212219
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Release|x64.Build.0 = Release|x64
220+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.ActiveCfg = Debug|x64
221+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.Build.0 = Debug|x64
222+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.ActiveCfg = Release|x64
223+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.Build.0 = Release|x64
224+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.ActiveCfg = Debug|x64
225+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.Build.0 = Debug|x64
226+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.ActiveCfg = Release|x64
227+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.Build.0 = Release|x64
213228
EndGlobalSection
214229
GlobalSection(SolutionProperties) = preSolution
215230
HideSolutionNode = FALSE
@@ -242,6 +257,9 @@ Global
242257
{748417CA-F17E-487F-9411-CAFB6D3F4877} = {2F305555-C296-497E-AC20-5FA1B237996A}
243258
{217DF501-135C-4E38-BFC8-99D4821032EA} = {2F305555-C296-497E-AC20-5FA1B237996A}
244259
{47310AB4-9034-4BD1-8D8B-E88AD21A171B} = {2F305555-C296-497E-AC20-5FA1B237996A}
260+
{8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
261+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
262+
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
245263
EndGlobalSection
246264
GlobalSection(ExtensibilityGlobals) = postSolution
247265
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.6
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Window Walker", "Window Walker\Window Walker.csproj", "{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}"
7+
EndProject
8+
Global
9+
GlobalSection(Performance) = preSolution
10+
HasPerformanceSessions = true
11+
EndGlobalSection
12+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
13+
Debug|Any CPU = Debug|Any CPU
14+
Release|Any CPU = Release|Any CPU
15+
EndGlobalSection
16+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(SolutionProperties) = preSolution
23+
HideSolutionNode = FALSE
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
5+
</startup>
6+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Application x:Class="WindowWalker.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
StartupUri="MainWindow.xaml">
5+
<Application.Resources>
6+
<ResourceDictionary>
7+
<BooleanToVisibilityConverter x:Key="BoolToVis" />
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
10+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
11+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Indigo.xaml" />
12+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml" />
13+
</ResourceDictionary.MergedDictionaries>
14+
</ResourceDictionary>
15+
</Application.Resources>
16+
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft Corporation
2+
// The Microsoft Corporation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
4+
5+
using System.Windows;
6+
7+
namespace WindowWalker
8+
{
9+
/// <summary>
10+
/// Interaction logic for App.xaml
11+
/// </summary>
12+
public partial class App : Application
13+
{
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright (c) Microsoft Corporation
2+
// The Microsoft Corporation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
4+
5+
using System;
6+
using System.Deployment.Application;
7+
8+
namespace WindowWalker.Components
9+
{
10+
public class ApplicationUpdates
11+
{
12+
private static DateTime _lastUpdateCheck = DateTime.Now;
13+
private static bool alreadyCheckingForUpdate = false;
14+
15+
private static bool updateAvailable = false;
16+
17+
public static void InstallUpdateSyncWithInfo()
18+
{
19+
if (alreadyCheckingForUpdate)
20+
{
21+
return;
22+
}
23+
else
24+
{
25+
alreadyCheckingForUpdate = true;
26+
}
27+
28+
var daysSinceLastUpdate = (DateTime.Now - _lastUpdateCheck).Days;
29+
30+
if (ApplicationDeployment.IsNetworkDeployed)
31+
{
32+
if (updateAvailable)
33+
{
34+
UpdateCheckInfo info = null;
35+
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
36+
37+
try
38+
{
39+
info = ad.CheckForDetailedUpdate();
40+
}
41+
catch
42+
{
43+
return;
44+
}
45+
finally
46+
{
47+
_lastUpdateCheck = DateTime.Now;
48+
}
49+
50+
if (info.UpdateAvailable || true)
51+
{
52+
try
53+
{
54+
ad.Update();
55+
System.Windows.Application.Current.Shutdown();
56+
System.Windows.Forms.Application.Restart();
57+
}
58+
catch
59+
{
60+
return;
61+
}
62+
}
63+
}
64+
else
65+
{
66+
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
67+
68+
ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(CheckForUpdateCompleted);
69+
ad.CheckForUpdateAsync();
70+
71+
_lastUpdateCheck = DateTime.Now;
72+
}
73+
}
74+
}
75+
76+
private static void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
77+
{
78+
if (e.Error != null || !e.UpdateAvailable)
79+
{
80+
alreadyCheckingForUpdate = false;
81+
return;
82+
}
83+
else
84+
{
85+
updateAvailable = true;
86+
alreadyCheckingForUpdate = false;
87+
}
88+
}
89+
}
90+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft Corporation
2+
// The Microsoft Corporation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
4+
5+
namespace WindowWalker.Components
6+
{
7+
/// <summary>
8+
/// Command class representing a single command
9+
/// </summary>
10+
public class Command
11+
{
12+
/// <summary>
13+
/// Gets or sets the set of substrings to search for in the search text to figure out if the user wants this command
14+
/// </summary>
15+
public string[] SearchTexts { get; set; }
16+
17+
/// <summary>
18+
/// Gets or sets the help tip to get displayed in the cycling display
19+
/// </summary>
20+
public string Tip { get; set; }
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Copyright (c) Microsoft Corporation
2+
// The Microsoft Corporation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
4+
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Diagnostics;
8+
using System.Linq;
9+
10+
namespace WindowWalker.Components
11+
{
12+
/// <summary>
13+
/// A class to handle the commands entered by the user, different
14+
/// form the user being able to search through their windows
15+
/// </summary>
16+
internal class Commands
17+
{
18+
/// <summary>
19+
/// Initializes static members of the <see cref="Commands"/> class.
20+
/// Constructor primarily used to enforce the creation of tips
21+
/// and populate the enabled commands list
22+
/// </summary>
23+
static Commands()
24+
{
25+
_enabledCommands = new Dictionary<string, Command>
26+
{
27+
{
28+
"quit",
29+
new Command()
30+
{
31+
SearchTexts = new string[]
32+
{
33+
":quit",
34+
":q",
35+
},
36+
Tip = "type \":quit\" to exit",
37+
}
38+
},
39+
{
40+
"launchTerminal",
41+
new Command()
42+
{
43+
SearchTexts = new string[]
44+
{
45+
":lterminal",
46+
":lcmd",
47+
":lterm",
48+
":lt",
49+
},
50+
Tip = "type \":lt\" or \":lcmd\"to launch a new terminal window",
51+
}
52+
},
53+
{
54+
"launchVSCode",
55+
new Command()
56+
{
57+
SearchTexts = new string[]
58+
{
59+
":lvscode",
60+
":lcode",
61+
},
62+
Tip = "type \":lvscode\" or \":lcode\"to launch a new instance of VSCode",
63+
}
64+
},
65+
};
66+
}
67+
68+
/// <summary>
69+
/// Dictionary containing all the enabled commands
70+
/// </summary>
71+
private static readonly Dictionary<string, Command> _enabledCommands;
72+
73+
/// <summary>
74+
/// Primary method which executes on the commands that are passed to it
75+
/// </summary>
76+
/// <param name="commandText">The search text the user has entered</param>
77+
public static void ProcessCommand(string commandText)
78+
{
79+
LivePreview.DeactivateLivePreview();
80+
81+
if (_enabledCommands["quit"].SearchTexts.Contains(commandText))
82+
{
83+
System.Windows.Application.Current.Shutdown();
84+
}
85+
else if (_enabledCommands["launchTerminal"].SearchTexts.Contains(commandText))
86+
{
87+
Process.Start(new ProcessStartInfo("cmd.exe")
88+
{ WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) });
89+
}
90+
else if (_enabledCommands["launchVSCode"].SearchTexts.Contains(commandText))
91+
{
92+
Process.Start("code");
93+
}
94+
}
95+
96+
/// <summary>
97+
/// Gets the tips for all the enabled commands
98+
/// </summary>
99+
public static IEnumerable<string> GetTips()
100+
{
101+
return _enabledCommands.Select(x => x.Value.Tip);
102+
}
103+
}
104+
}

0 commit comments

Comments
 (0)