commit 3f611e89a92b4e763822a4c76c824cb39878dd20
parent a86bd10fade709650d559496617e059b1b8d9131
Author: theSoberSobber <akshatshrivastava0010@gmail.com>
Date: Tue, 5 Mar 2024 22:43:04 +0530
parent a86bd10fade709650d559496617e059b1b8d9131
Author: theSoberSobber <akshatshrivastava0010@gmail.com>
Date: Tue, 5 Mar 2024 22:43:04 +0530
mac kill mode
6 files changed, 44 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md @@ -36,6 +36,10 @@ static const char *adminCmd[] = {"runas", "wt.exe", NULL}; static const char *vscode[] = {NULL, "code", "D:/code"}; static const char *codeforces[] = {"open", "https://codeforces.com", NULL}; static const char *leetcode[] = {"open", "https://leetcode.com", NULL}; +static const char *explorer[] = {NULL, "explorer.exe", NULL}; +static const char *taskManager[] = {NULL, "Taskmgr.exe", NULL}; +static const char *adbConnect[] = {NULL, "D:/win32/ADB-Connect/adb-tcpip-connect.exe", NULL}; +static const char *scrcpy[] = {NULL, "D:/win32/ADB-Connect/launch-scrcpy.vbs", NULL}; #define NUMKEY(x) \ {MODKEY, x+'0', GoToDesktopNumberW, {.i= x ? x : 10}}, \ @@ -45,14 +49,19 @@ static Key keys[] = { /* modifier key function argument */ { MODKEY, 'B', test, {0} }, { MODKEY, 'O', spawn, {.v = vscode} }, - { MODKEY, VK_RETURN, spawn, {.v = termcmd } }, - { MODKEY | MOD_SHIFT, VK_RETURN, spawn, {.v = adminCmd } }, - { MODKEY, 'C', spawn, {.v = codeforces } }, - { MODKEY, 'L', spawn, {.v = leetcode } }, - { MODKEY, 'E', toggleexplorer, {0} }, - { MODKEY, 'Q', killForeground, {0} }, - { MODKEY | MOD_SHIFT, 'Q', quit, {0} }, - #ifdef VDA_FEATURES + { MODKEY, VK_RETURN, spawn, {.v = termcmd } }, + { MODKEY | MOD_SHIFT, VK_RETURN, spawn, {.v = adminCmd } }, + { MODKEY, 'C', spawn, {.v = codeforces } }, + { MODKEY, 'L', spawn, {.v = leetcode } }, + { MODKEY | MOD_SHIFT, 'E', toggleexplorer, {0} }, + { MODKEY, 'Q', killForeground, {0} }, + { MODKEY | MOD_SHIFT, 'Q', killMacForeground, {0} }, + { MODKEY, 'E', spawn, {.v = explorer}}, + { MODKEY | MOD_SHIFT, 'Q', quit, {0} }, + { MODKEY, 'T', spawn, {.v = taskManager } }, + { MODKEY, 'D', spawn, {.v = adbConnect } }, + { MODKEY, 'F', spawn, {.v = scrcpy } }, + #ifdef VDA_FEATURES NUMKEY(1), NUMKEY(2), NUMKEY(3),
diff --git a/actions.c b/actions.c @@ -26,6 +26,15 @@ void killForeground(const Arg* arg){ PostMessage(curr, WM_CLOSE, 0, 0); } +void killMacForeground(const Arg* arg) { + HWND curr = GetForegroundWindow(); + DWORD pid; + GetWindowThreadProcessId(curr, &pid); + HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pid); + TerminateProcess(hProcess, 0); + CloseHandle(hProcess); +} + #ifdef VDA_FEATURES #include "VD/VD.c" #endif
diff --git a/actions.h b/actions.h @@ -5,6 +5,7 @@ static void quit(const Arg* arg); static void spawn(const Arg* arg); static void toggleexplorer(const Arg* arg); static void killForeground(const Arg* arg); +static void killMacForeground(const Arg* arg); #ifdef VDA_FEATURES #include "VD/VD.h"
diff --git a/config.h b/config.h @@ -12,6 +12,10 @@ static const char *adminCmd[] = {"runas", "wt.exe", NULL}; static const char *vscode[] = {NULL, "code", "D:/code"}; static const char *codeforces[] = {"open", "https://codeforces.com", NULL}; static const char *leetcode[] = {"open", "https://leetcode.com", NULL}; +static const char *explorer[] = {NULL, "explorer.exe", NULL}; +static const char *taskManager[] = {NULL, "Taskmgr.exe", NULL}; +static const char *adbConnect[] = {NULL, "D:/win32/ADB-Connect/adb-tcpip-connect.exe", NULL}; +static const char *scrcpy[] = {NULL, "D:/win32/ADB-Connect/launch-scrcpy.vbs", NULL}; #define NUMKEY(x) \ {MODKEY, x+'0', GoToDesktopNumberW, {.i= x ? x : 10}}, \ @@ -21,14 +25,19 @@ static Key keys[] = { /* modifier key function argument */ { MODKEY, 'B', test, {0} }, { MODKEY, 'O', spawn, {.v = vscode} }, - { MODKEY, VK_RETURN, spawn, {.v = termcmd } }, - { MODKEY | MOD_SHIFT, VK_RETURN, spawn, {.v = adminCmd } }, - { MODKEY, 'C', spawn, {.v = codeforces } }, - { MODKEY, 'L', spawn, {.v = leetcode } }, - { MODKEY, 'E', toggleexplorer, {0} }, - { MODKEY, 'Q', killForeground, {0} }, - { MODKEY | MOD_SHIFT, 'Q', quit, {0} }, - #ifdef VDA_FEATURES + { MODKEY, VK_RETURN, spawn, {.v = termcmd } }, + { MODKEY | MOD_SHIFT, VK_RETURN, spawn, {.v = adminCmd } }, + { MODKEY, 'C', spawn, {.v = codeforces } }, + { MODKEY, 'L', spawn, {.v = leetcode } }, + { MODKEY | MOD_SHIFT, 'E', toggleexplorer, {0} }, + { MODKEY, 'Q', killForeground, {0} }, + { MODKEY | MOD_SHIFT, 'Q', killMacForeground, {0} }, + { MODKEY, 'E', spawn, {.v = explorer}}, + { MODKEY | MOD_SHIFT, 'Q', quit, {0} }, + { MODKEY, 'T', spawn, {.v = taskManager } }, + { MODKEY, 'D', spawn, {.v = adbConnect } }, + { MODKEY, 'F', spawn, {.v = scrcpy } }, + #ifdef VDA_FEATURES NUMKEY(1), NUMKEY(2), NUMKEY(3),
: nply/dwhkd