From 4d7e94d3fe89cdef46c1329fc7805a0c157e3c07 Mon Sep 17 00:00:00 2001 From: Chatchai Saratakij Date: Fri, 17 Aug 2018 23:02:18 +0700 Subject: [PATCH 1/4] Update docs --- Keybind.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Keybind.md b/Keybind.md index 0f69785..e980c59 100644 --- a/Keybind.md +++ b/Keybind.md @@ -24,7 +24,7 @@ [ Mod + 7 ] - Switch to Workspace 7 [ Mod + 8 ] - Switch to Workspace 8 [ Mod + 9 ] - Switch to Workspace 9 -[ Mod + 10 ] - Switch to Workspace 10 +[ Mod + 0 ] - Switch to Workspace 10 [ Mod + Shift + 1 ] - Move window to workspace 1 [ Mod + Shift + 2 ] - Move window to workspace 2 [ Mod + Shift + 3 ] - Move window to workspace 3 @@ -34,6 +34,6 @@ [ Mod + Shift + 7 ] - Move window to workspace 7 [ Mod + Shift + 8 ] - Move window to workspace 8 [ Mod + Shift + 9 ] - Move window to workspace 9 -[ Mod + Shift + 10 ] - Move window to workspace 10 +[ Mod + Shift + 0 ] - Move window to workspace 10 [ Mod + F12 ] - Toggle Explorer Shell's Taskbar ``` From 2f47151b1c4dd2dec52b392679a67f76179af187 Mon Sep 17 00:00:00 2001 From: Chatchai Saratakij Date: Sat, 18 Aug 2018 17:27:44 +0700 Subject: [PATCH 2/4] Send current focus window to the appbar --- MyWinTiles/MyWinTiles.cpp | 65 +++++++++++++++++++++++++++------------ MyWinTiles/MyWinTiles.h | 3 +- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/MyWinTiles/MyWinTiles.cpp b/MyWinTiles/MyWinTiles.cpp index 03c13b9..5bd9a2e 100644 --- a/MyWinTiles/MyWinTiles.cpp +++ b/MyWinTiles/MyWinTiles.cpp @@ -4,7 +4,7 @@ #define MAX_LOADSTRING 100 -HWND bar = NULL; +HWND appbar = NULL; int currentFocusIndice[MAX_WORKSPACE]; int totalWindowInWorkspace[MAX_WORKSPACE]; @@ -68,9 +68,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, case HSHELL_WINDOWCREATED: { HWND hWnd = (HWND)msg.lParam; - bar = FindWindow(_T(APPBAR_WINDOW_CLASS), NULL); + appbar = FindWindow(_T(APPBAR_WINDOW_CLASS), NULL); - if (bar != NULL && bar == hWnd) + if (appbar != NULL && appbar == hWnd) break; if (!IsWindow(hWnd) && IsValidWindow(hWnd)) @@ -107,25 +107,15 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, case HSHELL_RUDEAPPACTIVATED: { + HWND hWnd = (HWND) msg.lParam; + SendCurrentFocusWindowThroughIPC(msg.hwnd, hWnd); + if (isFocusByHotkey) { isFocusByHotkey = FALSE; break; } - HWND hWnd = (HWND) msg.lParam; - - int indice = currentFocusIndice[currentWorkSpace - 1]; - HWND* currentAry = GetWorkspaceByID(currentWorkSpace); - - if (hWnd != currentAry[indice]) { - for (UINT i = 0; i < MAX_WORKSPACE; ++i) { - if (currentAry[i] == hWnd) { - currentFocusIndice[currentWorkSpace - 1] = i; - break; - } - } - } - + UpdateFocusIndice(currentWorkSpace, hWnd); break; } @@ -1081,9 +1071,9 @@ void SwapCurrentFocusWindow(UINT workspace, UINT swapType) void SendCurrentWorkspaceThroughIPC(HWND hWnd) { ULONG updateCurrentWorkspace = 1; - HWND testbar = FindWindow(_T(APPBAR_WINDOW_CLASS), NULL); + appbar = FindWindow(_T(APPBAR_WINDOW_CLASS), NULL); - if (testbar == NULL) + if (appbar == NULL) return; COPYDATASTRUCT data; @@ -1092,7 +1082,24 @@ void SendCurrentWorkspaceThroughIPC(HWND hWnd) data.cbData = sizeof(UINT); data.lpData = ¤tWorkSpace; - SendMessage(testbar, WM_COPYDATA, (WPARAM) hWnd, (LPARAM)(LPVOID) &data); + SendMessage(appbar, WM_COPYDATA, (WPARAM) hWnd, (LPARAM)(LPVOID) &data); +} + +void SendCurrentFocusWindowThroughIPC(HWND currentWindow, HWND focusWindow) +{ + ULONG updateFocusWindow = 2; + appbar = FindWindow(_T(APPBAR_WINDOW_CLASS), NULL); + + if (appbar == NULL) + return; + + COPYDATASTRUCT data; + + data.dwData = updateFocusWindow; + data.cbData = sizeof(HWND); + data.lpData = &focusWindow; + + SendMessage(appbar, WM_COPYDATA, (WPARAM) currentWindow, (LPARAM)(LPVOID) &data); } void ToggleWindow(HWND hWnd) @@ -1105,3 +1112,21 @@ void ToggleWindow(HWND hWnd) else ShowWindow(hWnd, SW_SHOW); } + +void UpdateFocusIndice(UINT workspaceID, HWND hWnd) +{ + if (workspaceID > MAX_WORKSPACE) + return; + + int indice = currentFocusIndice[workspaceID - 1]; + HWND* currentAry = GetWorkspaceByID(workspaceID); + + if (hWnd != currentAry[indice]) { + for (UINT i = 0; i < MAX_WORKSPACE; ++i) { + if (currentAry[i] == hWnd) { + currentFocusIndice[workspaceID - 1] = i; + break; + } + } + } +} diff --git a/MyWinTiles/MyWinTiles.h b/MyWinTiles/MyWinTiles.h index d46f8bc..f363a9e 100644 --- a/MyWinTiles/MyWinTiles.h +++ b/MyWinTiles/MyWinTiles.h @@ -89,5 +89,6 @@ void RefreshWorkspace(UINT); void UpdateTotalWindowInWorkspace(UINT); void SwapCurrentFocusWindow(UINT, UINT); void SendCurrentWorkspaceThroughIPC(HWND); +void SendCurrentFocusWindowThroughIPC(HWND, HWND); void ToggleWindow(HWND); - +void UpdateFocusIndice(UINT, HWND); From 7728edd02a480095d4cde3faae0d958e0e818586 Mon Sep 17 00:00:00 2001 From: Chatchai Saratakij Date: Sun, 19 Aug 2018 02:02:07 +0700 Subject: [PATCH 3/4] Update README.md --- README.md | 3 +++ optinal_disable_keys.ahk | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 optinal_disable_keys.ahk diff --git a/README.md b/README.md index a3c124e..f252415 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ NoWinKeys REG_DWORD 0x00000001 (1) # Additional - You might want to use [MyWinBar](https://github.com/CSaratakij/MyWinBar), an AppBar for MyWinTiles. +- You might want to use [Wox](https://github.com/Wox-launcher/Wox), an alternative App Launcher of choice for MyWinTiles. +Use with [Optional Disable Key](optinal_disable_keys.ahk) for convenience. # Issue - Test with Windows 10 (Other windows version don't officially support.) @@ -33,3 +35,4 @@ NoWinKeys REG_DWORD 0x00000001 (1) # License - [GNU GPLv3](LICENSE) + diff --git a/optinal_disable_keys.ahk b/optinal_disable_keys.ahk new file mode 100644 index 0000000..e663be8 --- /dev/null +++ b/optinal_disable_keys.ahk @@ -0,0 +1,2 @@ +~LWin Up::Return +^[::Send {Esc} From 0ee87bf9ee72efe2d6fa3efdee56f8c637fde0da Mon Sep 17 00:00:00 2001 From: Chatchai Saratakij Date: Sun, 19 Aug 2018 02:38:16 +0700 Subject: [PATCH 4/4] Add version description in executable --- MyWinTiles/MyWinTiles.rc | Bin 6890 -> 9354 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/MyWinTiles/MyWinTiles.rc b/MyWinTiles/MyWinTiles.rc index dcac206c8cf9f06a468a4130b14488b04a02e445..d1f20494b9035a565278b1c251649d1b14db087c 100644 GIT binary patch delta 1713 zcmbVNOHWf#5S~gYy$~8ogH=Sh!37U3Z4nnn6COgLvCv{m)x_9TLy1 z7&F8lfG%7RqgIVe*X~TzjfsgHV%(uCU8vujzPO}OW18D@&p9*SeDlqmbH5zA>96?p z(@k#DpOo9n_>#89?|10@wyc$}YHMzt1}I5WG)Dq0h z+V1u`OlkgBcDp-3y);6D6a#>a0rJCihz=;1G3vugX^R*Fgn3bW&PU6?a;K%8Us)`C z#!}CrDjSDvjeN^u<9n8o+`N)EEDa$3m>*SqRBJt&l~=9n@}B9@X3TXG)T2V@|Ch5jjE@aYc)SinN+RW#3@IkNr&NHUU&FRdS=tHX~M#%x;qk3 zi$a4GbV+b`dEH7B3C1XjgiqkjPeCLe!#F}dyzAR`^6S-9i9H|e0`N3?>*NJ%d4#uz zvbG`M2dN)29ivFmqelfS?UIN0Db)u-Zy4%_>9`VRnGVt<1$eR6u@VFD0ID;Fni;7T zeML+N2rRMK2NC8V!o*+fJzMOPXq^ON8Y2WLd@4t%3nAp!m2)a86rs};0!1T<;(i#^ z`=HBKD}asfG_a>(YR(@D%k=6Sk|yAj*~1Mo8^vZM@mO4 z^mRUp;_aml6ukqv%TvG@G-8N?ayO(f#-Zu<%Jq1+k#Pi8(z9u( zAa{D9%YZ0HK6?VBi@nr|6%UVU@3_Gk