unboolify dmenu
This commit is contained in:
parent
c9e4e152e6
commit
cc596365ac
@ -1,7 +1,7 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
/* Default settings; can be overriden by command line. */
|
/* Default settings; can be overriden by command line. */
|
||||||
|
|
||||||
static bool topbar = true; /* -b option; if False, dmenu appears at bottom */
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
static const char *fonts[] = {
|
static const char *fonts[] = {
|
||||||
"monospace:size=10"
|
"monospace:size=10"
|
||||||
|
14
dmenu.c
14
dmenu.c
@ -1,7 +1,6 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -32,7 +31,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
|
|||||||
struct item {
|
struct item {
|
||||||
char *text;
|
char *text;
|
||||||
struct item *left, *right;
|
struct item *left, *right;
|
||||||
bool out;
|
int out;
|
||||||
};
|
};
|
||||||
|
|
||||||
static char text[BUFSIZ] = "";
|
static char text[BUFSIZ] = "";
|
||||||
@ -421,7 +420,7 @@ keypress(XKeyEvent *ev)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (sel)
|
if (sel)
|
||||||
sel->out = true;
|
sel->out = 1;
|
||||||
break;
|
break;
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
if (text[cursor] != '\0') {
|
if (text[cursor] != '\0') {
|
||||||
@ -480,7 +479,7 @@ readstdin(void)
|
|||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (!(items[i].text = strdup(buf)))
|
if (!(items[i].text = strdup(buf)))
|
||||||
die("cannot strdup %u bytes:", strlen(buf) + 1);
|
die("cannot strdup %u bytes:", strlen(buf) + 1);
|
||||||
items[i].out = false;
|
items[i].out = 0;
|
||||||
if (strlen(items[i].text) > max)
|
if (strlen(items[i].text) > max)
|
||||||
max = strlen(maxstr = items[i].text);
|
max = strlen(maxstr = items[i].text);
|
||||||
}
|
}
|
||||||
@ -617,8 +616,7 @@ usage(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool fast = false;
|
int i, fast = 0;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
/* these options take no arguments */
|
/* these options take no arguments */
|
||||||
@ -626,9 +624,9 @@ main(int argc, char *argv[])
|
|||||||
puts("dmenu-"VERSION);
|
puts("dmenu-"VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
|
} else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
|
||||||
topbar = false;
|
topbar = 0;
|
||||||
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
|
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
|
||||||
fast = true;
|
fast = 1;
|
||||||
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||||
fstrncmp = strncasecmp;
|
fstrncmp = strncasecmp;
|
||||||
fstrstr = cistrstr;
|
fstrstr = cistrstr;
|
||||||
|
Loading…
Reference in New Issue
Block a user