Re: [hackers] [dmenu][PATCH] turn -b into a toggle

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon, 16 Aug 2021 10:28:36 +0200

On Sun, Aug 15, 2021 at 11:44:58PM +0600, NRK wrote:
> currently config.h allows users to set the value of topbar to 0.
> however if one does that, there's no way for him to get a topbar again.
> it makes more sense to have -b as a toggle instead.
>
> - NRK

Hi,

Thanks for the patch. I'd rather not add another option for it.

I think if the default is not changed it still makes sense. Either way the
option works as documented.

> From 064479d53414620e003dd3d143b448b7b8d42311 Mon Sep 17 00:00:00 2001
> From: NRK <nrk_AT_disroot.org>
> Date: Sun, 15 Aug 2021 22:46:40 +0600
> Subject: [PATCH] turn -b into a toggle
>
> currently config.h allows users to set the value of topbar to 0.
> however if one does that, there's no way for him to get a topbar again.
> it makes more sense to have -b as a toggle instead.
> ---
> dmenu.1 | 2 +-
> dmenu.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/dmenu.1 b/dmenu.1
> index 323f93c..5c9c488 100644
> --- a/dmenu.1
> +++ b/dmenu.1
> _AT_@ -38,7 +38,7 @@ which lists programs in the user's $PATH and runs the result in their $SHELL.
> .SH OPTIONS
> .TP
> .B \-b
> -dmenu appears at the bottom of the screen.
> +toggle top/bottom position.
> .TP
> .B \-f
> dmenu grabs the keyboard before reading stdin if not reading from a tty. This
> diff --git a/dmenu.c b/dmenu.c
> index 98507d9..c76b2a0 100644
> --- a/dmenu.c
> +++ b/dmenu.c
> _AT_@ -716,8 +716,8 @@ main(int argc, char *argv[])
> if (!strcmp(argv[i], "-v")) { /* prints version information */
> puts("dmenu-"VERSION);
> exit(0);
> - } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
> - topbar = 0;
> + } else if (!strcmp(argv[i], "-b")) /* toggle top/bottom position */
> + topbar = !(topbar);
> else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
> fast = 1;
> else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
> --
> 2.32.0
>


-- 
Kind regards,
Hiltjo
Received on Mon Aug 16 2021 - 10:28:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 16 2021 - 10:36:36 CEST