sites

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

commit c36407806f49de7cb01e1911a1e069eb2a75642a
parent 88e0fbb9ecd8713446f46b61462f3f4765efab64
Author: piotr-marendowski <piotr-marendowski@tutanota.com>
Date:   Wed,  5 Jul 2023 13:30:03 +0000

[dmenu][patch][date] Add patch

Diffstat:
Atools.suckless.org/dmenu/patches/date/dmenu-date-5.2.diff | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/dmenu/patches/date/dmenu-date.png | 0
Atools.suckless.org/dmenu/patches/date/index.md | 16++++++++++++++++
3 files changed, 78 insertions(+), 0 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 @@ -0,0 +1,62 @@ +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 @@ -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@tutanota.com>