upgraded to dmenu 5.0
This commit is contained in:
parent
c21df3f2de
commit
0f56f839b2
4
LICENSE
4
LICENSE
@ -8,8 +8,8 @@ MIT/X Consortium License
|
|||||||
© 2009 Markus Schnalke <meillo@marmaro.de>
|
© 2009 Markus Schnalke <meillo@marmaro.de>
|
||||||
© 2009 Evan Gates <evan.gates@gmail.com>
|
© 2009 Evan Gates <evan.gates@gmail.com>
|
||||||
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
||||||
© 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org>
|
© 2014-2020 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
© 2015-2018 Quentin Rameau <quinq@fifth.space>
|
© 2015-2019 Quentin Rameau <quinq@fifth.space>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
11
Makefile
11
Makefile
@ -17,9 +17,6 @@ options:
|
|||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
config.h:
|
|
||||||
cp config.def.h $@
|
|
||||||
|
|
||||||
$(OBJ): arg.h config.h config.mk drw.h
|
$(OBJ): arg.h config.h config.mk drw.h
|
||||||
|
|
||||||
dmenu: dmenu.o drw.o util.o
|
dmenu: dmenu.o drw.o util.o
|
||||||
@ -33,8 +30,8 @@ clean:
|
|||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dmenu-$(VERSION)
|
mkdir -p dmenu-$(VERSION)
|
||||||
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
|
cp LICENSE Makefile README arg.h config.h config.mk dmenu.1\
|
||||||
drw.h util.h dmenu_run stest.1 $(SRC)\
|
drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
|
||||||
dmenu-$(VERSION)
|
dmenu-$(VERSION)
|
||||||
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
|
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
|
||||||
gzip dmenu-$(VERSION).tar
|
gzip dmenu-$(VERSION).tar
|
||||||
@ -42,8 +39,9 @@ dist: clean
|
|||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f dmenu dmenu_run stest $(DESTDIR)$(PREFIX)/bin
|
cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
||||||
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
||||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
@ -54,6 +52,7 @@ install: all
|
|||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
|
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
|
||||||
|
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
|
||||||
$(DESTDIR)$(PREFIX)/bin/stest\
|
$(DESTDIR)$(PREFIX)/bin/stest\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
||||||
|
26
config.h
26
config.h
@ -1,6 +1,17 @@
|
|||||||
/* 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 int instant = 0;
|
||||||
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
|
static const char *fonts[] = {
|
||||||
|
"monospace:size=13",
|
||||||
|
"IPAGothic:size=13",
|
||||||
|
"symbola:size=13"};
|
||||||
|
|
||||||
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
|
|
||||||
|
// NORD COLORS:
|
||||||
#define bblack "#000000"
|
#define bblack "#000000"
|
||||||
#define nord0 "#2E3440"
|
#define nord0 "#2E3440"
|
||||||
#define nord1 "#3B4252"
|
#define nord1 "#3B4252"
|
||||||
@ -18,27 +29,14 @@
|
|||||||
#define nord13 "#EBCB8B"
|
#define nord13 "#EBCB8B"
|
||||||
#define nord14 "#A3BE8C"
|
#define nord14 "#A3BE8C"
|
||||||
#define nord15 "#B48EAD"
|
#define nord15 "#B48EAD"
|
||||||
|
|
||||||
|
|
||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
|
||||||
static const char *fonts[] = {
|
|
||||||
"monospace:size=13",
|
|
||||||
"IPAGothic:size=13",
|
|
||||||
"symbola:size=13"};
|
|
||||||
|
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
|
||||||
|
|
||||||
static const char *colors[SchemeLast][2] = {
|
static const char *colors[SchemeLast][2] = {
|
||||||
/* fg bg */
|
/* fg bg */
|
||||||
[SchemeNorm] = { nord4 , nord0 },
|
[SchemeNorm] = { nord4 , nord0 },
|
||||||
[SchemeSel] = { nord6, nord10 },
|
[SchemeSel] = { nord6, nord10 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
||||||
static unsigned int lines = 0;
|
static unsigned int lines = 0;
|
||||||
|
|
||||||
static int instant = 0;
|
|
||||||
static int sidepad = 20;
|
static int sidepad = 20;
|
||||||
static int vertpad = 10;
|
static int vertpad = 10;
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dmenu version
|
# dmenu version
|
||||||
VERSION = 4.9
|
VERSION = 5.0
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
2
dmenu.1
2
dmenu.1
@ -48,7 +48,7 @@ is faster, but will lock up X until stdin reaches end\-of\-file.
|
|||||||
dmenu matches menu items case insensitively.
|
dmenu matches menu items case insensitively.
|
||||||
.TP
|
.TP
|
||||||
.B \-n
|
.B \-n
|
||||||
dmenu instantly selects if only one match
|
dmenu instantly selects if only one match.
|
||||||
.TP
|
.TP
|
||||||
.BI \-l " lines"
|
.BI \-l " lines"
|
||||||
dmenu lists items vertically, with the given number of lines.
|
dmenu lists items vertically, with the given number of lines.
|
||||||
|
24
dmenu.c
24
dmenu.c
@ -19,10 +19,6 @@
|
|||||||
#include "drw.h"
|
#include "drw.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
//static const int vertpad = 10;
|
|
||||||
//static const int sidepad = 20;
|
|
||||||
|
|
||||||
|
|
||||||
/* 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)))
|
||||||
@ -272,7 +268,6 @@ match(void)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
calcoffsets();
|
calcoffsets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,9 +560,14 @@ run(void)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
while (!XNextEvent(dpy, &ev)) {
|
while (!XNextEvent(dpy, &ev)) {
|
||||||
if (XFilterEvent(&ev, None))
|
if (XFilterEvent(&ev, win))
|
||||||
continue;
|
continue;
|
||||||
switch(ev.type) {
|
switch(ev.type) {
|
||||||
|
case DestroyNotify:
|
||||||
|
if (ev.xdestroywindow.window != win)
|
||||||
|
break;
|
||||||
|
cleanup();
|
||||||
|
exit(1);
|
||||||
case Expose:
|
case Expose:
|
||||||
if (ev.xexpose.count == 0)
|
if (ev.xexpose.count == 0)
|
||||||
drw_map(drw, win, 0, 0, mw, mh);
|
drw_map(drw, win, 0, 0, mw, mh);
|
||||||
@ -671,15 +671,17 @@ setup(void)
|
|||||||
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
||||||
XSetClassHint(dpy, win, &ch);
|
XSetClassHint(dpy, win, &ch);
|
||||||
|
|
||||||
/* open input methods */
|
|
||||||
xim = XOpenIM(dpy, NULL, NULL, NULL);
|
/* input methods */
|
||||||
|
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
|
||||||
|
die("XOpenIM failed: could not open input device");
|
||||||
|
|
||||||
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||||
XNClientWindow, win, XNFocusWindow, win, NULL);
|
XNClientWindow, win, XNFocusWindow, win, NULL);
|
||||||
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
|
|
||||||
if (embed) {
|
if (embed) {
|
||||||
XSelectInput(dpy, parentwin, FocusChangeMask);
|
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
|
||||||
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
|
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
|
||||||
for (i = 0; i < du && dws[i] != win; ++i)
|
for (i = 0; i < du && dws[i] != win; ++i)
|
||||||
XSelectInput(dpy, dws[i], FocusChangeMask);
|
XSelectInput(dpy, dws[i], FocusChangeMask);
|
||||||
@ -745,8 +747,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
fputs("warning: no locale support\n", stderr);
|
fputs("warning: no locale support\n", stderr);
|
||||||
if (!XSetLocaleModifiers(""))
|
|
||||||
fputs("warning: no locale modifiers support\n", stderr);
|
|
||||||
if (!(dpy = XOpenDisplay(NULL)))
|
if (!(dpy = XOpenDisplay(NULL)))
|
||||||
die("cannot open display");
|
die("cannot open display");
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
|
13
dmenu_path
Executable file
13
dmenu_path
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
aliases=$HOME/.config/aliasrc
|
aliases=$HOME/.config/aliasrc
|
||||||
|
|
||||||
source $aliases
|
#. $HOME/.config/aliasrc
|
||||||
termcmd="st -e"
|
termcmd="st -e"
|
||||||
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
|
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
|
||||||
if [ -d "$cachedir" ]; then
|
if [ -d "$cachedir" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user