[wiki] [sites] [dmenu][patch][date] Add patch || piotr-marendowski

From: <git_AT_suckless.org>
Date: Wed, 05 Jul 2023 15:30:19 +0200

commit c36407806f49de7cb01e1911a1e069eb2a75642a
Author: piotr-marendowski <piotr-marendowski_AT_tutanota.com>
Date: Wed Jul 5 13:30:03 2023 +0000

    [dmenu][patch][date] Add patch

diff --git a/tools.suckless.org/dmenu/patches/date/dmenu-date-5.2.diff b/tools.suckless.org/dmenu/patches/date/dmenu-date-5.2.diff
new file mode 100644
index 00000000..d865025d
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/date/dmenu-date-5.2.diff
_AT_@ -0,0 +1,62 @@
+From a73aeae977ad0ccfc7656175ef8900de41f97bd8 Mon Sep 17 00:00:00 2001
+From: piotr-marendowski <piotr-marendowski_AT_tutanota.com>
+Date: Wed, 5 Jul 2023 13:05:37 +0000
+Subject: [PATCH] Displays date and time at the bottom of the vertical dmenu
+ layout.
+
+---
+ dmenu.c | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/dmenu.c b/dmenu.c
+index 7cf253b..b7c35ce 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -84,7 +84,7 @@ calcoffsets(void)
+ int i, n;
+
+ if (lines > 0)
+- n = lines * bh;
++ n = (lines * bh) - 1;
+ else
+ n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
+ /* calculate which items will begin the next page and previous page */
+_AT_@ -143,6 +143,26 @@ drawitem(struct item *item, int x, int y, int w)
+ return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
+ }
+
++static int
++drawdate(int x, int y, int w)
++{
++ FILE *fp;
++ char buffer[128], *output;
++
++ /* use date command +arugments (without space!)*/
++ fp = popen("date +'%H:%M %A %d %B %Y'", "r");
++ fgets(buffer, sizeof(buffer), fp);
++ pclose(fp);
++
++ output = strdup(buffer);
++ output[strlen(output) - 1] = '++
++ drw_setscheme(drw, scheme[SchemeSel]);
++
++ int r = drw_text(drw, x, y, w, bh, lrpad / 2, output, 0);
++ return r;
++}
++
+ static void
+ drawmenu(void)
+ {
+_AT_@ -172,6 +192,8 @@ drawmenu(void)
+ /* draw vertical list */
+ for (item = curr; item != next; item = item->right)
+ drawitem(item, x, y += bh, mw - x);
++
++ drawdate(x, lines * bh, w);
+ } else if (matches) {
+ /* draw horizontal list */
+ x += inputw;
+--
+2.41.0
+
diff --git a/tools.suckless.org/dmenu/patches/date/dmenu-date.png b/tools.suckless.org/dmenu/patches/date/dmenu-date.png
new file mode 100644
index 00000000..28e75031
Binary files /dev/null and b/tools.suckless.org/dmenu/patches/date/dmenu-date.png differ
diff --git a/tools.suckless.org/dmenu/patches/date/index.md b/tools.suckless.org/dmenu/patches/date/index.md
new file mode 100644
index 00000000..58e09ddb
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/date/index.md
_AT_@ -0,0 +1,16 @@
+date
+=============
+
+Description
+-----------
+This patch adds date and time at the bottom of the vertical dmenu layout, using the `date` command with arguments.
+
+![dmenu date screenshot](dmenu-date.png)
+
+Download
+--------
+[dmenu-date-5.2.diff](dmenu-date-5.2.diff) (2023-07-05)
+
+Authors
+-------
+* Piotr Marendowski <piotr-marendowski_AT_tutanota.com>
Received on Wed Jul 05 2023 - 15:30:19 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 05 2023 - 15:36:57 CEST