rebranding because dmenu itself doesn't deserve this
This commit is contained in:
parent
dd9ec127dc
commit
87a70d203e
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
include config.mk
|
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)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
all: options dmenu stest
|
all: options dmenubar stest
|
||||||
|
|
||||||
options:
|
options:
|
||||||
@echo dmenu build options:
|
@echo dmenu build options:
|
||||||
@ -22,43 +22,39 @@ config.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
|
dmenubar: dmenubar.o drw.o util.o
|
||||||
$(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS)
|
$(CC) -o $@ dmenubar.o drw.o util.o $(LDFLAGS)
|
||||||
|
|
||||||
stest: stest.o
|
stest: stest.o
|
||||||
$(CC) -o $@ stest.o $(LDFLAGS)
|
$(CC) -o $@ stest.o $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz
|
rm -f dmenubar stest $(OBJ) dmenubar-$(VERSION).tar.gz
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dmenu-$(VERSION)
|
mkdir -p dmenubar-$(VERSION)
|
||||||
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
|
cp LICENSE Makefile README arg.h config.def.h config.mk dmenubar.1\
|
||||||
drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
|
drw.h util.h stest.1 $(SRC)\
|
||||||
dmenu-$(VERSION)
|
dmenubar-$(VERSION)
|
||||||
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
|
tar -cf dmenubar-$(VERSION).tar dmenubar-$(VERSION)
|
||||||
gzip dmenu-$(VERSION).tar
|
gzip dmenubar-$(VERSION).tar
|
||||||
rm -rf dmenu-$(VERSION)
|
rm -rf dmenubar-$(VERSION)
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin
|
cp -f dmenubar stest $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenubar
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
|
|
||||||
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
|
||||||
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
|
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
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
|
rm -f $(DESTDIR)$(PREFIX)/bin/dmenubar\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
|
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
|
|
||||||
$(DESTDIR)$(PREFIX)/bin/stest\
|
$(DESTDIR)$(PREFIX)/bin/stest\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
$(DESTDIR)$(MANPREFIX)/man1/dmenubar.1\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
.PHONY: all options clean dist install uninstall
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
dmenubar - dumb menu bar
|
# dmenubar - dynamic menu bar
|
||||||
====================
|
|
||||||
dmenu is an efficient dynamic menu for X.
|
dmenu is an efficient dynamic menu for X.
|
||||||
dmenubar is a hack of dmenu that displays a menu bar.
|
dmenubar is a HACK of dmenu that displays a menu bar.
|
||||||
This is a work in progress. Doesn't suckless, suxmoar.
|
|
||||||
|
** 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.
|
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
|
Edit config.mk to match your local setup (dmenu is installed into
|
||||||
the /usr/local namespace by default).
|
the /usr/local namespace by default).
|
||||||
|
|
||||||
Afterwards enter the following command to build and install dmenu
|
Afterwards enter the following command to build and install dmenu
|
||||||
(if necessary as root):
|
(if necessary as root):
|
||||||
|
|
||||||
make clean install
|
`make clean install`
|
@ -1,21 +1,13 @@
|
|||||||
/* 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; 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 */
|
/* -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"
|
||||||
};
|
};
|
||||||
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] = {
|
static const char *colors[SchemeLast][2] = {
|
||||||
/* fg bg */
|
/* fg, bg */
|
||||||
[SchemeNorm] = { "#bbbbbb", "#222222" },
|
[Scheme] = { "#eeeeee", "#005577" },
|
||||||
[SchemeSel] = { "#eeeeee", "#005577" },
|
|
||||||
[SchemeOut] = { "#000000", "#00ffff" },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Characters not considered part of a word while deleting words
|
|
||||||
* for example: " /?\"&[]"
|
|
||||||
*/
|
|
||||||
static const char worddelimiters[] = " ";
|
|
||||||
|
194
dmenubar/dmenu.1
194
dmenubar/dmenu.1
@ -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)
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &
|
|
@ -1,4 +1,11 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* 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 <ctype.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -27,6 +34,11 @@
|
|||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
enum { Scheme, SchemeLast }; /* color schemes */
|
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 char *embed;
|
||||||
static int bh, mw, mh;
|
static int bh, mw, mh;
|
||||||
@ -75,11 +87,12 @@ drawmenu(char *text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
textw(char *text)
|
textw(char *text) /* figure out how to remove me */
|
||||||
{
|
{
|
||||||
return (text && *text) ? TEXTW(text) - lrpad / 4 : 0;
|
return (text && *text) ? TEXTW(text) - lrpad / 4 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* I don't know how anyting here works */
|
||||||
static void
|
static void
|
||||||
setup(void)
|
setup(void)
|
||||||
{
|
{
|
||||||
@ -174,14 +187,13 @@ setup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
drw_resize(drw, mw, mh);
|
drw_resize(drw, mw, mh);
|
||||||
//drawmenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fputs("usage: dmenu [-bfiv] [-fn font] [-m monitor]\n"
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,9 +220,9 @@ main(int argc, char *argv[])
|
|||||||
mon = atoi(argv[++i]);
|
mon = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-fn")) /* font or font set */
|
else if (!strcmp(argv[i], "-fn")) /* font or font set */
|
||||||
fonts[0] = argv[++i];
|
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];
|
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];
|
colors[Scheme][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];
|
||||||
@ -233,12 +245,14 @@ main(int argc, char *argv[])
|
|||||||
die("no fonts could be loaded.");
|
die("no fonts could be loaded.");
|
||||||
lrpad = drw->fonts->h;
|
lrpad = drw->fonts->h;
|
||||||
|
|
||||||
|
/* ??? */
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio rpath", NULL) == -1)
|
if (pledge("stdio rpath", NULL) == -1)
|
||||||
die("pledge");
|
die("pledge");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
do{
|
do{
|
||||||
/* fgets adds a newline which will be printable in some fonts */
|
/* fgets adds a newline which will be printable in some fonts */
|
||||||
if(strlen(text) > 0)
|
if(strlen(text) > 0)
|
||||||
@ -246,5 +260,5 @@ main(int argc, char *argv[])
|
|||||||
drawmenu(text);
|
drawmenu(text);
|
||||||
}while(fgets(text, text_s, stdin) != NULL);
|
}while(fgets(text, text_s, stdin) != NULL);
|
||||||
|
|
||||||
return 1; /* unreachable */
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user