Extensive code documentation15 Oct 2023 14:59
Home All

Extensive 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. Contributions that help expand this would be greatly appreciated.

File tree

.
├── docs
│   ├── docs.md - Markdown documentation for spmenu, compiled into a man page
│   ├── example.Xresources - Example .Xresources file
│   ├── run-docs.md - Markdown documentation for spmenu_run
│   ├── spmenu.conf - Default configuration file for spmenu
│   ├── spmenu_desktop.desktop - .desktop entry for spmenu_run -d
│   ├── spmenu_filemanager.desktop - .desktop entry for spmenu_run -fm
│   ├── spmenu_run.desktop - .desktop entry for spmenu_run -x
│   └── spmenu.svg - Vector logo for spmenu
├── libs
│   ├── arg.c - Contains Arg *arg functions
│   ├── arg.h - Declares Arg *arg functions
│   ├── argv.c - Contains functions for parsing arguments
│   ├── conf
│   │   ├── config.c - Contains functions for reading spmenu.conf
│   │   └── config.h - Declares functions for reading spmenu.conf
│   ├── draw
│   │   ├── draw.c - Contains functions for drawing with Cairo and Pango
│   │   └── draw.h - Declares functions for drawing with Cairo and Pango
│   ├── draw.c - Contains functions for drawing different menu elements
│   ├── draw.h - Declares functions for drawing different menu elements
│   ├── fifo.c - Contains functions for the FIFO
│   ├── history.c - Contains functions for handling the history buffer
│   ├── icon.c - Contains functions for drawing and handling icons
│   ├── img.c - Contains functions for drawing and handling images
│   ├── main.c - Contains core functions like ecalloc, sp_strncpy and die
│   ├── match.c - Contains functions for matching items using input text
│   ├── options.h - Contains the default options for spmenu
│   ├── regex
│   │   ├── regex.c - Contains tiny-regex-c
│   │   └── regex.h - Declares tiny-regex-c
│   ├── rtl.c - Contains functions for right-to-left language support using GNU Fribidi
│   ├── schemes.c - Contains functions for SGR color support and alpha
│   ├── schemes.h - Declares functions for SGR color support and alpha
│   ├── sort.c - Contains functions for sorting items
│   ├── sort.h - Declares functions for sorting items
│   ├── stream.c - Contains functions for reading items from file/stdin
│   ├── stream.h - Declares functions for reading items from file/stdin
│   ├── wl
│   │   ├── inc.c - Includes C code for Wayland
│   │   ├── inc.h - Includes C headers for Wayland
│   │   ├── init.c - Contains functions for creating the Wayland window
│   │   ├── init.h - Declares functions for creating the Wayland window
│   │   ├── shm.c - Creates a shared memory buffer used to draw to the Wayland window.
│   │   ├── wayland.c - Includes abstraction functions for handling Wayland
│   │   └── wayland.h - Declares abstraction functions for handling Wayland
│   └── x11
│       ├── client.c - Contains functions for handling the X11 window
│       ├── client.h - Declares functions for handling the X11 window
│       ├── clipboard.c - Contains functions for handling the X11 clipboard
│       ├── clipboard.h - Declares functions for handling the X11 clipboard
│       ├── event.c - Contains functions for handling X11 events
│       ├── event.h - Declares functions for handling X11 events
│       ├── focus.c - Contains functions for handling focus
│       ├── focus.h - Declares functions for handling focus
│       ├── inc.c - Includes C code for X11
│       ├── inc.h - Includes C headers for X11
│       ├── init.c - Contains functions for creating the X11 window
│       ├── init.h - Declares functions for creating the X11 window
│       ├── key.c - Contains functions for handling keybinds
│       ├── key.h - Declares functions for handling keybinds
│       ├── lib.h - Includes Xlib and other X11 libraries
│       ├── mouse.c - Contains functions for handling mouse clicks
│       ├── mouse.h - Declares functions for handling mouse clicks
│       ├── xim.c - Contains functions for handling XIM
│       ├── xim.h - Declares functions for handling XIM
│       ├── xrdb.c - Contains functions for handling the xrdb
│       ├── xrdb.h - Declares functions for handling the xrdb
│       └── xresources.h - Contains an array of valid .Xresources values
├── LICENSE - License for spmenu
├── meson.build - Meson build
├── meson.options - Meson options
├── PKGBUILD - Arch PKGBUILD
├── protocols
│   ├── generate.sh - Runs scripts/spmenu_make headers
│   ├── wlr-layer-shell-unstable-v1.xml - wlr-layer-shell protocol
│   ├── xdg-output-unstable-v1.xml - xdg-output
│   └── xdg-shell.xml - xdg-shell
├── README.md - README for spmenu
├── spmenu.1 - man page for spmenu
├── spmenu.c - Main C code for spmenu
└── spmenu_run.1 - man page for spmenu_run

Position and width/height variables

Cairo functions

Most of these are in libs/draw/draw.c and libs/draw/draw.h

Drawable abstraction functions

Most of these are in libs/draw/draw.c and libs/draw/draw.h.

Most of these are in libs/draw/draw.c and libs/draw/draw.h.

Drawing functions

Map functions