Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import the source code for Window Walker #1177

Merged
merged 24 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
26e89bb
Initial import of code
betadele Jan 8, 2020
d9e122b
Add WindowWalker to the main solution
betadele Jan 8, 2020
92c3b28
Fix hint paths
betadele Jan 8, 2020
138f9f6
Remove AnyCPU configurations
betadele Jan 8, 2020
76ed9f5
Delete useless folder
betadele Jan 8, 2020
edfa3c5
More cleanup of the csproj
betadele Jan 8, 2020
4a1a6ed
Add the Window Walker dll empty project
betadele Jan 9, 2020
298c9b0
Minor naming fixes
betadele Jan 9, 2020
10baf1e
Get it to show up in the settings page/have it turned on
betadele Jan 9, 2020
4fd4134
Move the windowwalker dll to the right location
betadele Jan 9, 2020
4673c97
Run window walker when enabled
betadele Jan 9, 2020
8ea3c4f
Fix build dependency so that window walker gets built
betadele Jan 9, 2020
0e8d565
Revert "Fix build dependency so that window walker gets built"
betadele Jan 9, 2020
c139d68
Adding dependencies
betadele Jan 9, 2020
4808857
Enable turning off Window Walker
betsegaw Jan 12, 2020
42544fe
Match the install entries for Fancy zones for Window walker. Untested.
betsegaw Jan 13, 2020
210ca36
Verify WixTargets is available and if not, load an alternative
betsegaw Jan 15, 2020
237caf5
Remove duplicate binaries
betsegaw Jan 15, 2020
bc4d52a
Add the missing material design dlls to the installer
betsegaw Jan 15, 2020
2d7214c
Remove left overs of MahApps and ControlzEx to unbreak fanzyzones
betsegaw Jan 25, 2020
a3bde46
Remove template comments from dllmain.cpp
betsegaw Jan 25, 2020
e958414
Remove Window Walker from Module list
betadele Jan 28, 2020
d1b014f
Stop showing WindowWalker window on launch
betadele Jan 28, 2020
69a536f
Reverting all changes to the installer
betadele Jan 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions PowerToys.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}"
ProjectSection(ProjectDependencies) = postProject
{48804216-2A0E-4168-A6D8-9CD068D14227} = {48804216-2A0E-4168-A6D8-9CD068D14227}
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6} = {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}
{74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3}
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB} = {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA} = {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}
{07C389E3-6BC8-41CF-923E-307B1265FA2D} = {07C389E3-6BC8-41CF-923E-307B1265FA2D}
EndProjectSection
Expand Down Expand Up @@ -86,6 +88,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUWPUI", "src\mod
{0E072714-D127-460B-AFAD-B4C40B412798} = {0E072714-D127-460B-AFAD-B4C40B412798}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windowwalker", "windowwalker", "{8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Window Walker", "src\modules\windowwalker\app\Window Walker\Window Walker.csproj", "{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowWalker", "src\modules\windowwalker\dll\WindowWalker.vcxproj", "{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -160,6 +168,14 @@ Global
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.Build.0 = Debug|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.ActiveCfg = Release|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.Build.0 = Release|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.ActiveCfg = Debug|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.Build.0 = Debug|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.ActiveCfg = Release|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.Build.0 = Release|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.ActiveCfg = Debug|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.Build.0 = Debug|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.ActiveCfg = Release|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -183,6 +199,9 @@ Global
{2151F984-E006-4A9F-92EF-C6DDE3DC8413} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
{64A80062-4D8B-4229-8A38-DFA1D7497749} = {BEEAB7F2-FFF6-45AB-9CDB-B04CC0734B88}
{0485F45C-EA7A-4BB5-804B-3E8D14699387} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
{8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
Expand Down
25 changes: 25 additions & 0 deletions src/modules/windowwalker/app/Window Walker.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Window Walker", "Window Walker\Window Walker.csproj", "{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions src/modules/windowwalker/app/Window Walker/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
16 changes: 16 additions & 0 deletions src/modules/windowwalker/app/Window Walker/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Application x:Class="WindowWalker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Indigo.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
15 changes: 15 additions & 0 deletions src/modules/windowwalker/app/Window Walker/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/

using System.Windows;

namespace WindowWalker
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// 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. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/

using System;
using System.Deployment.Application;

namespace WindowWalker.Components
{
public class ApplicationUpdates
{
private static DateTime _lastUpdateCheck = DateTime.Now;
private static bool alreadyCheckingForUpdate = false;

private static bool updateAvailable = false;

public static void InstallUpdateSyncWithInfo()
{
if (alreadyCheckingForUpdate)
{
return;
}
else
{
alreadyCheckingForUpdate = true;
}

var daysSinceLastUpdate = (DateTime.Now - _lastUpdateCheck).Days;

if (ApplicationDeployment.IsNetworkDeployed)
{
if (updateAvailable)
{
UpdateCheckInfo info = null;
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

try
{
info = ad.CheckForDetailedUpdate();
}
catch
{
return;
}
finally
{
_lastUpdateCheck = DateTime.Now;
}

if (info.UpdateAvailable || true)
{
try
{
ad.Update();
System.Windows.Application.Current.Shutdown();
System.Windows.Forms.Application.Restart();
}
catch
{
return;
}
}
}
else
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(CheckForUpdateCompleted);
ad.CheckForUpdateAsync();

_lastUpdateCheck = DateTime.Now;
}
}
}

private static void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
{
if (e.Error != null || !e.UpdateAvailable)
{
alreadyCheckingForUpdate = false;
return;
}
else
{
updateAvailable = true;
alreadyCheckingForUpdate = false;
}
}
}
}
22 changes: 22 additions & 0 deletions src/modules/windowwalker/app/Window Walker/Components/Command.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/

namespace WindowWalker.Components
{
/// <summary>
/// Command class representing a single command
/// </summary>
public class Command
{
/// <summary>
/// Gets or sets the set of substrings to search for in the search text to figure out if the user wants this command
/// </summary>
public string[] SearchTexts { get; set; }

/// <summary>
/// Gets or sets the help tip to get displayed in the cycling display
/// </summary>
public string Tip { get; set; }
}
}
104 changes: 104 additions & 0 deletions src/modules/windowwalker/app/Window Walker/Components/Commands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// 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. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace WindowWalker.Components
{
/// <summary>
/// A class to handle the commands entered by the user, different
/// form the user being able to search through their windows
/// </summary>
internal class Commands
{
/// <summary>
/// Initializes static members of the <see cref="Commands"/> class.
/// Constructor primarily used to enforce the creation of tips
/// and populate the enabled commands list
/// </summary>
static Commands()
{
_enabledCommands = new Dictionary<string, Command>
{
{
"quit",
new Command()
{
SearchTexts = new string[]
{
":quit",
":q",
},
Tip = "type \":quit\" to exit",
}
},
{
"launchTerminal",
new Command()
{
SearchTexts = new string[]
{
":lterminal",
":lcmd",
":lterm",
":lt",
},
Tip = "type \":lt\" or \":lcmd\"to launch a new terminal window",
}
},
{
"launchVSCode",
new Command()
{
SearchTexts = new string[]
{
":lvscode",
":lcode",
},
Tip = "type \":lvscode\" or \":lcode\"to launch a new instance of VSCode",
}
},
};
}

/// <summary>
/// Dictionary containing all the enabled commands
/// </summary>
private static readonly Dictionary<string, Command> _enabledCommands;

/// <summary>
/// Primary method which executes on the commands that are passed to it
/// </summary>
/// <param name="commandText">The search text the user has entered</param>
public static void ProcessCommand(string commandText)
{
LivePreview.DeactivateLivePreview();

if (_enabledCommands["quit"].SearchTexts.Contains(commandText))
{
System.Windows.Application.Current.Shutdown();
}
else if (_enabledCommands["launchTerminal"].SearchTexts.Contains(commandText))
{
Process.Start(new ProcessStartInfo("cmd.exe")
{ WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) });
}
else if (_enabledCommands["launchVSCode"].SearchTexts.Contains(commandText))
{
Process.Start("code");
}
}

/// <summary>
/// Gets the tips for all the enabled commands
/// </summary>
public static IEnumerable<string> GetTips()
{
return _enabledCommands.Select(x => x.Value.Tip);
}
}
}
Loading