Some of spmenu’s code documented. If you want to hack on the project, this should be useful. Note that these may be renamed in the future to make the codebase easier to understand and make changes to. Also note that this is definitely not a complete list.
bh
bh
. The name
comes from dwm’s bh
meaning ‘bar height’. This is the
height of each item in the list.mh
drw_resize()
and XResizeWindow()
to
adjust this.mw
drw_resize()
and XResizeWindow()
to
adjust this.2 * borderwidth
is removed from mw
(2*
because we have two sides)2 * sp
is removed from mw
(2* because we
have two sides)x
drw_text
use this.buttonpress()
, otherwise clicks will be offset.y
drw_text
use this.buttonpress()
, otherwise clicks will be offset.ev->x
buttonpress()
function to check where you clicked.ev->y
buttonpress()
function to check where you clicked.w
drw_text()
for
example, but you may override this.plw
buttonpress()
and draw functions.vp
create_window()
function.sp
create_window()
function.promptw
TEXTW(prompt)
.inputw
fh
drawcaret()
.menuposition
0
, spmenu will be put on the bottom of the screen. If it’s
set to 1
it will be put on the top of the screen. If it’s
2
it will be put in the center of the screen.wa.width
wa
is
XWindowAttributes
.wa.height
wa
is
XWindowAttributes
.imageheight
imagewidth
imagegaps
imageh
imageheight
. This is what
imageheight
is initially set to.imagew
imagewidth
. This is what
imagewidth
is initially set to.imageg
imagegaps
. This is what
imagegaps
is initially set to.longestedge
imageheight
and imagewidth
.numberWidth
TEXTW(numbers)
if the match count isn’t hidden.modeWidth
TEXTW(modetext)
if the mode indicator isn’t hidden.larrowWidth
TEXTW(leftarrow)
if the left arrow isn’t hidden.rarrowWidth
TEXTW(rightarrow)
if the right arrow isn’t hidden.powerlinewidth
plw / 2
if
powerlines are enabled.curpos
Most of these are in libs/sl/draw.c
and
libs/sl/draw.h
.
drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
Display *dpy
,
Drw
. Think of it as a canvas.drw_resize(Drw *drw, unsigned int w, unsigned int h)
w
, h
).drw_free(Drw *drw);
cleanup()
so most of the time you don’t need to use this.Most of these are in libs/sl/draw.c
and
libs/sl/draw.h
. NOTE: These will differ slightly depending
on if Pango is enabled or not.
drw_font_create(Drw* drw, char *font[], size_t fontcount);
drw_font_free(Fnt *set);
drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n, Bool markup);
n
and the length of the text drawn. The text is not
actually drawn though.drw_font_getwidth(Drw *drw, const char *text, Bool markup);
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
drw_clr_create(Drw *drw, Clr *dest, char *clrname, unsigned int alpha);
drw_scm_create(Drw *drw, char *clrnames[], unsigned int alphas[], size_t clrcount);
drw_cur_create(Drw *drw, int shape);
drw_cur_free(Drw *drw, Cur *cursor);
drw_setscheme(Drw *drw, Clr *scm);
*scm
created by
drw_scm_create()
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled , int invert);
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);
const char *text
contains the text itself.drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
Various functions that have been removed for some reason.
drw_setfont(Drw *drw, Fnt *set);