3.7 KiB
3.7 KiB
Code documentation
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.
Position and width/height variables
bh
- Menu height divided by lines gets you
bh
. The name comes from dwm'sbh
meaning 'bar height'. This is the height of each item in the list.
- Menu height divided by lines gets you
mh
- Menu height (or height of the window)
- Use
drw_resize()
andXResizeWindow()
to adjust this.
mw
- Menu width (or width of the window)
- Use
drw_resize()
andXResizeWindow()
to adjust this. 2 * borderwidth
is removed frommw
(2* because we have two sides)2 * sp
is removed frommw
(2* because we have two sides)
x
- X position, functions like
drw_text
use this. - If you set this in bar drawing functions, you must apply the same
to
buttonpress()
, otherwise clicks will be offset.
- X position, functions like
y
- Y position, functions like
drw_text
use this. - If you set this in bar drawing functions, you must apply the same
to
buttonpress()
, otherwise clicks will be offset.
- Y position, functions like
ev->x
- X position where you clicked. This is used in the
buttonpress()
function to check where you clicked.
- X position where you clicked. This is used in the
ev->y
- Y position where you clicked. This is used in the
buttonpress()
function to check where you clicked.
- Y position where you clicked. This is used in the
w
- Width of something, this is passed to
drw_text()
for example, but you may override this.
- Width of something, this is passed to
plw
- This is the width of the powerline arrow. It must be added on in
the
buttonpress()
and draw functions.
- This is the width of the powerline arrow. It must be added on in
the
vp
- Vertical padding, this is initially added on in the
create_window()
function.
- Vertical padding, this is initially added on in the
sp
- Horizontal padding, this is initially added on in the
create_window()
function.
- Horizontal padding, this is initially added on in the
promptw
- Width of the prompt text, this is going to be the same as
TEXTW(prompt)
.
- Width of the prompt text, this is going to be the same as
inputw
- Width of the input text.
menuposition
- Integer the user is meant to configure. If it's set to
0
, spmenu will be put on the bottom of the screen. If it's set to1
it will be put on the top of the screen. If it's2
it will be put in the center of the screen.
- Integer the user is meant to configure. If it's set to
wa.width
- Window width,
wa
isXWindowAttributes
.
- Window width,
wa.height
- Window height,
wa
isXWindowAttributes
.
- Window height,
imageheight
- Image height, This is not the height of the image, it is the height that the image will be scaled to fit.
imagewidth
- Image width, This is not the width of the image, it is the width that the image will be scaled to fit.
imagegaps
- Image gaps, this is extra space added around the image.
imageh
- Usually the same as
imageheight
. This is whatimageheight
is initially set to.
- Usually the same as
imagew
- Usually the same as
imagewidth
. This is whatimagewidth
is initially set to.
- Usually the same as
imageg
- Usually the same as
imagegaps
. This is whatimagegaps
is initially set to.
- Usually the same as
longestedge
- As the name implies, it is the longest (highest value) of
imageheight
andimagewidth
.
- As the name implies, it is the longest (highest value) of
numberWidth
- Integer set in some functions, it is simply
TEXTW(numbers)
if the match count isn't hidden.
- Integer set in some functions, it is simply
modeWidth
- Integer set in some functions, it is simply
TEXTW(modetext)
if the mode indicator isn't hidden.
- Integer set in some functions, it is simply
larrowWidth
- Integer set in some functions, it is simply
TEXTW(leftarrow)
if the left arrow isn't hidden.
- Integer set in some functions, it is simply
rarrowWidth
- Integer set in some functions, it is simply
TEXTW(rightarrow)
if the right arrow isn't hidden.
- Integer set in some functions, it is simply
powerlinewidth
- Integer set in some functions, it is simply
plw / 2
if powerlines are enabled.
- Integer set in some functions, it is simply
curpos
- Cursor/caret position. When text is added to the input, the width of that text is added to this.