upgraded to dmenu 5.0

This commit is contained in:
Alexander Bocken 2020-11-28 13:36:19 +01:00
parent c21df3f2de
commit 0f56f839b2
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
9 changed files with 48 additions and 37 deletions

View File

@ -8,8 +8,8 @@ MIT/X Consortium License
© 2009 Markus Schnalke <meillo@marmaro.de>
© 2009 Evan Gates <evan.gates@gmail.com>
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
© 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org>
© 2015-2018 Quentin Rameau <quinq@fifth.space>
© 2014-2020 Hiltjo Posthuma <hiltjo@codemadness.org>
© 2015-2019 Quentin Rameau <quinq@fifth.space>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@ -17,9 +17,6 @@ options:
.c.o:
$(CC) -c $(CFLAGS) $<
config.h:
cp config.def.h $@
$(OBJ): arg.h config.h config.mk drw.h
dmenu: dmenu.o drw.o util.o
@ -33,8 +30,8 @@ clean:
dist: clean
mkdir -p dmenu-$(VERSION)
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
drw.h util.h dmenu_run stest.1 $(SRC)\
cp LICENSE Makefile README arg.h config.h config.mk dmenu.1\
drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
dmenu-$(VERSION)
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
gzip dmenu-$(VERSION).tar
@ -42,8 +39,9 @@ dist: clean
install: all
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_path
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
@ -54,6 +52,7 @@ install: all
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
$(DESTDIR)$(PREFIX)/bin/stest\
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\

View File

@ -1,6 +1,17 @@
/* See LICENSE file for copyright and license details. */
/* 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 nord0 "#2E3440"
#define nord1 "#3B4252"
@ -18,27 +29,14 @@
#define nord13 "#EBCB8B"
#define nord14 "#A3BE8C"
#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] = {
/* fg bg */
[SchemeNorm] = { nord4 , nord0 },
[SchemeSel] = { nord6, nord10 },
[SchemeSel] = { nord6, nord10 },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
static int instant = 0;
static int sidepad = 20;
static int vertpad = 10;
/*

View File

@ -1,5 +1,5 @@
# dmenu version
VERSION = 4.9
VERSION = 5.0
# paths
PREFIX = /usr/local

View File

@ -48,7 +48,7 @@ is faster, but will lock up X until stdin reaches end\-of\-file.
dmenu matches menu items case insensitively.
.TP
.B \-n
dmenu instantly selects if only one match
dmenu instantly selects if only one match.
.TP
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.

24
dmenu.c
View File

@ -19,10 +19,6 @@
#include "drw.h"
#include "util.h"
//static const int vertpad = 10;
//static const int sidepad = 20;
/* macros */
#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)))
@ -272,7 +268,6 @@ match(void)
exit(0);
}
calcoffsets();
}
@ -565,9 +560,14 @@ run(void)
XEvent ev;
while (!XNextEvent(dpy, &ev)) {
if (XFilterEvent(&ev, None))
if (XFilterEvent(&ev, win))
continue;
switch(ev.type) {
case DestroyNotify:
if (ev.xdestroywindow.window != win)
break;
cleanup();
exit(1);
case Expose:
if (ev.xexpose.count == 0)
drw_map(drw, win, 0, 0, mw, mh);
@ -671,15 +671,17 @@ setup(void)
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
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,
XNClientWindow, win, XNFocusWindow, win, NULL);
XMapRaised(dpy, win);
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
if (embed) {
XSelectInput(dpy, parentwin, FocusChangeMask);
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
for (i = 0; i < du && dws[i] != win; ++i)
XSelectInput(dpy, dws[i], FocusChangeMask);
@ -745,8 +747,6 @@ main(int argc, char *argv[])
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!XSetLocaleModifiers(""))
fputs("warning: no locale modifiers support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("cannot open display");
screen = DefaultScreen(dpy);

13
dmenu_path Executable file
View 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

View File

@ -1,7 +1,7 @@
#!/bin/sh
aliases=$HOME/.config/aliasrc
source $aliases
#. $HOME/.config/aliasrc
termcmd="st -e"
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then

1
drw.c
View File

@ -95,6 +95,7 @@ drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
drw_fontset_free(drw->fonts);
free(drw);
}