Commit Briefs
Makefile: Start preparing for compiling bxhkd with cproc. (main)
- Add -std=c11 and -pedantic to CFLAGS
bxhkd.c: Reorder functions and add comments
- Edit existing comments for brevity and readability - Organize forward function declarations based on function purpose - Reorder functions to match order in forward declarations
config.def.h: Add local flag to Hotkey struct for command dispatch.
- Add `local` field to Hotkey to distinguish between commands executed locally by bxhkd (spawn) and commands sent to bxwm over the socket (send_cmd). - Replace abstract labels like "spawn_terminal" with actual program names ("st", "st -e launchprogram") so the command string is always the real thing to execute. - Route "quit" to bxwm via socket (local=0) rather than attempting local exec.
bxhkd.c: Implement command dispatch and harden socket logic.
- Add dispatch logic in keypress() to route local commands to spawn() and socket commands to send_cmd(), using the local flag from theHotkey struct. - Fix -Wsign-compare warning by changing loop variable to size_t. - Add NULL check on getenv("HOME") in send_cmd(). - Mark send_cmd parameter as const. - Replace hardcoded socket path with SOCKET_SUFFIX macro.
bxhkd.c:
- Add comments - Add missing semi-colon in send_cmd() forward declaration - Add functions to forward declarations - Move main() from last position in functions to first position - Consistent with main() first in other basix X programs
bxhkd.c:
- Add included C header files. - Create macros for LENGTH and SOCKET_SUFFIX. - Set global variables. - Set function forward declarations. - Create functions for for key handling - Create function for sending keypress commands to window manager socket. - Create functions for gracefully terminating and cleanup (releasing keys and closing the X display). - Create the main() function.
config.def.h:
- Set standard and nonstandard modifier keys for keyboard shortcuts. - Create alias Hotkey for data types. - Set key press commands.
