Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69b6ecd2d5 | ||
|
|
373e64fcad | ||
|
|
21cada4969 | ||
|
|
563ebdbbab | ||
|
|
a776be0bf3 | ||
|
|
f7a2a7270b | ||
|
|
95255580b1 | ||
|
|
f70e13dd70 | ||
|
|
c44ae01226 | ||
|
|
ffef8d7eaf | ||
|
|
6658d6561b | ||
|
|
93491af2e2 | ||
|
|
77fe0d5fc1 | ||
|
|
a18899003a | ||
|
|
498ba0b5bb | ||
|
|
0638bba56f | ||
|
|
652d14c923 | ||
|
|
d388b0aec0 | ||
|
|
52ae286c43 | ||
|
|
a967ddb6ef | ||
|
|
1e9f5c784b | ||
|
|
20b81a69dd | ||
|
|
ce28dc2fde | ||
|
|
65dc7da800 | ||
|
|
347d3048f0 | ||
|
|
7c10a7a5e3 | ||
|
|
c9460d54a4 | ||
|
|
52a7629834 | ||
|
|
4343cf56bf | ||
|
|
028785ac27 | ||
|
|
2e3b870efe | ||
|
|
b9531d7c53 | ||
|
|
09ab061151 | ||
|
|
f857d20b27 |
No files matched your search
+11
-10
@@ -1,3 +1,4 @@
|
||||
|
||||
name: build-and-test
|
||||
|
||||
concurrency:
|
||||
@@ -35,27 +36,27 @@ jobs:
|
||||
|
||||
- name: Prepare data dir for runtime
|
||||
run: |
|
||||
mkdir -p "$PWD/share/keyvibe"
|
||||
cp -r audio "$PWD/share/keyvibe/"
|
||||
mkdir -p "$PWD/share/vbx"
|
||||
cp -r audio "$PWD/share/vbx/"
|
||||
|
||||
- name: List sound packs
|
||||
run: ./keyvibe --list
|
||||
run: ./vbx --list
|
||||
|
||||
- name: Smoke test help
|
||||
run: ./keyvibe --help || true
|
||||
run: ./vbx --help || true
|
||||
|
||||
- name: Extra smoke tests (non-fatal)
|
||||
run: |
|
||||
./keyvibe --reload || true
|
||||
./keyvibe --stop || true
|
||||
./vbx --reload || true
|
||||
./vbx --stop || true
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: keyvibe-binaries
|
||||
name: vbx-binaries
|
||||
path: |
|
||||
keyvibe
|
||||
keyvibe-audio
|
||||
keyvibe-input
|
||||
vbx
|
||||
vbx-audio
|
||||
vbx-input
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
/keyvibe
|
||||
/keyvibe-audio
|
||||
/keyvibe-input
|
||||
/audio
|
||||
/input
|
||||
/vbx
|
||||
|
||||
# Object and static/shared library files
|
||||
*.o
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -std=c99 -Iinclude
|
||||
# Updated include paths for modular headers
|
||||
CFLAGS = -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200809L -Iinclude -Iinclude/app -Iinclude/audio -Iinclude/common -Iinclude/sound -Iinclude/config
|
||||
PREFIX ?= /usr
|
||||
|
||||
# Pass PACKAGE_PREFIX macro for config.h
|
||||
@@ -10,25 +10,25 @@ LDFLAGS_SOUND = -ljson-c -lpulse -lpulse-simple -lsndfile -lpthread
|
||||
LDFLAGS_KEYBOARD = $(shell pkg-config --libs libevdev libinput libudev) -lpthread
|
||||
|
||||
# Targets
|
||||
KeyVibe_TARGET = keyvibe
|
||||
SOUND_TARGET = keyvibe-audio
|
||||
KEYBOARD_TARGET = keyvibe-input
|
||||
VBX_TARGET = vbx
|
||||
SOUND_TARGET = audio
|
||||
KEYBOARD_TARGET = input
|
||||
|
||||
# Sources
|
||||
KeyVibe_SOURCE = src/keyvibe_main.c src/utils.c
|
||||
SOUND_SOURCE = src/keyvibe_audio.c src/utils.c
|
||||
KEYBOARD_SOURCE = src/keyvibe_input.c src/utils.c
|
||||
# Sources (reorganized)
|
||||
VBX_SOURCE = src/main.c src/common/utils.c src/config.c src/soundpacks.c src/app/process.c src/app/watch.c src/cli.c src/app/reload.c
|
||||
SOUND_SOURCE = src/audio/main.c src/audio/config.c src/audio/playback.c src/common/utils.c
|
||||
KEYBOARD_SOURCE = src/input.c src/common/utils.c
|
||||
|
||||
# Install paths
|
||||
BINDIR = $(PREFIX)/bin
|
||||
SHAREDIR = $(PREFIX)/share/keyvibe
|
||||
UDEV_RULE = /etc/udev/rules.d/99-keyvibe-allow-keyboard.rules
|
||||
SHAREDIR = $(PREFIX)/share/vbx
|
||||
UDEV_RULE = /etc/udev/rules.d/99-vbx-allow-keyboard.rules
|
||||
|
||||
all: $(KeyVibe_TARGET) $(SOUND_TARGET) $(KEYBOARD_TARGET)
|
||||
all: $(VBX_TARGET) $(SOUND_TARGET) $(KEYBOARD_TARGET)
|
||||
|
||||
|
||||
# Build main launcher (needs json-c)
|
||||
$(KeyVibe_TARGET): $(KeyVibe_SOURCE)
|
||||
$(VBX_TARGET): $(VBX_SOURCE)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ -ljson-c -lpthread
|
||||
|
||||
$(SOUND_TARGET): $(SOUND_SOURCE)
|
||||
@@ -38,24 +38,24 @@ $(KEYBOARD_TARGET): $(KEYBOARD_SOURCE)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS_KEYBOARD)
|
||||
|
||||
clean:
|
||||
rm -f $(KeyVibe_TARGET) $(SOUND_TARGET) $(KEYBOARD_TARGET)
|
||||
rm -f $(VBX_TARGET) $(SOUND_TARGET) $(KEYBOARD_TARGET)
|
||||
|
||||
test: all
|
||||
@echo "Testing sound packs:"
|
||||
./$(KeyVibe_TARGET) --list
|
||||
./$(VBX_TARGET) --list
|
||||
@echo ""
|
||||
@echo "To run KeyVibe:"
|
||||
@echo " sudo ./$(KeyVibe_TARGET) # Default sound"
|
||||
@echo " sudo ./$(KeyVibe_TARGET) -s cherrymx-blue-abs # Specific sound"
|
||||
@echo " sudo ./$(KeyVibe_TARGET) --help # Show help"
|
||||
@echo "To run VBX:"
|
||||
@echo " sudo ./$(VBX_TARGET) # Default sound"
|
||||
@echo " sudo ./$(VBX_TARGET) -s cherrymx-blue-abs # Specific sound"
|
||||
@echo " sudo ./$(VBX_TARGET) --help # Show help"
|
||||
|
||||
install:
|
||||
@echo "Installing KeyVibe to $(DESTDIR)$(BINDIR) and $(DESTDIR)$(SHAREDIR)..."
|
||||
install -Dm755 $(KeyVibe_TARGET) $(DESTDIR)$(BINDIR)/$(KeyVibe_TARGET)
|
||||
install -Dm755 $(SOUND_TARGET) $(DESTDIR)$(BINDIR)/$(SOUND_TARGET)
|
||||
install -Dm755 $(KEYBOARD_TARGET) $(DESTDIR)$(BINDIR)/$(KEYBOARD_TARGET)
|
||||
@echo "Installing VBX to $(DESTDIR)$(BINDIR) and $(DESTDIR)$(SHAREDIR)..."
|
||||
install -Dm755 $(VBX_TARGET) $(DESTDIR)$(BINDIR)/$(VBX_TARGET)
|
||||
install -Dm755 $(SOUND_TARGET) $(DESTDIR)$(BINDIR)/vbx-audio
|
||||
install -Dm755 $(KEYBOARD_TARGET) $(DESTDIR)$(BINDIR)/vbx-input
|
||||
install -d $(DESTDIR)$(SHAREDIR)
|
||||
cp -r audio $(DESTDIR)$(SHAREDIR)/
|
||||
cp -r soundpacks $(DESTDIR)$(SHAREDIR)/
|
||||
@echo "Installing udev rule for non-root keyboard access..."
|
||||
@echo '# Allow non-root access to input event devices for active seat users and input group' | sudo tee $(UDEV_RULE) >/dev/null
|
||||
@echo 'SUBSYSTEM=="input", KERNEL=="event*", TAG+="uaccess", GROUP="input", MODE="0660"' | sudo tee -a $(UDEV_RULE) >/dev/null
|
||||
@@ -70,10 +70,10 @@ install:
|
||||
@echo "Installation complete."
|
||||
|
||||
uninstall:
|
||||
@echo "Uninstalling KeyVibe from $(DESTDIR)$(BINDIR) and $(DESTDIR)$(SHAREDIR)..."
|
||||
rm -f $(DESTDIR)$(BINDIR)/$(KeyVibe_TARGET)
|
||||
rm -f $(DESTDIR)$(BINDIR)/$(SOUND_TARGET)
|
||||
rm -f $(DESTDIR)$(BINDIR)/$(KEYBOARD_TARGET)
|
||||
@echo "Uninstalling VBX from $(DESTDIR)$(BINDIR) and $(DESTDIR)$(SHAREDIR)..."
|
||||
rm -f $(DESTDIR)$(BINDIR)/$(VBX_TARGET)
|
||||
rm -f $(DESTDIR)$(BINDIR)/vbx-audio
|
||||
rm -f $(DESTDIR)$(BINDIR)/vbx-input
|
||||
rm -rf $(DESTDIR)$(SHAREDIR)
|
||||
@echo "Removing udev rule..."
|
||||
@sudo rm -f $(UDEV_RULE) || true
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
<div align="center">
|
||||
<img src="assets/logo.png" alt="Project Logo">
|
||||
|
||||
# KeyVibe
|
||||
# vbx
|
||||
|
||||
> A C-based CLI tool that brings realistic mechanical keyboard sounds to every keystroke.
|
||||
> A CLI tool that brings realistic mechanical keyboard and mouse sounds to every keystroke.
|
||||
|
||||
KeyVibe listens to your keyboard events and plays high‑quality switch sounds with low latency. It ships with multiple sound packs and supports your own custom packs. Run it interactively or as a background daemon with live reload of your preferences.
|
||||
vbx listens to your keyboard and mouse events and plays high‑quality switch sounds with low latency. It ships with multiple sound packs for both devices and supports your own custom packs. Run it interactively or as a background daemon with live reload of your references.
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/S4NKALP/KeyVibe/graphs/contributors)
|
||||
[](https://github.com/S4NKALP/KeyVibe/stargazers)
|
||||
[](https://github.com/S4NKALP/KeyVibe/network/members)
|
||||
[](LICENSE)
|
||||
[](https://github.com/S4NKALP/KeyVibe/issues)
|
||||
[](https://github.com/S4NKALP/KeyVibe/pulse)
|
||||
[](https://github.com/S4NKALP/vbx/graphs/contributors)
|
||||
[](https://github.com/S4NKALP/vbx/stargazers)
|
||||
[](https://github.com/S4NKALP/vbx/network/members)
|
||||
[](LICENSE)
|
||||
[](https://github.com/S4NKALP/vbx/issues)
|
||||
[](https://github.com/S4NKALP/vbx/pulse)
|
||||
|
||||
[**Report Bug**](https://github.com/S4NKALP/KeyVibe/issues) • [**Request Feature**](https://github.com/S4NKALP/KeyVibe/discussions)
|
||||
[**Report Bug**](https://github.com/S4NKALP/vbx/issues) • [**Request Feature**](https://github.com/S4NKALP/vbx/discussions)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -26,11 +24,12 @@ KeyVibe listens to your keyboard events and plays high‑quality switch sounds w
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- Real-time key press/release sound playback
|
||||
- Multiple bundled sound packs
|
||||
- User sound packs under `~/.local/share/keyvibe/audio/`
|
||||
- Real-time keyboard key press/release sound playback
|
||||
- Real-time mouse click sound playback
|
||||
- Multiple bundled sound packs for both keyboard and mouse
|
||||
- User sound packs under `~/.local/share/vbx/audio/`
|
||||
- Background daemon mode with PID file and safe shutdown
|
||||
- Live config reload on `~/.keyvibe.json` changes (daemon mode)
|
||||
- Live config reload on `~/.vbx.json` changes (daemon mode)
|
||||
|
||||
## 📋 Dependencies
|
||||
|
||||
@@ -48,61 +47,74 @@ KeyVibe listens to your keyboard events and plays high‑quality switch sounds w
|
||||
### Arch Linux
|
||||
|
||||
```bash
|
||||
yay -S keyvibe-git
|
||||
paru -S vbx-git
|
||||
```
|
||||
|
||||
### 🛠️ Build From Source
|
||||
|
||||
```bash
|
||||
git clone https://github.com/S4NKALP/KeyVibe.git
|
||||
cd KeyVibe
|
||||
git clone https://github.com/S4NKALP/vbx.git
|
||||
cd vbx
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
## 💡 Usage
|
||||
|
||||
Usage: keyvibe [OPTIONS]
|
||||
Usage: vbx [OPTIONS]
|
||||
|
||||
Options:
|
||||
-S, --sound SOUND_NAME Select sound pack (default: eg-oreo)
|
||||
-V, --volume VOLUME Set volume [0-100] (default: 50)
|
||||
-c --override-config Use CLI values for this run
|
||||
-d --daemon Run as a background daemon
|
||||
-s --stop Stop the background daemon
|
||||
-m --mute Mute sound
|
||||
-u --unmute Unmute sound
|
||||
-- enbale/disable DEVICE_NAME Enable/disable a device
|
||||
-l, --list List available sound packs
|
||||
-f, --system-volume-following=0/1 Enable/disable dynamic tracking of system volume (default: 0)
|
||||
-h, --help Show this help message
|
||||
-v, --verbose Enable verbose output
|
||||
|
||||
Notes:
|
||||
|
||||
- First run creates `~/.keyvibe.json`. Subsequent runs use it unless `-c` is supplied.
|
||||
- In daemon mode, editing `~/.keyvibe.json` will automatically reload.
|
||||
- First run creates `~/.vbx.json`. Subsequent runs use it unless `--config` is supplied.
|
||||
- In daemon mode, editing `~/.vbx.json` will automatically reload.
|
||||
|
||||
## 🔊 Volume Mechanics
|
||||
|
||||
vbx lets you control your volume in three ways:
|
||||
1. **Keyboard Volume** (`--volume`): Sets the base volume for your keyboard sounds (from 0 to 100).
|
||||
2. **Mouse Volume** (`--mouse-volume`): Sets the base volume for your mouse clicks (from 0 to 100).
|
||||
3. **System Volume Multiplexer** (`--system-volume-following=1`): When turned on, `vbx` automatically scales the app's sound to match your computer's main volume slider.
|
||||
|
||||
**How the multiplexer works:**
|
||||
Instead of just cutting the volume linearly (which makes sounds too quiet at 50% OS volume), the multiplexer uses a gentle boost curve. This means if you lower your computer's volume, your typing sounds will still be punchy and easy to hear without ever being too loud!
|
||||
|
||||
**Example:**
|
||||
If you set your keyboard volume to `50%` (`vbx --volume 50 --system-volume-following 1`), and your computer's master volume is currently at `80%`, `vbx` will intelligently scale its own output down to securely match your OS levels, without you having to change your `vbx` settings every time you watch a quiet video!
|
||||
|
||||
## 🎵 Sound Packs
|
||||
|
||||
System packs are installed under: `/usr/share/keyvibe/audio/`
|
||||
System packs are installed under: `/usr/share/vbx/soundpacks/`
|
||||
|
||||
User packs go under: `~/.local/share/keyvibe/audio/<pack-name>/`
|
||||
User packs go under: `~/.local/share/vbx/soundpacks/<device-name>/<pack-name>/`
|
||||
|
||||
Required files inside each `<pack-name>/` directory:
|
||||
|
||||
- `config.json` (format matches bundled packs)
|
||||
- Audio files referenced by `config.json`
|
||||
|
||||
Resolution order when selecting `-s <name>`:
|
||||
|
||||
1. `~/.local/share/keyvibe/audio/<name>/`
|
||||
2. `/usr/share/keyvibe/audio/<name>/`
|
||||
|
||||
List shows `(user)` or `(system)` source next to each pack.
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
PRs welcome. Please keep code modular and readable, and prefer small, focused changes.
|
||||
Contributions are welcome! Feel free to open issues or submit pull requests.
|
||||
|
||||
## 📄 License
|
||||
|
||||
MIT — see [LICENSE](LICENSE).
|
||||
|
||||
## 🙏 Credits
|
||||
|
||||
- [MechVibes](https://github.com/hainguyents13/mechvibes) for sound packs
|
||||
- [mechavibes-dx](https://github.com/hainguyents13/mechvibes-dx) for sound packs
|
||||
- [showmethekey](https://github.com/AlynxZhou/showmethekey) for code
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,26 @@
|
||||
#ifndef VBX_CLI_H
|
||||
#define VBX_CLI_H
|
||||
|
||||
typedef struct {
|
||||
char *sound;
|
||||
char *mouse_sound;
|
||||
int volume;
|
||||
int keyboard_volume;
|
||||
int mouse_volume;
|
||||
int daemon_flag;
|
||||
int stop_flag;
|
||||
int list_flag;
|
||||
int verbose;
|
||||
int keyboard_mute; // -1 unchanged, 0 unmute, 1 mute
|
||||
int mouse_mute; // -1 unchanged, 0 unmute, 1 mute
|
||||
int keyboard_enabled; // -1 unchanged, 0 disabled, 1 enabled
|
||||
int mouse_enabled; // -1 unchanged, 0 disabled, 1 enabled
|
||||
int system_volume_following; // -1 unchanged, 0 disabled, 1 enabled
|
||||
} CliOptions;
|
||||
|
||||
void print_usage(const char *program_name);
|
||||
int parse_cli(int argc, char **argv, CliOptions *out);
|
||||
|
||||
#endif // VBX_CLI_H
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef VBX_PROCESS_H
|
||||
#define VBX_PROCESS_H
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern pid_t keyboard_pid;
|
||||
extern pid_t sound_pid;
|
||||
extern char pidfile_path[];
|
||||
extern int is_daemon;
|
||||
extern volatile sig_atomic_t reload_requested;
|
||||
|
||||
void cleanup_processes(int sig);
|
||||
int require_running_pid(pid_t *out_pid);
|
||||
void daemonize_self(void);
|
||||
void stop_children(void);
|
||||
int start_children(const char *sound_dir, const char *config_path, int volume,
|
||||
int verbose, int mute, const char *mouse_sound_dir,
|
||||
const char *mouse_config_path, int mouse_volume,
|
||||
int keyboard_mute, int mouse_mute, int keyboard_enabled,
|
||||
int mouse_enabled, int system_volume_following);
|
||||
void handle_sighup(int sig);
|
||||
|
||||
#endif // VBX_PROCESS_H
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef VBX_RELOAD_H
|
||||
#define VBX_RELOAD_H
|
||||
|
||||
int handle_reload(const char *user_cfg_path,
|
||||
char *current_sound_name, char *current_mouse_sound_name,
|
||||
int *current_keyboard_volume, int *current_mouse_volume,
|
||||
char *current_config_path, char *current_sound_dir,
|
||||
char *current_mouse_config_path, char *current_mouse_sound_dir,
|
||||
int current_mute, int current_verbose,
|
||||
int current_keyboard_mute, int current_mouse_mute,
|
||||
int *current_keyboard_enabled, int *current_mouse_enabled,
|
||||
int *current_system_volume_following);
|
||||
|
||||
#endif // VBX_RELOAD_H
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef VBX_WATCH_H
|
||||
#define VBX_WATCH_H
|
||||
|
||||
int start_config_watcher(const char *path);
|
||||
|
||||
#endif // VBX_WATCH_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef VBX_AUDIO_CONFIG_H
|
||||
#define VBX_AUDIO_CONFIG_H
|
||||
|
||||
#include "audio/types.h"
|
||||
|
||||
int load_sound_config(const char *config_path, SoundPack *pack);
|
||||
|
||||
#endif // VBX_AUDIO_CONFIG_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef VBX_AUDIO_PLAYBACK_H
|
||||
#define VBX_AUDIO_PLAYBACK_H
|
||||
|
||||
int init_audio(void);
|
||||
void play_sound_segment(int key_code, int is_pressed);
|
||||
|
||||
#endif // VBX_AUDIO_PLAYBACK_H
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef VBX_AUDIO_TYPES_H
|
||||
#define VBX_AUDIO_TYPES_H
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define MAX_CONCURRENT_SOUNDS 10
|
||||
|
||||
typedef struct {
|
||||
int start_ms;
|
||||
int duration_ms;
|
||||
short *pcm_data;
|
||||
uint32_t num_samples;
|
||||
} SoundMapping;
|
||||
|
||||
typedef struct {
|
||||
char press_file[256];
|
||||
char release_file[256];
|
||||
char generic_press_files[5][256];
|
||||
short *generic_press_data[5];
|
||||
uint32_t generic_press_samples[5];
|
||||
int num_generic_press_files;
|
||||
char sound_file[256];
|
||||
short *release_data;
|
||||
uint32_t release_samples;
|
||||
SoundMapping key_mappings[512];
|
||||
struct {
|
||||
char *press;
|
||||
char *release;
|
||||
short *press_data;
|
||||
uint32_t press_samples;
|
||||
short *release_data;
|
||||
uint32_t release_samples;
|
||||
} multi_key_mappings[512];
|
||||
int is_multi;
|
||||
SF_INFO sf_info;
|
||||
} SoundPack;
|
||||
|
||||
typedef struct {
|
||||
short *data;
|
||||
uint32_t total_samples;
|
||||
uint32_t current_pos;
|
||||
float volume;
|
||||
int active;
|
||||
} AudioVoice;
|
||||
|
||||
#define MAX_MIXER_VOICES 32
|
||||
|
||||
typedef struct {
|
||||
int key_code;
|
||||
int thread_id;
|
||||
int is_pressed;
|
||||
} PlaybackData;
|
||||
|
||||
extern SoundPack g_sound_pack;
|
||||
extern SoundPack g_mouse_sound_pack;
|
||||
extern float g_volume;
|
||||
extern float g_mouse_volume;
|
||||
extern int g_verbose;
|
||||
extern int g_mute;
|
||||
extern int g_keyboard_mute;
|
||||
extern int g_mouse_mute;
|
||||
extern int g_keyboard_enabled;
|
||||
extern int g_mouse_enabled;
|
||||
extern int g_system_volume_following;
|
||||
extern float g_system_volume_multiplier;
|
||||
|
||||
#endif // VBX_AUDIO_TYPES_H
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef VBX_IPC_H
|
||||
#define VBX_IPC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Lightweight binary structure for IPC between vbx-input and vbx-audio
|
||||
// Replaces the heavy JSON parsing
|
||||
typedef struct {
|
||||
uint32_t key_code;
|
||||
uint8_t is_pressed;
|
||||
} VbxEvent;
|
||||
|
||||
#endif // VBX_IPC_H
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef VBX_LOG_H
|
||||
#define VBX_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
// Assuming g_verbose is defined globally or we pass it
|
||||
extern int g_verbose;
|
||||
extern int is_daemon;
|
||||
|
||||
#define LOG_LEVEL_DEBUG 0
|
||||
#define LOG_LEVEL_INFO 1
|
||||
#define LOG_LEVEL_WARN 2
|
||||
#define LOG_LEVEL_ERROR 3
|
||||
|
||||
#define LOG_MACRO(level, prefix, out_stream, ...) do { \
|
||||
if (level == LOG_LEVEL_DEBUG && !g_verbose) break; \
|
||||
flockfile(out_stream); \
|
||||
fprintf(out_stream, "[VBX-%s] ", prefix); \
|
||||
fprintf(out_stream, __VA_ARGS__); \
|
||||
fprintf(out_stream, "\n"); \
|
||||
fflush(out_stream); \
|
||||
funlockfile(out_stream); \
|
||||
} while(0)
|
||||
|
||||
#define LOG_DEBUG(...) LOG_MACRO(LOG_LEVEL_DEBUG, "DEBUG", stdout, __VA_ARGS__)
|
||||
#define LOG_INFO(...) LOG_MACRO(LOG_LEVEL_INFO, "INFO", stdout, __VA_ARGS__)
|
||||
#define LOG_WARN(...) LOG_MACRO(LOG_LEVEL_WARN, "WARN", stderr, __VA_ARGS__)
|
||||
#define LOG_ERROR(...) LOG_MACRO(LOG_LEVEL_ERROR, "ERROR", stderr, __VA_ARGS__)
|
||||
#define LOG_PERROR(msg) LOG_MACRO(LOG_LEVEL_ERROR, "ERROR", stderr, "%s: %s", msg, strerror(errno))
|
||||
|
||||
#endif // VBX_LOG_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef VBX_MUTE_H
|
||||
#define VBX_MUTE_H
|
||||
|
||||
int read_runtime_mute_file(void);
|
||||
void write_runtime_mute_file(int mute);
|
||||
void write_runtime_keyboard_mute_file(int mute);
|
||||
void write_runtime_mouse_mute_file(int mute);
|
||||
|
||||
#endif // VBX_MUTE_H
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef VBX_UTILS_H
|
||||
#define VBX_UTILS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// Returns 1 on success, 0 on truncation/error
|
||||
int safe_snprintf(char *dst, size_t dst_sz, const char *fmt, ...);
|
||||
|
||||
// Common runtime helpers
|
||||
const char *get_runtime_dir(void);
|
||||
void build_pidfile_path(char *buffer, size_t buflen);
|
||||
int read_pidfile(const char *path, pid_t *out_pid);
|
||||
int write_pidfile(const char *path, pid_t pid);
|
||||
int process_is_running(pid_t pid);
|
||||
|
||||
// Runtime mute helpers
|
||||
int read_runtime_mute_file(void);
|
||||
void write_runtime_mute_file(int mute);
|
||||
void write_runtime_keyboard_mute_file(int mute);
|
||||
void write_runtime_mouse_mute_file(int mute);
|
||||
|
||||
// Runtime enabled helpers
|
||||
int write_runtime_keyboard_enabled_file(int enabled);
|
||||
int write_runtime_mouse_enabled_file(int enabled);
|
||||
|
||||
// System volume following helper
|
||||
int write_runtime_system_volume_following_file(int enabled);
|
||||
|
||||
// Helper functions
|
||||
void int_to_str(char *buffer, size_t size, int value);
|
||||
char *xstrdup(const char *s);
|
||||
int validate_volume(int volume);
|
||||
const char *get_home_dir(void);
|
||||
void safe_strncpy(char *dest, const char *src, size_t dest_size);
|
||||
void print_error_and_close_file(FILE *file, const char *error_msg, const char *filename);
|
||||
|
||||
// Safe wrapper functions for clang-tidy compliance
|
||||
int safe_fscanf(FILE *stream, const char *format, void *ptr);
|
||||
int safe_fprintf(FILE *stream, const char *format, ...);
|
||||
int safe_snprintf_wrapper(char *str, size_t size, const char *format, ...);
|
||||
void *safe_memcpy(void *dest, const void *src, size_t n);
|
||||
void *safe_memmove(void *dest, const void *src, size_t n);
|
||||
void *safe_memset(void *s, int c, size_t n);
|
||||
|
||||
#endif // VBX_UTILS_H
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
|
||||
#define PROJECT_VERSION "0.1.0"
|
||||
#define GETTEXT_PACKAGE "keyvibe"
|
||||
#define PROJECT_VERSION "1.1.0"
|
||||
#define GETTEXT_PACKAGE "vbx"
|
||||
#define PKEXEC_PATH "/usr/bin/pkexec"
|
||||
|
||||
// Prefix macro should be defined by compiler flags, fallback to /usr
|
||||
@@ -13,8 +13,8 @@
|
||||
#define PACKAGE_BINDIR PACKAGE_PREFIX "/bin"
|
||||
#define PACKAGE_LOCALEDIR PACKAGE_PREFIX "/share/locale"
|
||||
|
||||
// KeyVibe specific paths relative to prefix
|
||||
#define KeyVibe_DATA_DIR PACKAGE_PREFIX "/share/keyvibe"
|
||||
#define KeyVibe_BIN_DIR PACKAGE_PREFIX "/bin"
|
||||
// VBX specific paths relative to prefix
|
||||
#define VBX_DATA_DIR PACKAGE_PREFIX "/share/vbx"
|
||||
#define VBX_BIN_DIR PACKAGE_PREFIX "/bin"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef VBX_SOUNDPACKS_H
|
||||
#define VBX_SOUNDPACKS_H
|
||||
#include <stddef.h>
|
||||
|
||||
int resolve_keyboard_sound_base_dir(const char *sound_name, char *out_basedir,
|
||||
size_t out_sz);
|
||||
int resolve_mouse_sound_base_dir(const char *sound_name, char *out_basedir,
|
||||
size_t out_sz);
|
||||
int build_paths_for_keyboard_sound(const char *sound_name,
|
||||
char *out_config_path, size_t out_config_sz,
|
||||
char *out_sound_dir, size_t out_sound_sz);
|
||||
int build_paths_for_mouse_sound(const char *sound_name, char *out_config_path,
|
||||
size_t out_config_sz, char *out_sound_dir,
|
||||
size_t out_sound_sz);
|
||||
int validate_keyboard_sound_pack(const char *sound_name);
|
||||
int validate_mouse_sound_pack(const char *sound_name);
|
||||
int list_sound_packs(void);
|
||||
|
||||
#endif // VBX_SOUNDPACKS_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef VBX_CONFIG_IO_H
|
||||
#define VBX_CONFIG_IO_H
|
||||
#include <stddef.h>
|
||||
|
||||
// Resolve user config path: returns buffer on success, NULL on failure
|
||||
char *get_user_config_path(char *buffer, size_t buflen);
|
||||
|
||||
// Write ~/.vbx.json in new format
|
||||
int write_user_config(const char *path, const char *keyboard_sound,
|
||||
const char *mouse_sound, int keyboard_volume,
|
||||
int mouse_volume, int keyboard_enabled, int mouse_enabled,
|
||||
int system_volume_following);
|
||||
|
||||
// Read ~/.vbx.json supporting new and legacy formats
|
||||
int read_user_config(const char *path, char **out_keyboard_sound,
|
||||
char **out_mouse_sound, int *out_keyboard_volume,
|
||||
int *out_mouse_volume, int *out_keyboard_enabled, int *out_mouse_enabled,
|
||||
int *out_system_volume_following);
|
||||
|
||||
#endif // VBX_CONFIG_IO_H
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
#ifndef KEYVIBE_UTILS_H
|
||||
#define KEYVIBE_UTILS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// Returns 1 on success, 0 on truncation/error
|
||||
int safe_snprintf(char *dst, size_t dst_sz, const char *fmt, ...);
|
||||
|
||||
// fprintf to stderr with printf-style formatting. Returns 1 for convenient
|
||||
// `return errorf(...)` usage.
|
||||
int errorf(const char *fmt, ...);
|
||||
|
||||
// Common runtime helpers
|
||||
const char *get_runtime_dir(void);
|
||||
void build_pidfile_path(char *buffer, size_t buflen);
|
||||
int read_pidfile(const char *path, pid_t *out_pid);
|
||||
int write_pidfile(const char *path, pid_t pid);
|
||||
int process_is_running(pid_t pid);
|
||||
|
||||
#endif // KEYVIBE_UTILS_H
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -464,6 +464,18 @@
|
||||
"61011": [
|
||||
13964,
|
||||
113
|
||||
],
|
||||
"272": [
|
||||
971,
|
||||
142
|
||||
],
|
||||
"273": [
|
||||
1276,
|
||||
115
|
||||
],
|
||||
"274": [
|
||||
1604,
|
||||
122
|
||||
]
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"id": "custom-sound-pack-1203000000053",
|
||||
"name": "Kalih Box White",
|
||||
"key_define_type": "multi",
|
||||
"includes_numpad": false,
|
||||
"sound": "sound.ogg",
|
||||
"defines": {
|
||||
"1": "kboxwh - 08.mp3",
|
||||
"2": "kboxwh - 10.mp3",
|
||||
"3": "kboxwh - 06.mp3",
|
||||
"4": "kboxwh - 03.mp3",
|
||||
"5": "kboxwh - 02.mp3",
|
||||
"6": "kboxwh - 08.mp3",
|
||||
"7": "kboxwh - 07.mp3",
|
||||
"8": "kboxwh - 04.mp3",
|
||||
"9": "kboxwh - 01.mp3",
|
||||
"10": "kboxwh - 04.mp3",
|
||||
"11": "kboxwh - 02.mp3",
|
||||
"12": "Untitled Clip(6).mp3",
|
||||
"13": "Untitled Clip(5).mp3",
|
||||
"14": "Untitled Clip(3).mp3",
|
||||
"15": "Untitled Clip(4).mp3",
|
||||
"16": "kboxwh - 05.mp3",
|
||||
"17": "kboxwh - 01.mp3",
|
||||
"18": "kboxwh - 06.mp3",
|
||||
"19": "kboxwh - 07.mp3",
|
||||
"20": "kboxwh - 05.mp3",
|
||||
"21": "kboxwh - 03.mp3",
|
||||
"22": "kboxwh - 10.mp3",
|
||||
"23": "kboxwh - 01.mp3",
|
||||
"24": "kboxwh - 03.mp3",
|
||||
"25": "kboxwh - 06.mp3",
|
||||
"26": "Untitled Clip(5).mp3",
|
||||
"27": "Untitled Clip(6).mp3",
|
||||
"28": "enter.mp3",
|
||||
"29": "Untitled Clip(3).mp3",
|
||||
"30": "kboxwh - 02.mp3",
|
||||
"31": "kboxwh - 03.mp3",
|
||||
"32": "kboxwh - 04.mp3",
|
||||
"33": "kboxwh - 08.mp3",
|
||||
"34": "kboxwh - 06.mp3",
|
||||
"35": "kboxwh - 07.mp3",
|
||||
"36": "kboxwh - 01.mp3",
|
||||
"37": "Untitled Clip(3).mp3",
|
||||
"38": "kboxwh - 06.mp3",
|
||||
"39": "Untitled Clip(5).mp3",
|
||||
"40": "Untitled Clip(6).mp3",
|
||||
"41": "kboxwh - 09.mp3",
|
||||
"42": "Untitled Clip(5).mp3",
|
||||
"43": "enter.mp3",
|
||||
"44": "kboxwh - 06.mp3",
|
||||
"45": "kboxwh - 04.mp3",
|
||||
"46": "kboxwh - 09.mp3",
|
||||
"47": "kboxwh - 10.mp3",
|
||||
"48": "kboxwh - 02.mp3",
|
||||
"49": "kboxwh - 09.mp3",
|
||||
"50": "kboxwh - 08.mp3",
|
||||
"51": "Untitled Clip(7).mp3",
|
||||
"52": "Untitled Clip(7).mp3",
|
||||
"53": "kboxwh - 04.mp3",
|
||||
"54": "Untitled Clip(5).mp3",
|
||||
"55": "Untitled Clip(6).mp3",
|
||||
"56": "alt.mp3",
|
||||
"57": "Untitled Clip.mp3",
|
||||
"58": "Untitled Clip(6).mp3",
|
||||
"59": "kboxwh - 10.mp3",
|
||||
"60": "kboxwh - 09.mp3",
|
||||
"61": "kboxwh - 08.mp3",
|
||||
"62": "kboxwh - 07.mp3",
|
||||
"63": "kboxwh - 06.mp3",
|
||||
"64": "kboxwh - 05.mp3",
|
||||
"65": "kboxwh - 04.mp3",
|
||||
"66": "kboxwh - 03.mp3",
|
||||
"67": "kboxwh - 01.mp3",
|
||||
"68": "kboxwh - 02.mp3",
|
||||
"69": "Untitled Clip(5).mp3",
|
||||
"70": null,
|
||||
"71": "kboxwh - 08.mp3",
|
||||
"72": "kboxwh - 07.mp3",
|
||||
"73": "kboxwh - 03.mp3",
|
||||
"74": "Untitled Clip(6).mp3",
|
||||
"75": "kboxwh - 09.mp3",
|
||||
"76": "kboxwh - 01.mp3",
|
||||
"77": "kboxwh - 09.mp3",
|
||||
"78": "Untitled Clip(6).mp3",
|
||||
"79": "kboxwh - 09.mp3",
|
||||
"80": "kboxwh - 03.mp3",
|
||||
"81": "kboxwh - 04.mp3",
|
||||
"82": "kboxwh - 02.mp3",
|
||||
"83": "Untitled Clip(7).mp3",
|
||||
"87": "kboxwh - 06.mp3",
|
||||
"88": "kboxwh - 04.mp3",
|
||||
"91": null,
|
||||
"92": null,
|
||||
"93": null,
|
||||
"3597": null,
|
||||
"3612": "enter.mp3",
|
||||
"3613": "Untitled Clip(3).mp3",
|
||||
"3637": "Untitled Clip(6).mp3",
|
||||
"3639": null,
|
||||
"3640": "alt.mp3",
|
||||
"3653": null,
|
||||
"3655": null,
|
||||
"3657": null,
|
||||
"3663": null,
|
||||
"3665": null,
|
||||
"3666": null,
|
||||
"3667": null,
|
||||
"3675": "Untitled Clip(7).mp3",
|
||||
"3676": "Untitled Clip(7).mp3",
|
||||
"3677": "Untitled Clip(3).mp3",
|
||||
"57416": "kboxwh - 01.mp3",
|
||||
"57419": "kboxwh - 02.mp3",
|
||||
"57421": "kboxwh - 04.mp3",
|
||||
"57424": "kboxwh - 03.mp3",
|
||||
"60999": null,
|
||||
"61000": "kboxwh - 01.mp3",
|
||||
"61001": null,
|
||||
"61003": "kboxwh - 02.mp3",
|
||||
"61005": "kboxwh - 04.mp3",
|
||||
"61007": null,
|
||||
"61008": "kboxwh - 03.mp3",
|
||||
"61009": null,
|
||||
"61010": null,
|
||||
"61011": null
|
||||
},
|
||||
"_zip": "kailh-box-white.zip",
|
||||
"group": "1fMFAp - sOcaAT - MuxCD - GlHmN3",
|
||||
"description": "Kailh Box White switches with individual sounds per keypress and no background noises.",
|
||||
"m_author": "edy.",
|
||||
"tags": [
|
||||
"keyboard",
|
||||
"clicky"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 202 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user