chvol

Simple interface to set PulseAudio's volume, with graphical feedback! 🔊

Commit
89e032450a9888e0f6d306cccabc701992f83007
Parent
7d147417958a5e9d10dd9a96bbdff0407ad73f48
Author
Pablo <pablo-pie@riseup.net>
Date

Added usage instructions and a manpage

Diffstats

4 files changed, 88 insertions, 6 deletions

Status Name Changes Insertions Deletions
Modified .gitignore 2 files changed 0 1
Modified README.md 2 files changed 39 4
Added chvol.1 1 file changed 43 0
Modified nob.c 2 files changed 6 1
diff --git a/.gitignore b/.gitignore
@@ -1,4 +1,3 @@
 build/
 nob
-nob.old
 tags
diff --git a/README.md b/README.md
@@ -2,19 +2,54 @@
 
 Simple interface to set PulseAudio's volume, with graphical feedback! 🔊
 
-# Installation
+## Usage
+
+```console
+$ chvol VOLUME%
+$ chvol [up|down|mute|mute-mic] [-g]
+```
+
+### Commands
+
+* **up:**       increment the volume
+* **down:**     decrement the volume
+* **mute:**     toggle the speaker
+* **mute-mic:** toggle the microphone
+
+### Options
+
+* **-g:** show graphical feedback (volume bar)
+
+### Examples
+
+```console
+$ chvol       # prints the current volume
+$ chvol 75%   # sets the system volume to 75%
+$ chvol up -g # increments the volume
+```
+
+## Installation
 
 ```console
 $ ./nob
-# install -m 0755 ./build/chvol /usr/bin/
+# install -m 0755 -o root -g root ./build/chvol      /usr/bin/
+# install -m 0644 -o root -g root ./build/chvol.1.gz /usr/share/man/man1/
+# mandb
 ```
 
-# License
+### Configuration
+
+Many configuration keys are provided at compile-time. See `src/config.h` for
+further details.
+
+## License
 
 © 2026 Pablo.
 
 Free use of this software is granted under the terms of the GPL-3.0 License.
+See `LICENSE`.
 
 The file `assets/audio-volume-change.ogg` is part of the
 [Freedesktop sound theme](https://freedesktop.org/wiki/Specifications/sound-theme-spec)
-and is licensed under the CC-BY-4.0 license.
+and is licensed under the Creative Commons Attribution 4.0 International
+license.
diff --git /dev/null b/chvol.1
@@ -0,0 +1,43 @@
+.Dd May 25, 2026
+.Dt CHVOL 1
+.Os
+.Sh NAME
+.Nm chvol
+.Nd simple interface to set PulseAudio's volume
+.Au Pablo
+.Sh SYNOPSIS
+.Nm chvol
+.Ar VOLUME%
+.Nm chvol
+.Ar "[up|down|mute|mute-mic]" "[-g]"
+.Sh COMMANDS
+.Bl -tag -width Ds
+.It \fBup\fP
+Increment the volume.
+.It \fBdown\fP
+Decrement the volume.
+.It \fBmute\fP
+Toggle the speaker mute state.
+.It \fBmute-mic\fP
+Toggle the microphone mute state.
+.El
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl g
+Show graphical feedback (volume bar).
+.El
+.Sh EXAMPLES
+.Pp
+.Dl $ chvol \ \ \ \ \ \ # prints the current volume
+.Dl $ chvol 75% \ \ # sets the system volume to 75%
+.Dl $ chvol up -g # increments the volume
+.Pp
+.Sh LICENSE
+Free use of this software is granted under the terms of the GPL\-3.0 License.
+
+The audio sample played when
+.Fl g
+is enabled is part of the Freedesktop sound theme and is licensed under the
+Creative Commons Attribution 4.0 International license.
+.Sh AUTHOR
+.An Pablo Aq Mt pablo-pie@riseup.net
diff --git a/nob.c b/nob.c
@@ -17,6 +17,9 @@
 
 #define PCM_SRC_PATH BUILD_SRC_DIR "samples.c"
 
+#define MAN_SRC_PATH   "chvol.1"
+#define MAN_BUILD_PATH BUILD_DIR MAN_SRC_PATH
+
 #define OPTS "-Wall", "-Wextra", "-pedantic", "-I" SRC_DIR, "-I" BUILD_SRC_DIR
 #define LIBS "-lX11", "-lpulse-simple", "-lpulse", "-pthread"
 
@@ -36,7 +39,6 @@ int main(int argc, char** argv)
     for (int i = 0; i < argc; i++) cmd_append(&cmd, argv[i]);
     if (!cmd_run(&cmd)) return EXIT_FAILURE;
     return EXIT_SUCCESS;
-
   }
 
   cmd_append(&cmd, "cc", GENERATE_PCM_SRC_PATH);
@@ -52,5 +54,8 @@ int main(int argc, char** argv)
   cmd_append(&cmd, "-fsanitize=address", "-O2", OPTS, LIBS);
   if (!cmd_run(&cmd)) return EXIT_FAILURE;
 
+  cmd_append(&cmd, "gzip", "-c", MAN_SRC_PATH);
+  if (!cmd_run(&cmd, .stdout_path = MAN_BUILD_PATH)) return EXIT_FAILURE;
+
   return EXIT_SUCCESS;
 }