1
0

rebranding because dmenu itself doesn't deserve this

This commit is contained in:
Deven Blake 2021-05-16 00:41:18 -04:00
parent dd9ec127dc
commit 87a70d203e
7 changed files with 56 additions and 260 deletions

View File

@ -3,10 +3,10 @@
include config.mk
SRC = drw.c dmenu.c stest.c util.c
SRC = drw.c dmenubar.c stest.c util.c
OBJ = $(SRC:.c=.o)
all: options dmenu stest
all: options dmenubar stest
options:
@echo dmenu build options:
@ -22,43 +22,39 @@ config.h:
$(OBJ): arg.h config.h config.mk drw.h
dmenu: dmenu.o drw.o util.o
$(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS)
dmenubar: dmenubar.o drw.o util.o
$(CC) -o $@ dmenubar.o drw.o util.o $(LDFLAGS)
stest: stest.o
$(CC) -o $@ stest.o $(LDFLAGS)
clean:
rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz
rm -f dmenubar stest $(OBJ) dmenubar-$(VERSION).tar.gz
dist: clean
mkdir -p dmenu-$(VERSION)
cp LICENSE Makefile README arg.h config.def.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
rm -rf dmenu-$(VERSION)
mkdir -p dmenubar-$(VERSION)
cp LICENSE Makefile README arg.h config.def.h config.mk dmenubar.1\
drw.h util.h stest.1 $(SRC)\
dmenubar-$(VERSION)
tar -cf dmenubar-$(VERSION).tar dmenubar-$(VERSION)
gzip dmenubar-$(VERSION).tar
rm -rf dmenubar-$(VERSION)
install: all
mkdir -p $(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
cp -f dmenubar stest $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenubar
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
sed "s/VERSION/$(VERSION)/g" < dmenubar.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenubar.1
sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenubar.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
rm -f $(DESTDIR)$(PREFIX)/bin/dmenubar\
$(DESTDIR)$(PREFIX)/bin/stest\
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
$(DESTDIR)$(MANPREFIX)/man1/dmenubar.1\
$(DESTDIR)$(MANPREFIX)/man1/stest.1
.PHONY: all options clean dist install uninstall

View File

@ -1,19 +1,22 @@
dmenubar - dumb menu bar
====================
dmenu is an efficient dynamic menu for X.
dmenubar is a hack of dmenu that displays a menu bar.
This is a work in progress. Doesn't suckless, suxmoar.
# dmenubar - dynamic menu bar
dmenu is an efficient dynamic menu for X.
dmenubar is a HACK of dmenu that displays a menu bar.
** There are no guarantees at any time that this project works or is stable. Please don't rely on it. **
Lemonbar is an excellent replacement.
## Requirements
Requirements
------------
In order to build dmenu you need the Xlib header files.
Installation
------------
## Installation
Edit config.mk to match your local setup (dmenu is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install dmenu
(if necessary as root):
make clean install
`make clean install`

View File

@ -1,21 +1,13 @@
/* See LICENSE file for copyright and license details. */
/* Default settings; can be overriden by command line. */
/* Default settings; some can be overriden by command line. */
static int topbar = 1; /* -b option; if 0, 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 */
static const char *fonts[] = {
"monospace:size=10"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const int text_s = 1024; /* chars to be allocated for the text displayed in the bar */
static const char *colors[SchemeLast][2] = {
/* fg bg */
[SchemeNorm] = { "#bbbbbb", "#222222" },
[SchemeSel] = { "#eeeeee", "#005577" },
[SchemeOut] = { "#000000", "#00ffff" },
/* fg, bg */
[Scheme] = { "#eeeeee", "#005577" },
};
/*
* Characters not considered part of a word while deleting words
* for example: " /?\"&[]"
*/
static const char worddelimiters[] = " ";

View File

@ -1,194 +0,0 @@
.TH DMENU 1 dmenu\-VERSION
.SH NAME
dmenu \- dynamic menu
.SH SYNOPSIS
.B dmenu
.RB [ \-bfiv ]
.RB [ \-l
.IR lines ]
.RB [ \-m
.IR monitor ]
.RB [ \-p
.IR prompt ]
.RB [ \-fn
.IR font ]
.RB [ \-nb
.IR color ]
.RB [ \-nf
.IR color ]
.RB [ \-sb
.IR color ]
.RB [ \-sf
.IR color ]
.RB [ \-w
.IR windowid ]
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
.B dmenu
is a dynamic menu for X, which reads a list of newline\-separated items from
stdin. When the user selects an item and presses Return, their choice is printed
to stdout and dmenu terminates. Entering text will narrow the items to those
matching the tokens in the input.
.P
.B dmenu_run
is a script used by
.IR dwm (1)
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.
.TP
.B \-f
dmenu grabs the keyboard before reading stdin if not reading from a tty. This
is faster, but will lock up X until stdin reaches end\-of\-file.
.TP
.B \-i
dmenu matches menu items case insensitively.
.TP
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.
.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
from 0.
.TP
.BI \-p " prompt"
defines the prompt to be displayed to the left of the input field.
.TP
.BI \-fn " font"
defines the font or font set used.
.TP
.BI \-nb " color"
defines the normal background color.
.IR #RGB ,
.IR #RRGGBB ,
and X color names are supported.
.TP
.BI \-nf " color"
defines the normal foreground color.
.TP
.BI \-sb " color"
defines the selected background color.
.TP
.BI \-sf " color"
defines the selected foreground color.
.TP
.B \-v
prints version information to stdout, then exits.
.TP
.BI \-w " windowid"
embed into windowid.
.SH USAGE
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.
.TP
.B Tab
Copy the selected item to the input field.
.TP
.B Return
Confirm selection. Prints the selected item to stdout and exits, returning
success.
.TP
.B Ctrl-Return
Confirm selection. Prints the selected item to stdout and continues.
.TP
.B Shift\-Return
Confirm input. Prints the input text to stdout and exits, returning success.
.TP
.B Escape
Exit without selecting an item, returning failure.
.TP
.B Ctrl-Left
Move cursor to the start of the current word
.TP
.B Ctrl-Right
Move cursor to the end of the current word
.TP
.B C\-a
Home
.TP
.B C\-b
Left
.TP
.B C\-c
Escape
.TP
.B C\-d
Delete
.TP
.B C\-e
End
.TP
.B C\-f
Right
.TP
.B C\-g
Escape
.TP
.B C\-h
Backspace
.TP
.B C\-i
Tab
.TP
.B C\-j
Return
.TP
.B C\-J
Shift-Return
.TP
.B C\-k
Delete line right
.TP
.B C\-m
Return
.TP
.B C\-M
Shift-Return
.TP
.B C\-n
Down
.TP
.B C\-p
Up
.TP
.B C\-u
Delete line left
.TP
.B C\-w
Delete word left
.TP
.B C\-y
Paste from primary X selection
.TP
.B C\-Y
Paste from X clipboard
.TP
.B M\-b
Move cursor to the start of the current word
.TP
.B M\-f
Move cursor to the end of the current word
.TP
.B M\-g
Home
.TP
.B M\-G
End
.TP
.B M\-h
Up
.TP
.B M\-j
Page down
.TP
.B M\-k
Page up
.TP
.B M\-l
Down
.SH SEE ALSO
.IR dwm (1),
.IR stest (1)

View File

@ -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

View File

@ -1,2 +0,0 @@
#!/bin/sh
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

View File

@ -1,4 +1,11 @@
/* See LICENSE file for copyright and license details. */
/* I'm not a very good C programmer and this isn't the best I can do.
* There are a lot of fragments here from Suckless' dmenu. I would
* recommend hacking on that instead. This is itself a total hack and
* not a pretty one, but it works and I'm at least proud of that.
* ~ trinity */
#include <ctype.h>
#include <locale.h>
#include <stdio.h>
@ -27,6 +34,11 @@
/* enums */
enum { Scheme, SchemeLast }; /* color schemes */
/* enumerated because Suckless has SchemeNorm, SchemeSel, etc.
* should be made into like one char *Scheme[2] */
/* BTW SchemeLast is the size of an array of the schemes and it's used
* in this program for iteration. Assumes enums will be assigned
* 0,1,2,3... */
static char *embed;
static int bh, mw, mh;
@ -75,11 +87,12 @@ drawmenu(char *text)
}
int
textw(char *text)
textw(char *text) /* figure out how to remove me */
{
return (text && *text) ? TEXTW(text) - lrpad / 4 : 0;
}
/* I don't know how anyting here works */
static void
setup(void)
{
@ -174,14 +187,13 @@ setup(void)
}
}
drw_resize(drw, mw, mh);
//drawmenu();
}
static void
usage(void)
{
fputs("usage: dmenu [-bfiv] [-fn font] [-m monitor]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
" [-bc color] [-fc color] [-w windowid]\n", stderr);
exit(1);
}
@ -208,9 +220,9 @@ main(int argc, char *argv[])
mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-fn")) /* font or font set */
fonts[0] = argv[++i];
else if (!strcmp(argv[i], "-b")) /* selected background color */
else if (!strcmp(argv[i], "-bc")) /* bg color */
colors[Scheme][ColBg] = argv[++i];
else if (!strcmp(argv[i], "-f")) /* selected foreground color */
else if (!strcmp(argv[i], "-fc")) /* fg color */
colors[Scheme][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
@ -233,12 +245,14 @@ main(int argc, char *argv[])
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
/* ??? */
#ifdef __OpenBSD__
if (pledge("stdio rpath", NULL) == -1)
die("pledge");
#endif
setup();
do{
/* fgets adds a newline which will be printable in some fonts */
if(strlen(text) > 0)
@ -246,5 +260,5 @@ main(int argc, char *argv[])
drawmenu(text);
}while(fgets(text, text_s, stdin) != NULL);
return 1; /* unreachable */
return 0;
}