mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-04-12 01:47:24 +10:00
Added option to set custom commands for controls
Includes a unique option for each control and supports environment variables.
This commit is contained in:
committed by
Ibuprophen
parent
be8568ce00
commit
ef663d2051
@@ -79,6 +79,7 @@ enum
|
||||
OPEN_NOTHING,
|
||||
OPEN_CLASSIC,
|
||||
OPEN_WINDOWS,
|
||||
OPEN_CUSTOM,
|
||||
OPEN_BOTH,
|
||||
OPEN_DESKTOP,
|
||||
OPEN_CORTANA,
|
||||
@@ -3348,6 +3349,16 @@ static LRESULT CALLBACK HookProgManThread( int code, WPARAM wParam, LPARAM lPara
|
||||
msg->message=WM_NULL;
|
||||
if (control==OPEN_CLASSIC)
|
||||
PostMessage(g_TaskBar,g_StartMenuMsg,MSG_TOGGLE,0);
|
||||
else if (control==OPEN_CUSTOM)
|
||||
{
|
||||
CString commandText=GetSettingString(L"WinKeyCommand");
|
||||
if (!commandText.IsEmpty())
|
||||
{
|
||||
wchar_t expandedCommand[_MAX_PATH]{};
|
||||
::ExpandEnvironmentStrings(commandText, expandedCommand, _countof(expandedCommand));
|
||||
ShellExecute(NULL,NULL,expandedCommand,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3431,6 +3442,16 @@ if (!g_bTrimHooks)
|
||||
PostMessage(g_ProgWin,WM_SYSCOMMAND,SC_TASKLIST,'WSMK');
|
||||
else if (control==OPEN_CORTANA)
|
||||
OpenCortana();
|
||||
else if (control==OPEN_CUSTOM)
|
||||
{
|
||||
CString commandText=GetSettingString(L"ShiftWinCommand");
|
||||
if (!commandText.IsEmpty())
|
||||
{
|
||||
wchar_t expandedCommand[_MAX_PATH]{};
|
||||
::ExpandEnvironmentStrings(commandText, expandedCommand, _countof(expandedCommand));
|
||||
ShellExecute(NULL,NULL,expandedCommand,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (msg->wParam==MSG_DRAG || msg->wParam==MSG_SHIFTDRAG)
|
||||
{
|
||||
@@ -3590,12 +3611,22 @@ if (!g_bTrimHooks)
|
||||
// left or middle click on start button
|
||||
FindWindowsMenu();
|
||||
const wchar_t *name;
|
||||
const wchar_t *command;
|
||||
if (bMiddle)
|
||||
{
|
||||
name=L"MiddleClick";
|
||||
command=L"MiddleClickCommand";
|
||||
}
|
||||
else if (GetKeyState(VK_SHIFT)<0)
|
||||
{
|
||||
name=L"ShiftClick";
|
||||
command=L"ShiftClickCommand";
|
||||
}
|
||||
else
|
||||
{
|
||||
name=L"MouseClick";
|
||||
command=L"MouseClickCommand";
|
||||
}
|
||||
|
||||
int control=GetSettingInt(name);
|
||||
if (control==OPEN_BOTH && GetWinVersion()>=WIN_VER_WIN10)
|
||||
@@ -3611,6 +3642,16 @@ if (!g_bTrimHooks)
|
||||
PostMessage(g_ProgWin,WM_SYSCOMMAND,SC_TASKLIST,'WSMM');
|
||||
else if (control==OPEN_CORTANA)
|
||||
OpenCortana();
|
||||
else if (control==OPEN_CUSTOM)
|
||||
{
|
||||
CString commandText=GetSettingString(command);
|
||||
if (!commandText.IsEmpty())
|
||||
{
|
||||
wchar_t expandedCommand[_MAX_PATH]{};
|
||||
::ExpandEnvironmentStrings(commandText, expandedCommand, _countof(expandedCommand));
|
||||
ShellExecute(NULL,NULL,expandedCommand,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
msg->message=WM_NULL;
|
||||
}
|
||||
}
|
||||
@@ -3751,6 +3792,16 @@ if (!g_bTrimHooks)
|
||||
FindWindowsMenu();
|
||||
PostMessage(g_ProgWin,WM_SYSCOMMAND,SC_TASKLIST,'WSMM');
|
||||
}
|
||||
else if (control==OPEN_CUSTOM)
|
||||
{
|
||||
CString commandText=GetSettingString(L"HoverCommand");
|
||||
if (!commandText.IsEmpty())
|
||||
{
|
||||
wchar_t expandedCommand[_MAX_PATH]{};
|
||||
::ExpandEnvironmentStrings(commandText, expandedCommand, _countof(expandedCommand));
|
||||
ShellExecute(NULL,NULL,expandedCommand,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
taskBar->bTimer=false;
|
||||
|
||||
Reference in New Issue
Block a user