Commit Briefs

f5a66e22aa Brett Fisher

LICENSE.md, README.md, bxnotify.1: Add user-facing documentation. (main)

- Adopt ISC licnese. - Create README.md detailing build, configuration, and usage. - Create bxnotify.c manual page.


a08809ec69 Brett Fisher

bxnotify.c, config.def.h: Name the concurrent notification cap.

- Define MAX_STACK in config.def.h, replacing the previously magic-numbered [100] array dimensions and loop bounds in get_and_register_stack_y() and unregister_position(). - Add cfg_max_stack as a runtime configuration variable, following the same pattern as cfg_stack_gap and other tunable defaults. - This makes the cap on concurrent notifications explicit, configurable from a single location, and consistent with the suite's convention of promoting tunables into the config layer.


95eeecbe5f Brett Fisher

bxnotify.c: Correct typo in headers and edit calc_layout() function.

- Rename include to <getopt.h> to match the actual getopt(3) declaration - Correct calc_layout so that when input contains no breakable space, hard-break is at the largest fitting prefix - Leave cfg_padding on the right for visual appeal - Add NULL checks on realloc() so memory exhaustion routes through die() and cleanup() rather than crashing - Restructure the loop so the workd-break and hard-break paths are explicit and symmetric.


715dc48d96 Brett Fisher

bxnotify.c: Eliminate variable shadowing in xerror handler.

- Rename the local 'dpy' parameter in the xerror() function to 'd'. to prevent the local parameter from shadowing the global 'dpy' Display pointer. - Update the chained error handler call to use the new 'd' parameter.


d05d00966b Brett Fisher

bxnotify.c: Document full option set and ensure portable getopt declaration.

- Include <getopt.h> to provide an explicit, portable declaration for the getopt(3) function. This aligns with the code correctness and portability goals across ARM64, AMD64, and RISC-V architectures. - Update the usage error message in the getopt default case to include the [-C border] option, which was previously omitted from the help text despite being a valid flag.


d9934b8e3e Brett Fisher

bxnotify.c: Refactor error and exit handling for suite consistency.

- Update the cleanup() function signature to accept an integer error code (int err), allowing the function to terminate the process via exit() based on runtime success or failure. - Modify die() to call cleanup(1) instead of exit(1), ensuring all resources (X11 connections, text buffers, registry positions) are properly freed even when terminating due to an error. - Update the successful exit path in main() to call cleanup(0). - Remove the explicit 'return 0' from main(), as cleanup() now handles process termination directly. - Ensure the forward declaration for cleanup() matches the updated implementation to prevent C11 type-mismatch warnings.


13d71a1a51 Brett Fisher

bxnotify.c, config.def.h: Move stacking gap offset to config.def.h.

- Define STACK_GAP as a configurable constant in config.def.h, replacing the hardcoded 16-pixel offset. - Update registration logic to reference cfg_stack_gap, maintaining consistency with existing runtime configuration patterns and improving overall maintainability.



834a7dd0ac Brett Fisher

config.def.h: Update default values.


f04a5f5c2e Brett Fisher

bxnotify.c: Implement command-line configuration logic.

- Convert hardcoded config.h macros into mutable global variables for runtime configuration. - Implement CLI option parsing using getopt(3) to support custom duration (-d), font (-f), foreground color (-F), background color (-B), border color (-C), and alignment (-a) at launch. - Update setup() and draw() to utilize runtime configuration variables instead of compile-time macros. - Retain config.def.h as the architectural source for default values.


Branches

Tags

This repository contains no tags

Tree

.gitignorecommits | blame
LICENSE.mdcommits | blame
Makefilecommits | blame
README.mdcommits | blame
bxnotify.1commits | blame
bxnotify.ccommits | blame
config.def.hcommits | blame

README.md

# bxnotify

A very basic X notification tool.

## Just a Heads-Up

I needed a way to display a short message on screen from a shell 
script or a Lua program. I did not need a notification daemon, a 
dbus service, or a background process. I just needed a small 
program that reads text from stdin and shows it.

bxnotify is the result: a one-shot notification renderer. Each 
invocation displays a single notification, then exits. Concurrent 
invocations stack vertically, so multiple notifications can be 
visible at once.

## Dependencies

- Xlib
- Xft
- A C compiler compliant with the C11 standard.

## Build

Compile __bxnotify__ from source.

```
make
```


## Install

Install the binary and man page. Note that root privileges are not 
required as the default destination is `~/.local/`.

```
make install
```


## Uninstall

Remove the binary and man page.

```
make uninstall
```


## Configuration

__bxnotify__ is configured at compile-time by editing config.def.h. 
After making changes, the program must be recompiled and 
reinstalled. See bxnotify(1) for details.

Command line flags override configuration defaults for font, 
colors, alignment, and duration.

## Design & Functionality

__bxnotify__ is built around a set of opinionated primitives:

- One-shot renderer: reads from stdin, shows a notification, exits
- Concurrent notifications stack vertically
- Auto-sized height based on the number of input lines
- Word wraps long lines to fit the configured width
- Dismissed with Mod4+q (sends SIGUSR1 to the owning process)
- Configurable duration in seconds (0 = persist until dismissed)
- Runtime registry at `~/.local/tmp/bxnotify.reg` for stacking, 
  coordinated with flock(2) and pruned with kill(2)

## Usage

Send a notification from the shell.

```
echo “Notify me about this” | bxnotify
```

Send a multi-line notification.

```
printf “Notify me about this\nNotify me about that” | bxnotify
```

Send a notification with a custom duration.

```
echo “Notify me for a long time” | bxnotify -d 30
```

Send a notification from a Lua script.

```
os.execute("echo 'Notify me about this' | bxnotify")
```

When used with bxwm(1) and bxbar(1), bxnotify complements the
suite by providing visual feedback for system events and scripts
without requiring dbus or a notification daemon.