git rm bins
This commit is contained in:
parent
7ce567eb32
commit
7cf4d505a1
|
@ -0,0 +1,8 @@
|
||||||
|
*.o
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
dmenu
|
||||||
|
config.h
|
||||||
|
dmenu_path
|
||||||
|
dmenu_run
|
||||||
|
stest
|
10
Makefile
10
Makefile
|
@ -6,7 +6,13 @@ include config.mk
|
||||||
SRC = drw.c dmenu.c stest.c util.c
|
SRC = drw.c dmenu.c stest.c util.c
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
all: dmenu stest
|
all: options dmenu stest
|
||||||
|
|
||||||
|
options:
|
||||||
|
@echo dmenu build options:
|
||||||
|
@echo "CFLAGS = $(CFLAGS)"
|
||||||
|
@echo "LDFLAGS = $(LDFLAGS)"
|
||||||
|
@echo "CC = $(CC)"
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
@ -55,4 +61,4 @@ uninstall:
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
.PHONY: all options clean dist install uninstall
|
||||||
|
|
|
@ -5,7 +5,7 @@ static int topbar = 1; /* -b option; if 0, dmenu appears a
|
||||||
static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */
|
static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */
|
||||||
/* -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[] = {
|
||||||
"Hack Nerd Font:size=14",
|
"monospace:size=14",
|
||||||
"NotoColorEmoji:pixelsize=48:antialias=true:autohint=true"
|
"NotoColorEmoji:pixelsize=48:antialias=true:autohint=true"
|
||||||
};
|
};
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
|
|
25
config.h
25
config.h
|
@ -1,25 +0,0 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
|
||||||
/* Default settings; can be overriden by command line. */
|
|
||||||
|
|
||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
|
||||||
static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */
|
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
|
||||||
static const char *fonts[] = {
|
|
||||||
"Hack Nerd Font:size=14",
|
|
||||||
"NotoColorEmoji:pixelsize=48:antialias=true:autohint=true"
|
|
||||||
};
|
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
|
||||||
static const char *colors[SchemeLast][2] = {
|
|
||||||
/* fg bg */
|
|
||||||
[SchemeNorm] = { "#ebdbb2", "#282828" },
|
|
||||||
[SchemeSel] = { "#ffffff", "#005577" },
|
|
||||||
[SchemeOut] = { "#000000", "#00ffff" },
|
|
||||||
};
|
|
||||||
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
|
||||||
static unsigned int lines = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Characters not considered part of a word while deleting words
|
|
||||||
* for example: " /?\"&[]"
|
|
||||||
*/
|
|
||||||
static const char worddelimiters[] = " ";
|
|
|
@ -1,5 +1,5 @@
|
||||||
# dmenu version
|
# dmenu version
|
||||||
VERSION = 5.3
|
VERSION = 5.2
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
5
dmenu.1
5
dmenu.1
|
@ -22,6 +22,8 @@ dmenu \- dynamic menu
|
||||||
.IR color ]
|
.IR color ]
|
||||||
.RB [ \-w
|
.RB [ \-w
|
||||||
.IR windowid ]
|
.IR windowid ]
|
||||||
|
.RB [ \-it
|
||||||
|
.IR text ]
|
||||||
.P
|
.P
|
||||||
.BR dmenu_run " ..."
|
.BR dmenu_run " ..."
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
@ -80,6 +82,9 @@ prints version information to stdout, then exits.
|
||||||
.TP
|
.TP
|
||||||
.BI \-w " windowid"
|
.BI \-w " windowid"
|
||||||
embed into windowid.
|
embed into windowid.
|
||||||
|
.TP
|
||||||
|
.BI \-it " text".
|
||||||
|
start with initial text input.
|
||||||
.SH USAGE
|
.SH USAGE
|
||||||
dmenu is completely controlled by the keyboard. Items are selected using the
|
dmenu is completely controlled by the keyboard. Items are selected using the
|
||||||
arrow keys, page up, page down, home, and end.
|
arrow keys, page up, page down, home, and end.
|
||||||
|
|
9
dmenu.c
9
dmenu.c
|
@ -23,6 +23,7 @@
|
||||||
/* macros */
|
/* macros */
|
||||||
#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
|
#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
|
||||||
* MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
|
* MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
|
||||||
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
|
@ -803,7 +804,8 @@ static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
||||||
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]");
|
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n"
|
||||||
|
" [-it text]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -847,7 +849,10 @@ main(int argc, char *argv[])
|
||||||
colors[SchemeSel][ColFg] = argv[++i];
|
colors[SchemeSel][ColFg] = argv[++i];
|
||||||
else if (!strcmp(argv[i], "-w")) /* embedding window id */
|
else if (!strcmp(argv[i], "-w")) /* embedding window id */
|
||||||
embed = argv[++i];
|
embed = argv[++i];
|
||||||
else
|
else if (!strcmp(argv[i], "-it")) { /* embedding window id */
|
||||||
|
const char * text = argv[++i];
|
||||||
|
insert(text, strlen(text));
|
||||||
|
} else
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
|
|
13
dmenu_path
13
dmenu_path
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}"
|
|
||||||
cache="$cachedir/dmenu_run"
|
|
||||||
|
|
||||||
[ ! -e "$cachedir" ] && mkdir -p "$cachedir"
|
|
||||||
|
|
||||||
IFS=:
|
|
||||||
if stest -dqr -n "$cache" $PATH; then
|
|
||||||
stest -flx $PATH | sort -u | tee "$cache"
|
|
||||||
else
|
|
||||||
cat "$cache"
|
|
||||||
fi
|
|
23
drw.c
23
drw.c
|
@ -238,8 +238,8 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
||||||
int
|
int
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||||
{
|
{
|
||||||
int ty, ellipsis_x = 0;
|
int i, ty, ellipsis_x = 0;
|
||||||
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len, hash, h0, h1;
|
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
|
||||||
XftDraw *d = NULL;
|
XftDraw *d = NULL;
|
||||||
Fnt *usedfont, *curfont, *nextfont;
|
Fnt *usedfont, *curfont, *nextfont;
|
||||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||||
|
@ -251,7 +251,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
XftResult result;
|
XftResult result;
|
||||||
int charexists = 0, overflow = 0;
|
int charexists = 0, overflow = 0;
|
||||||
/* keep track of a couple codepoints for which we have no match. */
|
/* keep track of a couple codepoints for which we have no match. */
|
||||||
static unsigned int nomatches[128], ellipsis_width;
|
enum { nomatches_len = 64 };
|
||||||
|
static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
|
||||||
|
static unsigned int ellipsis_width = 0;
|
||||||
|
|
||||||
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -336,14 +338,11 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
* character must be drawn. */
|
* character must be drawn. */
|
||||||
charexists = 1;
|
charexists = 1;
|
||||||
|
|
||||||
hash = (unsigned int)utf8codepoint;
|
for (i = 0; i < nomatches_len; ++i) {
|
||||||
hash = ((hash >> 16) ^ hash) * 0x21F0AAAD;
|
/* avoid calling XftFontMatch if we know we won't find a match */
|
||||||
hash = ((hash >> 15) ^ hash) * 0xD35A2D97;
|
if (utf8codepoint == nomatches.codepoint[i])
|
||||||
h0 = ((hash >> 15) ^ hash) % LENGTH(nomatches);
|
goto no_match;
|
||||||
h1 = (hash >> 17) % LENGTH(nomatches);
|
}
|
||||||
/* avoid expensive XftFontMatch call when we know we won't find a match */
|
|
||||||
if (nomatches[h0] == utf8codepoint || nomatches[h1] == utf8codepoint)
|
|
||||||
goto no_match;
|
|
||||||
|
|
||||||
fccharset = FcCharSetCreate();
|
fccharset = FcCharSetCreate();
|
||||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||||
|
@ -372,7 +371,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
curfont->next = usedfont;
|
curfont->next = usedfont;
|
||||||
} else {
|
} else {
|
||||||
xfont_free(usedfont);
|
xfont_free(usedfont);
|
||||||
nomatches[nomatches[h0] ? h1 : h0] = utf8codepoint;
|
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
|
||||||
no_match:
|
no_match:
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
diff --git a/dmenu.1 b/dmenu.1
|
||||||
|
index 9eab758..b4947f9 100644
|
||||||
|
--- a/dmenu.1
|
||||||
|
+++ b/dmenu.1
|
||||||
|
@@ -22,6 +22,8 @@ dmenu \- dynamic menu
|
||||||
|
.IR color ]
|
||||||
|
.RB [ \-w
|
||||||
|
.IR windowid ]
|
||||||
|
+.RB [ \-it
|
||||||
|
+.IR text ]
|
||||||
|
.P
|
||||||
|
.BR dmenu_run " ..."
|
||||||
|
.SH DESCRIPTION
|
||||||
|
@@ -80,6 +82,9 @@ prints version information to stdout, then exits.
|
||||||
|
.TP
|
||||||
|
.BI \-w " windowid"
|
||||||
|
embed into windowid.
|
||||||
|
+.TP
|
||||||
|
+.BI \-it " text".
|
||||||
|
+start with initial text input.
|
||||||
|
.SH USAGE
|
||||||
|
dmenu is completely controlled by the keyboard. Items are selected using the
|
||||||
|
arrow keys, page up, page down, home, and end.
|
||||||
|
diff --git a/dmenu.c b/dmenu.c
|
||||||
|
index d605ab4..0564dfe 100644
|
||||||
|
--- a/dmenu.c
|
||||||
|
+++ b/dmenu.c
|
||||||
|
@@ -637,7 +637,8 @@ static void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
||||||
|
- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
|
||||||
|
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n"
|
||||||
|
+ " [-it text]\n", stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -680,7 +681,10 @@ main(int argc, char *argv[])
|
||||||
|
colors[SchemeSel][ColFg] = argv[++i];
|
||||||
|
else if (!strcmp(argv[i], "-w")) /* embedding window id */
|
||||||
|
embed = argv[++i];
|
||||||
|
- else
|
||||||
|
+ else if (!strcmp(argv[i], "-it")) { /* embedding window id */
|
||||||
|
+ const char * text = argv[++i];
|
||||||
|
+ insert(text, strlen(text));
|
||||||
|
+ } else
|
||||||
|
usage();
|
||||||
|
|
||||||
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
1
util.h
1
util.h
|
@ -3,7 +3,6 @@
|
||||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||||
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
||||||
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
|
|
||||||
|
|
||||||
void die(const char *fmt, ...);
|
void die(const char *fmt, ...);
|
||||||
void *ecalloc(size_t nmemb, size_t size);
|
void *ecalloc(size_t nmemb, size_t size);
|
||||||
|
|
Loading…
Reference in New Issue