feat(include): add system volume following support
Implement configurable system volume following and replace JSON IPC with binary struct. - New Feature: Introduce `system_volume_following` CLI and runtime option. - Enhancement: Extend CLI options, reload, and user‑config APIs to propagate the new flag. - Enhancement: Add `VbxEvent` binary IPC struct and logging macros for better performance. - Enhancement: Add helper to persist system volume following state. - Bug Fix: Remove stale `parse_keyboard_event` prototype.
This commit is contained in:
9 files changed
+57
-6
No files matched your search
@@ -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,29 @@
|
||||
#ifndef VBX_LOG_H
|
||||
#define VBX_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.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; \
|
||||
fprintf(out_stream, "[VBX-%s] ", prefix); \
|
||||
fprintf(out_stream, __VA_ARGS__); \
|
||||
fprintf(out_stream, "\n"); \
|
||||
fflush(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__)
|
||||
|
||||
#endif // VBX_LOG_H
|
||||
@@ -29,6 +29,9 @@ void write_runtime_mouse_mute_file(int mute);
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user