----
- dwm-msg.c | 120 ++++++++++++++++++++++++++++++++----------------------
- 1 file changed, 72 insertions(+), 48 deletions(-)
-
-diff --git a/dwm-msg.c b/dwm-msg.c
-index c957adf..606f6ce 100644
---- a/dwm-msg.c
-+++ b/dwm-msg.c
-_AT_@ -46,6 +46,7 @@ typedef unsigned long Window;
-
- const char *DEFAULT_SOCKET_PATH = "/tmp/dwm.sock";
- static int sock_fd = -1;
-+static unsigned int ignore_reply = 0;
-
- typedef enum IPCMessageType {
- IPC_TYPE_RUN_COMMAND = 0,
-_AT_@ -273,6 +274,18 @@ is_signed_int(const char *s)
- return 1;
- }
-
-+static void
-+flush_socket_reply()
-+{
-+ IPCMessageType reply_type;
-+ uint32_t reply_size;
-+ char *reply;
-+
-+ read_socket(&reply_type, &reply_size, &reply);
-+
-+ free(reply);
-+}
-+
- static void
- print_socket_reply()
- {
-_AT_@ -283,6 +296,7 @@ print_socket_reply()
- read_socket(&reply_type, &reply_size, &reply);
-
- printf("%.*s
", reply_size, reply);
-+ fflush(stdout);
- free(reply);
- }
-
-_AT_@ -322,7 +336,10 @@ run_command(const char *name, char *args[], int argc)
-
- send_message(IPC_TYPE_RUN_COMMAND, msg_size, (uint8_t *)msg);
-
-- print_socket_reply();
-+ if (!ignore_reply)
-+ print_socket_reply();
-+ else
-+ flush_socket_reply();
-
- yajl_gen_free(gen);
-
-_AT_@ -408,7 +425,10 @@ subscribe(const char *event)
-
- send_message(IPC_TYPE_SUBSCRIBE, msg_size, (uint8_t *)msg);
-
-- print_socket_reply();
-+ if (!ignore_reply)
-+ print_socket_reply();
-+ else
-+ flush_socket_reply();
-
- yajl_gen_free(gen);
-
-_AT_@ -433,7 +453,7 @@ usage_error(const char *prog_name, const char *format, ...)
- static void
- print_usage(const char *name)
- {
-- printf("usage: %s <command> [...]
", name);
-+ printf("usage: %s [options] <command> [...]
", name);
- puts("");
- puts("Commands:");
- puts(" run_command <name> [args...] Run an IPC command");
-_AT_@ -456,14 +476,16 @@ print_usage(const char *name)
- puts("");
- puts(" help Display this message");
- puts("");
-+ puts("Options:");
-+ puts(" --ignore-reply Don't print reply messages from");
-+ puts(" run_command and subscribe.");
-+ puts("");
- }
-
- int
- main(int argc, char *argv[])
- {
- const char *prog_name = argv[0];
-- // Need at least command argument
-- if (argc < 2) usage_error(prog_name, "Expected an argument, got none");
-
- connect_to_socket();
- if (sock_fd == -1) {
-_AT_@ -471,49 +493,51 @@ main(int argc, char *argv[])
- return 1;
- }
-
-- for (int i = 1; i < argc; i++) {
-- if (strcmp(argv[i], "help") == 0) {
-- print_usage(prog_name);
-- return 0;
-- } else if (strcmp(argv[i], "run_command") == 0) {
-- if (++i >= argc) usage_error(prog_name, "No command specified");
-- // Command name
-- char *command = argv[i];
-- // Command arguments are everything after command name
-- char **command_args = argv + ++i;
-- // Number of command arguments
-- int command_argc = argc - i;
-- run_command(command, command_args, command_argc);
-- return 0;
-- } else if (strcmp(argv[i], "get_monitors") == 0) {
-- get_monitors();
-- return 0;
-- } else if (strcmp(argv[i], "get_tags") == 0) {
-- get_tags();
-- return 0;
-- } else if (strcmp(argv[i], "get_layouts") == 0) {
-- get_layouts();
-- return 0;
-- } else if (strcmp(argv[i], "get_dwm_client") == 0) {
-- if (++i < argc) {
-- if (is_unsigned_int(argv[i])) {
-- Window win = atol(argv[i]);
-- get_dwm_client(win);
-- } else
-- usage_error(prog_name, "Expected unsigned integer argument");
-- } else
-- usage_error(prog_name, "Expected the window id");
-- return 0;
-- } else if (strcmp(argv[i], "subscribe") == 0) {
-- if (++i < argc) {
-- for (int j = i; j < argc; j++) subscribe(argv[j]);
-+ int i = 1;
-+ if (strcmp(argv[i], "--ignore-reply") == 0) {
-+ ignore_reply = 1;
-+ i++;
-+ }
-+
-+ if (i >= argc) usage_error(prog_name, "Expected an argument, got none");
-+
-+ if (strcmp(argv[i], "help") == 0)
-+ print_usage(prog_name);
-+ else if (strcmp(argv[i], "run_command") == 0) {
-+ if (++i >= argc) usage_error(prog_name, "No command specified");
-+ // Command name
-+ char *command = argv[i];
-+ // Command arguments are everything after command name
-+ char **command_args = argv + ++i;
-+ // Number of command arguments
-+ int command_argc = argc - i;
-+ run_command(command, command_args, command_argc);
-+ } else if (strcmp(argv[i], "get_monitors") == 0) {
-+ get_monitors();
-+ } else if (strcmp(argv[i], "get_tags") == 0) {
-+ get_tags();
-+ } else if (strcmp(argv[i], "get_layouts") == 0) {
-+ get_layouts();
-+ } else if (strcmp(argv[i], "get_dwm_client") == 0) {
-+ if (++i < argc) {
-+ if (is_unsigned_int(argv[i])) {
-+ Window win = atol(argv[i]);
-+ get_dwm_client(win);
- } else
-- usage_error(prog_name, "Expected event name");
-- // Keep listening for events forever
-- while (1) {
-- print_socket_reply();
-- }
-+ usage_error(prog_name, "Expected unsigned integer argument");
- } else
-- usage_error(prog_name, "Invalid argument '%s'", argv[i]);
-- }
-+ usage_error(prog_name, "Expected the window id");
-+ } else if (strcmp(argv[i], "subscribe") == 0) {
-+ if (++i < argc) {
-+ for (int j = i; j < argc; j++) subscribe(argv[j]);
-+ } else
-+ usage_error(prog_name, "Expected event name");
-+ // Keep listening for events forever
-+ while (1) {
-+ print_socket_reply();
-+ }
-+ } else
-+ usage_error(prog_name, "Invalid argument '%s'", argv[i]);
-+
-+ return 0;
- }
---
-2.27.0
-
diff --git a/dwm.suckless.org/patches/ipc/dwm-ipc-v1.5.4-to-v1.5.5.diff b/dwm.suckless.org/patches/ipc/dwm-ipc-v1.5.4-to-v1.5.5.diff
new file mode 100644
index 00000000..0c628b3e
--- /dev/null
+++ b/dwm.suckless.org/patches/ipc/dwm-ipc-v1.5.4-to-v1.5.5.diff
_AT_@ -0,0 +1,52 @@
+From dddee33beee02e4b71aa1a3e6c7df43c7f6376a8 Mon Sep 17 00:00:00 2001
+From: mihirlad55 <mihirlad55_AT_gmail.com>
+Date: Mon, 24 Aug 2020 02:37:40 +0000
+Subject: [PATCH] Update from v1.5.4 to v1.5.5
+
+- Fixed dwm-msg not accepting negative float values
+- Removed spawn command from config.def.h since it is currently unusuable and
+ does not provide any useful functionality
+---
+ config.def.h | 1 -
+ dwm-msg.c | 5 +++++
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 3ad9785..059a831 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -123,7 +123,6 @@ static IPCCommand ipccommands[] = {
+ IPCCOMMAND( focusmon, 1, {ARG_TYPE_SINT} ),
+ IPCCOMMAND( focusstack, 1, {ARG_TYPE_SINT} ),
+ IPCCOMMAND( zoom, 1, {ARG_TYPE_NONE} ),
+- IPCCOMMAND( spawn, 1, {ARG_TYPE_PTR} ),
+ IPCCOMMAND( incnmaster, 1, {ARG_TYPE_SINT} ),
+ IPCCOMMAND( killclient, 1, {ARG_TYPE_SINT} ),
+ IPCCOMMAND( togglefloating, 1, {ARG_TYPE_NONE} ),
+diff --git a/dwm-msg.c b/dwm-msg.c
+index 606f6ce..0071781 100644
+--- a/dwm-msg.c
++++ b/dwm-msg.c
+_AT_@ -225,14 +225,19 @@ is_float(const char *s)
+ {
+ size_t len = strlen(s);
+ int is_dot_used = 0;
++ int is_minus_used = 0;
+
+ // Floats can only have one decimal point in between or digits
++ // Optionally, floats can also be below zero (negative)
+ for (int i = 0; i < len; i++) {
+ if (isdigit(s[i]))
+ continue;
+ else if (!is_dot_used && s[i] == '.' && i != 0 && i != len - 1) {
+ is_dot_used = 1;
+ continue;
++ } else if (!is_minus_used && s[i] == '-' && i == 0) {
++ is_minus_used = 1;
++ continue;
+ } else
+ return 0;
+ }
+--
+2.28.0
+
diff --git a/dwm.suckless.org/patches/ipc/index.md b/dwm.suckless.org/patches/ipc/index.md
index 7275ab77..27bde44b 100644
--- a/dwm.suckless.org/patches/ipc/index.md
+++ b/dwm.suckless.org/patches/ipc/index.md
_AT_@ -64,10 +64,10 @@ creating custom shell scripts to control dwm.
Download
--------
-* IPC Patch v1.5.4:
- [dwm-ipc-20200729-f04cac6.diff](dwm-ipc-20200729-f04cac6.diff)
-* IPC Patch v1.5.3 to v1.5.4 Update:
- [dwm-ipc-v1.5.3-to-v1.5.4.diff](dwm-ipc-v1.5.3-to-v1.5.4.diff)
+* IPC Patch v1.5.5:
+ [dwm-ipc-20200824-f04cac6.diff](dwm-ipc-20200824-f04cac6.diff)
+* IPC Patch v1.5.4 to v1.5.5 Update:
+ [dwm-ipc-v1.5.4-to-v1.5.5.diff](dwm-ipc-v1.5.4-to-v1.5.5.diff)
The latest releases of the patch will always be available first on the project
[Releases](https://github.com/mihirlad55/dwm-ipc/releases) page. There are also
Received on Mon Aug 24 2020 - 05:12:39 CEST
This archive was generated by hypermail 2.3.0 : Mon Aug 24 2020 - 05:12:48 CEST