Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflord committed Dec 16, 2023
1 parent eaaf13b commit 6258205
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ StackPanel SetupOpenURIControls(StackPanel& parent, StackPanel& row, Shortcut& s
}
Shortcut tempShortcut;
tempShortcut.operationType = Shortcut::OperationType::OpenURI;
tempShortcut.uriToOpen = (uriTextBox.Text().c_str());
tempShortcut.uriToOpen = ShortcutControl::RemoveExtraQuotes(uriTextBox.Text().c_str());
ShortcutControl::shortcutRemapBuffer[rowIndex].first[1] = tempShortcut;

//ShortcutControl::RunProgramTextOnChange(rowIndex, shortcutRemapBuffer, runProgramPathInput, runProgramArgsForProgramInput, runProgramStartInDirInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ namespace KeyboardEventHandlers
{
toast(L"Error", L"the URI is bad");
}

Logger::trace(L"CKBH:returning..");
return 1;
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ namespace KeyboardEventHandlers
if (targetPid != 0)
{
Logger::trace(L"CKBH:{}, already running, pid:{}", fileNamePart, targetPid);
if (!ShowProgram(targetPid, fileNamePart, false, true))
if (!ShowProgram(targetPid, fileNamePart, false, true, 0))
{
/*auto future = std::async(std::launch::async, [=] {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
Expand Down Expand Up @@ -1215,14 +1215,14 @@ namespace KeyboardEventHandlers
processId = GetProcessId(newProcessHandle);
}

ShowProgram(processId, fileNamePart, true, false);
ShowProgram(processId, fileNamePart, true, false, 0);
}
return;
}

bool ShowProgram(DWORD pid, std::wstring programName, bool isNewProcess, bool hideIfVisible)
bool ShowProgram(DWORD pid, std::wstring programName, bool isNewProcess, bool hideIfVisible, int retryCount)
{
Logger::trace(L"CKBH:ShowProgram starting with {},{},{}", pid, programName, isNewProcess);
Logger::trace(L"CKBH:ShowProgram starting with {},{},{}, retryCount:{}", pid, programName, isNewProcess, retryCount);

// a good place to look for this...
// https://github.com/ritchielawrence/cmdow
Expand All @@ -1245,7 +1245,7 @@ namespace KeyboardEventHandlers
}
else
{
Logger::trace(L"CKBH:{}, no GetForegroundWindow, doing SW_RESTORE", programName);
Logger::trace(L"CKBH:{}, not ForegroundWindow, doing SW_RESTORE", programName);

// Check if the window is minimized
if (IsIconic(hwnd))
Expand Down Expand Up @@ -1275,7 +1275,16 @@ namespace KeyboardEventHandlers
}
else
{
Logger::trace(L"CKBH:{}, No hwnd from FindMainWindow", programName);
if (retryCount < 20)
{
Logger::trace(L"CKBH:hwnd not found will retry for pid:{}", pid);

auto future = std::async(std::launch::async, [=] {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ShowProgram(pid, programName, isNewProcess, hideIfVisible, retryCount + 1);
return false;
});
}
}

if (isNewProcess)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace KeyboardEventHandlers
std::wstring GetFileNameFromPath(const std::wstring& fullPath);

// Function to a find and show a running program
bool ShowProgram(DWORD pid, std::wstring programName, bool isNewProcess, bool hideIfVisible);
bool ShowProgram(DWORD pid, std::wstring programName, bool isNewProcess, bool hideIfVisible, int retryCount);

// Function to a handle an os-level shortcut remap
intptr_t HandleOSLevelShortcutRemapEvent(KeyboardManagerInput::InputInterface& ii, LowlevelKeyboardEvent* data, State& state) noexcept;
Expand Down

1 comment on commit 6258205

@github-actions
Copy link

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 or 📝 job summary for details.

Unrecognized words (31)
ALLOWCHORDS
ARGSFORPROGRAM
BIF
BROWSEINFO
CKBH
cmdow
commdlg
CRTL
ELEVATIONTYPEDIFFERENTUSER
ELEVATIONTYPEELEVATED
ELEVATIONTYPENORMAL
FILEMUSTEXIST
Lencode
LPITEMIDLIST
lpstr
NEWDIALOGSTYLE
ofn
OPENFILENAME
PATHMUSTEXIST
PATHTOPROGRAM
PROCESSENTRY
RETURNONLYFSDIRS
ritchielawrence
runasuser
SNAPPROCESS
STARTINDIRFORPROGRAM
tlhelp
Toolhelp
URIOr
urlmon
wcsicmp
Previously acknowledged words that are now absent CHT constexpr DEU hashcode HEB JPN LAlt Lambson langword nodiscard pcs qps roundf RUS RValue SVE tonos weakme wifi 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:jefflord/PowerToys.git repository
on the launch-apps-3350 branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/jefflord/PowerToys/actions/runs/7233278882/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (1857) from .github/actions/spell-check/expect.txt and unrecognized words (31)

Dictionary Entries Covers Uniquely
cspell:r/src/r.txt 543 1 1
cspell:cpp/src/people.txt 23 1
cspell:cpp/src/ecosystem.txt 51 1

Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/check-spelling@v0.0.22 in its with:

      with:
        extra_dictionaries:
          cspell:r/src/r.txt
          cspell:cpp/src/people.txt
          cspell:cpp/src/ecosystem.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/check-spelling@v0.0.22 in its with:

check_extra_dictionaries: ''
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.

Please sign in to comment.