sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit ecb575e12addf7f8f772ba9a30d44bd50f8e555a
parent c36407806f49de7cb01e1911a1e069eb2a75642a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu,  6 Jul 2023 09:43:14 +0200

Revert "[dmenu][patch][date] Add patch"

This reverts commit c36407806f49de7cb01e1911a1e069eb2a75642a.

Comments:
- Leaks memory for output variable.
- You can use strftime and time(NULL) to show the current date.

Diffstat:
Dtools.suckless.org/dmenu/patches/date/dmenu-date-5.2.diff | 62--------------------------------------------------------------
Dtools.suckless.org/dmenu/patches/date/dmenu-date.png | 0
Dtools.suckless.org/dmenu/patches/date/index.md | 16----------------
3 files changed, 0 insertions(+), 78 deletions(-)

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 @@ -1,62 +0,0 @@ -From a73aeae977ad0ccfc7656175ef8900de41f97bd8 Mon Sep 17 00:00:00 2001 -From: piotr-marendowski <piotr-marendowski@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 -@@ -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 */ -@@ -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] = '\0'; -+ -+ drw_setscheme(drw, scheme[SchemeSel]); -+ -+ int r = drw_text(drw, x, y, w, bh, lrpad / 2, output, 0); -+ return r; -+} -+ - static void - drawmenu(void) - { -@@ -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 Binary files differ. diff --git a/tools.suckless.org/dmenu/patches/date/index.md b/tools.suckless.org/dmenu/patches/date/index.md @@ -1,16 +0,0 @@ -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@tutanota.com>