dmenu-toggle-position-20210904-d78ff08.patch (1452B)
1 From 0bd1e230fbae8b2f18bb88fc4f7056645baa9d23 Mon Sep 17 00:00:00 2001 2 From: NRK <nrk@disroot.org> 3 Date: Sun, 15 Aug 2021 22:46:40 +0600 4 Subject: [PATCH] turn -b into a toggle 5 6 currently config.h allows users to set the value of topbar to 0. 7 however if one does that, there's no way for him to get a topbar again. 8 it makes more sense to have -b as a toggle instead. 9 --- 10 dmenu.1 | 2 +- 11 dmenu.c | 4 ++-- 12 2 files changed, 3 insertions(+), 3 deletions(-) 13 14 diff --git a/dmenu.1 b/dmenu.1 15 index 323f93c..5c9c488 100644 16 --- a/dmenu.1 17 +++ b/dmenu.1 18 @@ -38,7 +38,7 @@ which lists programs in the user's $PATH and runs the result in their $SHELL. 19 .SH OPTIONS 20 .TP 21 .B \-b 22 -dmenu appears at the bottom of the screen. 23 +toggle top/bottom position. 24 .TP 25 .B \-f 26 dmenu grabs the keyboard before reading stdin if not reading from a tty. This 27 diff --git a/dmenu.c b/dmenu.c 28 index 98507d9..c76b2a0 100644 29 --- a/dmenu.c 30 +++ b/dmenu.c 31 @@ -716,8 +716,8 @@ main(int argc, char *argv[]) 32 if (!strcmp(argv[i], "-v")) { /* prints version information */ 33 puts("dmenu-"VERSION); 34 exit(0); 35 - } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ 36 - topbar = 0; 37 + } else if (!strcmp(argv[i], "-b")) /* toggle top/bottom position */ 38 + topbar = !(topbar); 39 else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ 40 fast = 1; 41 else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 42 -- 43 2.33.0 44