Skip to content

Commit

Permalink
deploy: 10dd219
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 2, 2024
1 parent cffc500 commit 00ef7f7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
4 changes: 2 additions & 2 deletions catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@
"published": 1704123810000,
"rating": 10,
"ratingUsers": 78,
"updated": 1732380450000,
"updated": 1733160238000,
"users": 2624
},
"metadata": {
Expand All @@ -2712,7 +2712,7 @@
"explorer.exe"
],
"name": "Click on empty taskbar space",
"version": "1.7"
"version": "1.8"
}
},
"taskbar-grouping": {
Expand Down
4 changes: 4 additions & 0 deletions changelogs/taskbar-empty-space-clicks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.8 ([Dec 2, 2024](https://github.com/ramensoftware/windhawk-mods/blob/10dd219bec0369013eeeb9a3c0bee7efc3987f41/mods/taskbar-empty-space-clicks.wh.cpp))

Added fallback method to open Start menu when Start button was not found on the taskbar (e.g. was hidden via other Windhawk mod) - temporary hotfix for https://github.com/m1lhaus/windhawk-mods/issues/21.

## 1.7 ([Nov 23, 2024](https://github.com/ramensoftware/windhawk-mods/blob/2e30970216e691be9103eb6693f557e63eb39e45/mods/taskbar-empty-space-clicks.wh.cpp))

- Start menu now opens on the same monitor where the taskbar was clicked - fixes https://github.com/m1lhaus/windhawk-mods/issues/19
Expand Down
41 changes: 26 additions & 15 deletions mods/taskbar-empty-space-clicks.wh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @id taskbar-empty-space-clicks
// @name Click on empty taskbar space
// @description Trigger custom action when empty space on a taskbar is double/middle clicked
// @version 1.7
// @version 1.8
// @author m1lhaus
// @github https://github.com/m1lhaus
// @include explorer.exe
Expand Down Expand Up @@ -2161,23 +2161,21 @@ void SendWinTabKeypress()
SendKeypress({VK_LWIN, VK_TAB});
}

void SendWinKeypress()
bool ClickStartMenu()
{
LOG_TRACE();

const MouseClick &lastClick = g_mouseClickQueue[-1];
if (!lastClick.onEmptySpace)
{
LOG_ERROR(L"Failed to send Win keypress - last click was not on empty space");
return;
return false;
}

// Get the taskbar element from the last mouse click position
com_ptr<IUIAutomationElement> pWindowElement = NULL;
if (FAILED(g_pUIAutomation->ElementFromPoint(lastClick.position, pWindowElement.put())) || !pWindowElement)
{
LOG_ERROR(L"Failed to taskbar UI element from mouse click");
return;
return false;
}

com_ptr<IUIAutomationElement> pStartButton = NULL;
Expand All @@ -2195,7 +2193,7 @@ void SendWinKeypress()
!pControlTypeCondition)
{
LOG_ERROR(L"Failed to create ControlType condition for Start button search.");
return;
return false;
}

// Create Condition 2: ClassName == "Start"
Expand All @@ -2206,7 +2204,7 @@ void SendWinKeypress()
!pClassNameCondition)
{
LOG_ERROR(L"Failed to create ClassName condition for Start button search.");
return;
return false;
}

// Combine both conditions using AndCondition
Expand All @@ -2217,14 +2215,14 @@ void SendWinKeypress()
!pAndCondition)
{
LOG_ERROR(L"Failed to create ControlType&&ClassName condition for Start button search.");
return;
return false;
}

// Use the combined condition to find the Start button within the Taskbar
if (FAILED(pWindowElement->FindFirst(TreeScope_Children, pAndCondition.get(), pStartButton.put())) || !pStartButton)
{
LOG_ERROR(L"Failed to locate the Start button element for Windows 10 taskbar.");
return;
return false;
}
}
else
Expand All @@ -2239,14 +2237,14 @@ void SendWinKeypress()
!pCondition)
{
LOG_ERROR(L"Failed to create property condition for locating the Start button.");
return;
return false;
}

// Use the AutomationId condition to find the Start button within the Taskbar
if (FAILED(pWindowElement->FindFirst(TreeScope_Children, pCondition.get(), pStartButton.put())) || !pStartButton)
{
LOG_ERROR(L"Failed to locate the Start button element for Windows 11 taskbar.");
return;
return false;
}
}

Expand All @@ -2258,12 +2256,13 @@ void SendWinKeypress()
if (FAILED(pStartButton->GetCurrentPatternAs(UIA_InvokePatternId, IID_PPV_ARGS(pInvoke.put()))) || !pInvoke)
{
LOG_ERROR(L"Invoke pattern not supported by the Start button.");
return;
return false;
}

if (FAILED(pInvoke->Invoke()))
{
LOG_ERROR(L"Failed to invoke the Start button.");
return false;
}
else
{
Expand All @@ -2277,18 +2276,30 @@ void SendWinKeypress()
if (FAILED(pStartButton->GetCurrentPatternAs(UIA_TogglePatternId, IID_PPV_ARGS(pToggle.put()))) || !pToggle)
{
LOG_ERROR(L"Toggle pattern not supported by the Start button.");
return;
return false;
}

if (FAILED(pToggle->Toggle()))
{
LOG_ERROR(L"Failed to toggle the Start button.");
return false;
}
else
{
LOG_INFO(L"Start button toggled successfully on Windows 11 taskbar.");
}
}
return true;
}

void OpenStartMenu()
{
LOG_TRACE();
if (!ClickStartMenu()) // if user hide the start menu via other Windhawk mod, we can't click it
{
LOG_INFO(L"Sending Win keypress");
SendKeypress({VK_LWIN});
}
}

void OpenTaskManager(HWND taskbarhWnd)
Expand Down Expand Up @@ -2632,7 +2643,7 @@ void ExecuteTaskbarAction(TaskBarAction taskbarAction, HWND hWnd)
}
else if (taskbarAction == ACTION_OPEN_START_MENU)
{
SendWinKeypress();
OpenStartMenu();
}
else if (taskbarAction == ACTION_SEND_KEYPRESS)
{
Expand Down
27 changes: 12 additions & 15 deletions updates.atom
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://windhawk.net/</id>
<title>Windhawk Mod Updates</title>
<updated>2024-12-01T18:44:49.000Z</updated>
<updated>2024-12-02T17:23:58.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<link rel="alternate" href="https://windhawk.net/"/>
<subtitle>Updates in the official collection of Windhawk mods</subtitle>
<icon>https://windhawk.net/favicon.ico</icon>
<rights>Ramen Software</rights>
<entry>
<title type="html"><![CDATA[Click on empty taskbar space 1.8]]></title>
<id>https://windhawk.net/mods/taskbar-empty-space-clicks#10dd219bec0369013eeeb9a3c0bee7efc3987f41</id>
<link href="https://windhawk.net/mods/taskbar-empty-space-clicks"/>
<updated>2024-12-02T17:23:58.000Z</updated>
<content type="html"><![CDATA[<p>Added fallback method to open Start menu when Start button was not found on the taskbar (e.g. was hidden via other Windhawk mod) - temporary hotfix for https://github.com/m1lhaus/windhawk-mods/issues/21.</p>]]></content>
<author>
<name>m1lhaus</name>
<uri>https://github.com/m1lhaus</uri>
</author>
</entry>
<entry>
<title type="html"><![CDATA[Taskbar Clock Customization 1.4]]></title>
<id>https://windhawk.net/mods/taskbar-clock-customization#6082c60100929675fc56d995c9f9a6ae7b221c9e</id>
Expand Down Expand Up @@ -291,18 +302,4 @@ center, etc. to another monitor.</p>
<uri>https://github.com/aubymori</uri>
</author>
</entry>
<entry>
<title type="html"><![CDATA[Taskbar auto-hide when maximized 1.1.2]]></title>
<id>https://windhawk.net/mods/taskbar-auto-hide-when-maximized#699e3b8e67452ab1f163ddc7bd9376549364e4db</id>
<link href="https://windhawk.net/mods/taskbar-auto-hide-when-maximized"/>
<updated>2024-11-09T16:48:24.000Z</updated>
<content type="html"><![CDATA[<ul>
<li>Fixed the mod not applying on startup in some cases.</li>
<li>ExplorerPatcher taskbar: Added support for secondary taskbars for versions newer than 67.1.</li>
</ul>]]></content>
<author>
<name>m417z</name>
<uri>https://github.com/m417z</uri>
</author>
</entry>
</feed>

0 comments on commit 00ef7f7

Please sign in to comment.