: nply/dwhkd

commit 86bab7b6907b7029df81f1b88f4048fe39a88287
parent efc05a984f1fc42a97d650cfb345854a4f295c65
Author: theSoberSobber <akshatshrivastava0010@gmail.com>
Date: Mon, 4 Dec 2023 10:52:26 +0530

add killFg
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/VD-action.md b/VD-action.md
@@ -6,4 +6,4 @@
   - https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateinstance
 
 - [DLL Based](https://github.com/Ciantic/VirtualDesktopAccessor)
-  - Current Implementation-
\ No newline at end of file
+  - Current Implementationc+
\ No newline at end of file
diff --git a/actions.c b/actions.c
@@ -20,6 +20,12 @@ void toggleexplorer(const Arg *arg) {
 	hwnd = FindWindow("Shell_TrayWnd", NULL);
 	if (hwnd) setvisibility(hwnd, !IsWindowVisible(hwnd));
 }
+
+void killForeground(const Arg* arg){
+	HWND curr = GetForegroundWindow();
+	PostMessage(curr, WM_CLOSE, 0, 0);
+}
+
 #ifdef VDA_FEATURES
 #include "VD/VD.c"
 #endif
diff --git a/actions.h b/actions.h
@@ -4,6 +4,7 @@ static void test(const Arg* arg);
 static void quit(const Arg* arg);
 static void spawn(const Arg* arg);
 static void toggleexplorer(const Arg* arg);
+static void killForeground(const Arg* arg);
 
 #ifdef VDA_FEATURES
 #include "VD/VD.h"
diff --git a/config.h b/config.h
@@ -24,6 +24,7 @@ static Key keys[] = {
 	{ 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
 	NUMKEY(1),