forked from microsoft/PowerToys
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
695 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
#pragma once | ||
#include "ModifierKey.h" | ||
|
||
#include <compare> | ||
#include <tuple> | ||
#include <variant> | ||
|
||
|
||
class RunProgramSpec | ||
{ | ||
public: | ||
ModifierKey winKey = ModifierKey::Disabled; | ||
ModifierKey ctrlKey = ModifierKey::Disabled; | ||
ModifierKey altKey = ModifierKey::Disabled; | ||
ModifierKey shiftKey = ModifierKey::Disabled; | ||
DWORD actionKey = {}; | ||
|
||
std::wstring path = L""; | ||
std::vector<DWORD> keys; | ||
|
||
RunProgramSpec() = default; | ||
|
||
// Constructor to initialize Shortcut from it's virtual key code string representation. | ||
RunProgramSpec(const std::wstring& shortcutVK); | ||
|
||
private: | ||
std::vector<std::wstring> splitwstring(const std::wstring& input, wchar_t delimiter); | ||
|
||
bool RunProgramSpec::SetKey(const DWORD input); | ||
}; | ||
|
||
RunProgramSpec::RunProgramSpec(const std::wstring& shortcutVK) : | ||
winKey(ModifierKey::Disabled), ctrlKey(ModifierKey::Disabled), altKey(ModifierKey::Disabled), shiftKey(ModifierKey::Disabled), actionKey(NULL) | ||
{ | ||
auto _keys = splitwstring(shortcutVK, ';'); | ||
for (auto it : _keys) | ||
{ | ||
auto vkKeyCode = std::stoul(it); | ||
SetKey(vkKeyCode); | ||
} | ||
} | ||
|
||
std::vector<std::wstring> RunProgramSpec::splitwstring(const std::wstring& input, wchar_t delimiter) | ||
{ | ||
std::wstringstream ss(input); | ||
std::wstring item; | ||
std::vector<std::wstring> splittedStrings; | ||
while (std::getline(ss, item, delimiter)) | ||
{ | ||
splittedStrings.push_back(item); | ||
} | ||
|
||
return splittedStrings; | ||
} | ||
|
||
bool RunProgramSpec::SetKey(const DWORD input) | ||
{ | ||
// Since there isn't a key for a common Win key we use the key code defined by us | ||
if (input == CommonSharedConstants::VK_WIN_BOTH) | ||
{ | ||
if (winKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LWIN) | ||
{ | ||
if (winKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RWIN) | ||
{ | ||
if (winKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_LCONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RCONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_CONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LMENU) | ||
{ | ||
if (altKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RMENU) | ||
{ | ||
if (altKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_MENU) | ||
{ | ||
if (altKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LSHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RSHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_SHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Both; | ||
} | ||
else | ||
{ | ||
if (actionKey == input) | ||
{ | ||
return false; | ||
} | ||
actionKey = input; | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
#include "pch.h" | ||
#include "RunProgramSpec.h" | ||
|
||
class RunProgramSpec | ||
{ | ||
public: | ||
ModifierKey winKey = ModifierKey::Disabled; | ||
ModifierKey ctrlKey = ModifierKey::Disabled; | ||
ModifierKey altKey = ModifierKey::Disabled; | ||
ModifierKey shiftKey = ModifierKey::Disabled; | ||
DWORD actionKey = {}; | ||
|
||
std::wstring path = L""; | ||
std::vector<DWORD> keys; | ||
|
||
RunProgramSpec(const std::wstring& shortcutVK) : | ||
winKey(ModifierKey::Disabled), ctrlKey(ModifierKey::Disabled), altKey(ModifierKey::Disabled), shiftKey(ModifierKey::Disabled), actionKey(NULL) | ||
{ | ||
auto _keys = splitwstring(shortcutVK, ';'); | ||
for (auto it : _keys) | ||
{ | ||
auto vkKeyCode = std::stoul(it); | ||
SetKey(vkKeyCode); | ||
} | ||
} | ||
|
||
std::vector<std::wstring> splitwstring(const std::wstring& input, wchar_t delimiter) | ||
{ | ||
std::wstringstream ss(input); | ||
std::wstring item; | ||
std::vector<std::wstring> splittedStrings; | ||
while (std::getline(ss, item, delimiter)) | ||
{ | ||
splittedStrings.push_back(item); | ||
} | ||
|
||
return splittedStrings; | ||
} | ||
|
||
bool SetKey(const DWORD input) | ||
{ | ||
// Since there isn't a key for a common Win key we use the key code defined by us | ||
if (input == CommonSharedConstants::VK_WIN_BOTH) | ||
{ | ||
if (winKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LWIN) | ||
{ | ||
if (winKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RWIN) | ||
{ | ||
if (winKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
winKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_LCONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RCONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_CONTROL) | ||
{ | ||
if (ctrlKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
ctrlKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LMENU) | ||
{ | ||
if (altKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RMENU) | ||
{ | ||
if (altKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_MENU) | ||
{ | ||
if (altKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
altKey = ModifierKey::Both; | ||
} | ||
else if (input == VK_LSHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Left) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Left; | ||
} | ||
else if (input == VK_RSHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Right) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Right; | ||
} | ||
else if (input == VK_SHIFT) | ||
{ | ||
if (shiftKey == ModifierKey::Both) | ||
{ | ||
return false; | ||
} | ||
shiftKey = ModifierKey::Both; | ||
} | ||
else | ||
{ | ||
if (actionKey == input) | ||
{ | ||
return false; | ||
} | ||
actionKey = input; | ||
} | ||
|
||
return true; | ||
} | ||
}; |
Oops, something went wrong.
356cb78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log for details.
Unrecognized words (6)
EDITRUNPROGRAMS
JLO
PROGRAMNAME
Programtool
RUNPROGRAMSPEC
shorcut
Previously acknowledged words that are now absent
administra RSAT systemroot sysvol :arrow_right:To accept ✔️ these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands
... in a clone of the git@github.com:jefflord/PowerToys.git repository
on the
run-program-shortcuts
branch (ℹ️ how do I use this?):Available 📚 dictionaries could cover words not in the 📘 dictionary
This includes both expected items (2287) from .github/actions/spell-check/expect.txt and unrecognized words (6)
Consider adding them using (in
.github/workflows/spelling2.yml
):To stop checking additional dictionaries, add:
Errors (1)
See the 📜action log for details.
See ❌ Event descriptions for more information.
If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.