rebranding
This commit is contained in:
19 files changed
+89
-90
No files matched your search
+9
-9
@@ -21,7 +21,7 @@ volatile sig_atomic_t reload_requested = 0;
|
||||
void cleanup_processes(int sig) {
|
||||
(void)sig;
|
||||
if (!is_daemon) {
|
||||
printf("\nShutting down KeyVibe...\n");
|
||||
printf("\nShutting down VBX...\n");
|
||||
}
|
||||
if (sound_pid > 0) {
|
||||
kill(sound_pid, SIGTERM);
|
||||
@@ -42,7 +42,7 @@ int require_running_pid(pid_t *out_pid) {
|
||||
pid_t running_pid = 0;
|
||||
if (!read_pidfile(pidfile_path, &running_pid) ||
|
||||
!process_is_running(running_pid)) {
|
||||
fprintf(stderr, "KeyVibe: not running.\n");
|
||||
fprintf(stderr, "VBX: not running.\n");
|
||||
return 0;
|
||||
}
|
||||
*out_pid = running_pid;
|
||||
@@ -108,8 +108,8 @@ int start_children(const char *sound_dir, const char *config_path, int volume,
|
||||
return 0;
|
||||
}
|
||||
char sound_player_path[MAX_PATH_LENGTH];
|
||||
snprintf(sound_player_path, sizeof(sound_player_path), "%s/keyvibe-audio",
|
||||
KeyVibe_BIN_DIR);
|
||||
snprintf(sound_player_path, sizeof(sound_player_path), "%s/vbx-audio",
|
||||
VBX_BIN_DIR);
|
||||
if (sound_pid == 0) {
|
||||
close(pipefd[1]);
|
||||
dup2(pipefd[0], STDIN_FILENO);
|
||||
@@ -131,11 +131,11 @@ int start_children(const char *sound_dir, const char *config_path, int volume,
|
||||
int_to_str(keyboard_enabled_str, sizeof(keyboard_enabled_str), keyboard_enabled);
|
||||
int_to_str(mouse_enabled_str, sizeof(mouse_enabled_str), mouse_enabled);
|
||||
|
||||
execl(sound_player_path, "keyvibe-audio", "config.json", volume_str,
|
||||
execl(sound_player_path, "vbx-audio", "config.json", volume_str,
|
||||
verbose_str, mute_str, mouse_config_path, mouse_volume_str,
|
||||
keyboard_mute_str, mouse_mute_str, keyboard_enabled_str,
|
||||
mouse_enabled_str, (char *)NULL);
|
||||
perror("execl keyvibe-audio");
|
||||
perror("execl vbx-audio");
|
||||
exit(1);
|
||||
}
|
||||
keyboard_pid = fork();
|
||||
@@ -148,13 +148,13 @@ int start_children(const char *sound_dir, const char *config_path, int volume,
|
||||
}
|
||||
char get_key_presses_path[MAX_PATH_LENGTH];
|
||||
snprintf(get_key_presses_path, sizeof(get_key_presses_path),
|
||||
"%s/keyvibe-input", KeyVibe_BIN_DIR);
|
||||
"%s/vbx-input", VBX_BIN_DIR);
|
||||
if (keyboard_pid == 0) {
|
||||
close(pipefd[0]);
|
||||
dup2(pipefd[1], STDOUT_FILENO);
|
||||
close(pipefd[1]);
|
||||
execl(get_key_presses_path, "keyvibe-input", (char *)NULL);
|
||||
perror("execl keyvibe-input");
|
||||
execl(get_key_presses_path, "vbx-input", (char *)NULL);
|
||||
perror("execl vbx-input");
|
||||
exit(1);
|
||||
}
|
||||
close(pipefd[0]);
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ static int read_runtime_state(const char *filename_suffix, int default_value) {
|
||||
if (!rd || strlen(rd) == 0) {
|
||||
rd = "/tmp";
|
||||
}
|
||||
if (!safe_snprintf(state_file, sizeof(state_file), "%s/keyvibe-%s-%d", rd,
|
||||
if (!safe_snprintf(state_file, sizeof(state_file), "%s/vbx-%s-%d", rd,
|
||||
filename_suffix, (int)getuid())) {
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static void set_volume(int *volume_ptr, int value) {
|
||||
}
|
||||
|
||||
void print_usage(const char *program_name) {
|
||||
printf("KeyVibe - Mechanical Keyboard Sound Simulator\n");
|
||||
printf("VBX - Mechanical Keyboard Sound Simulator\n");
|
||||
printf("Version: %s\n\n", PROJECT_VERSION);
|
||||
|
||||
printf("USAGE:\n");
|
||||
@@ -79,7 +79,7 @@ void print_usage(const char *program_name) {
|
||||
printf(" %s --keyboard-volume 80 --mouse-volume 60 # Different volumes\n",
|
||||
program_name);
|
||||
printf("\n");
|
||||
printf("CONFIG: Settings are saved to ~/.keyvibe.json and auto-reload in "
|
||||
printf("CONFIG: Settings are saved to ~/.vbx.json and auto-reload in "
|
||||
"daemon mode.\n");
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ int read_runtime_mute_file() {
|
||||
const char *rd = getenv("XDG_RUNTIME_DIR");
|
||||
if (!rd || strlen(rd) == 0)
|
||||
rd = "/tmp";
|
||||
if (!safe_snprintf(mute_file, sizeof(mute_file), "%s/keyvibe-mute-%d", rd,
|
||||
if (!safe_snprintf(mute_file, sizeof(mute_file), "%s/vbx-mute-%d", rd,
|
||||
(int)getuid()))
|
||||
return 0;
|
||||
FILE *f = fopen(mute_file, "r");
|
||||
@@ -34,7 +34,7 @@ static void write_runtime_state_file(const char *filename_suffix, int value) {
|
||||
const char *rd = getenv("XDG_RUNTIME_DIR");
|
||||
if (!rd || strlen(rd) == 0)
|
||||
rd = "/tmp";
|
||||
if (!safe_snprintf(state_file, sizeof(state_file), "%s/keyvibe-%s-%d", rd,
|
||||
if (!safe_snprintf(state_file, sizeof(state_file), "%s/vbx-%s-%d", rd,
|
||||
filename_suffix, (int)getuid()))
|
||||
return;
|
||||
FILE *f = fopen(state_file, "w");
|
||||
@@ -83,7 +83,7 @@ const char *get_runtime_dir(void) {
|
||||
|
||||
void build_pidfile_path(char *buffer, size_t buflen) {
|
||||
const char *rd = get_runtime_dir();
|
||||
safe_snprintf(buffer, buflen, "%s/keyvibe-%d.pid", rd, (int)getuid());
|
||||
safe_snprintf(buffer, buflen, "%s/vbx-%d.pid", rd, (int)getuid());
|
||||
}
|
||||
|
||||
int read_pidfile(const char *path, pid_t *out_pid) {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ char *get_user_config_path(char *buffer, size_t buflen) {
|
||||
const char *home = get_home_dir();
|
||||
if (!home)
|
||||
return NULL;
|
||||
if (!safe_snprintf(buffer, buflen, "%s/%s", home, ".keyvibe.json"))
|
||||
if (!safe_snprintf(buffer, buflen, "%s/%s", home, ".vbx.json"))
|
||||
return NULL;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
+14
-14
@@ -29,12 +29,12 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_PATH_LENGTH 1024
|
||||
#define AUDIO_BASE_DIR KeyVibe_DATA_DIR "/soundpacks"
|
||||
#define AUDIO_BASE_DIR VBX_DATA_DIR "/soundpacks"
|
||||
#define KEYBOARD_AUDIO_DIR AUDIO_BASE_DIR "/keyboard"
|
||||
#define MOUSE_AUDIO_DIR AUDIO_BASE_DIR "/mouse"
|
||||
#define USER_KEYBOARD_AUDIO_SUBPATH "/.local/share/keyvibe/soundpacks/keyboard"
|
||||
#define USER_MOUSE_AUDIO_SUBPATH "/.local/share/keyvibe/soundpacks/mouse"
|
||||
#define USER_CONFIG_FILENAME ".keyvibe.json"
|
||||
#define USER_KEYBOARD_AUDIO_SUBPATH "/.local/share/vbx/soundpacks/keyboard"
|
||||
#define USER_MOUSE_AUDIO_SUBPATH "/.local/share/vbx/soundpacks/mouse"
|
||||
#define USER_CONFIG_FILENAME ".vbx.json"
|
||||
|
||||
extern pid_t keyboard_pid;
|
||||
extern pid_t sound_pid;
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
|
||||
for (int i = 0; i < 30; i++) {
|
||||
if (!process_is_running(running_pid)) {
|
||||
unlink(pidfile_path);
|
||||
printf("KeyVibe stopped.\n");
|
||||
printf("VBX stopped.\n");
|
||||
if (sound_name_owned) {
|
||||
free(sound_name);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ int main(int argc, char *argv[]) {
|
||||
if (mouse_sound_name_owned) {
|
||||
free(mouse_sound_name);
|
||||
}
|
||||
return errorf("KeyVibe: process did not stop in time\n");
|
||||
return errorf("VBX: process did not stop in time\n");
|
||||
}
|
||||
current_mute = read_runtime_mute_file();
|
||||
|
||||
@@ -288,9 +288,9 @@ int main(int argc, char *argv[]) {
|
||||
char get_key_presses_path[MAX_PATH_LENGTH];
|
||||
char sound_player_path[MAX_PATH_LENGTH];
|
||||
safe_snprintf_wrapper(get_key_presses_path, sizeof(get_key_presses_path),
|
||||
"%s/keyvibe-input", KeyVibe_BIN_DIR);
|
||||
safe_snprintf_wrapper(sound_player_path, sizeof(sound_player_path), "%s/keyvibe-audio",
|
||||
KeyVibe_BIN_DIR);
|
||||
"%s/vbx-input", VBX_BIN_DIR);
|
||||
safe_snprintf_wrapper(sound_player_path, sizeof(sound_player_path), "%s/vbx-audio",
|
||||
VBX_BIN_DIR);
|
||||
if (access(get_key_presses_path, X_OK) != 0 ||
|
||||
access(sound_player_path, X_OK) != 0) {
|
||||
if (sound_name_owned) {
|
||||
@@ -300,7 +300,7 @@ int main(int argc, char *argv[]) {
|
||||
free(mouse_sound_name);
|
||||
}
|
||||
return errorf("Error: Cannot find or execute required binaries in %s\n",
|
||||
KeyVibe_BIN_DIR);
|
||||
VBX_BIN_DIR);
|
||||
}
|
||||
signal(SIGINT, cleanup_processes);
|
||||
signal(SIGTERM, cleanup_processes);
|
||||
@@ -314,7 +314,7 @@ int main(int argc, char *argv[]) {
|
||||
free(mouse_sound_name);
|
||||
}
|
||||
safe_fprintf(stderr,
|
||||
"KeyVibe already running (pid %ld). Use --stop to stop it.\n",
|
||||
"VBX already running (pid %ld). Use --stop to stop it.\n",
|
||||
(long)existing);
|
||||
return 1;
|
||||
}
|
||||
@@ -358,7 +358,7 @@ int main(int argc, char *argv[]) {
|
||||
safe_strncpy(current_mouse_config_path, mouse_config_path, sizeof(current_mouse_config_path));
|
||||
safe_strncpy(current_mouse_sound_dir, mouse_sound_dir, sizeof(current_mouse_sound_dir));
|
||||
if (verbose && !is_daemon) {
|
||||
printf("KeyVibe starting...\n");
|
||||
printf("VBX starting...\n");
|
||||
printf("Keyboard sound pack: %s\n", sound_name);
|
||||
printf("Mouse sound pack: %s\n", mouse_sound_name);
|
||||
printf("Keyboard config file: %s\n", config_path);
|
||||
@@ -368,7 +368,7 @@ int main(int argc, char *argv[]) {
|
||||
printf("Press Ctrl+C to exit.\n\n");
|
||||
} else {
|
||||
if (!is_daemon) {
|
||||
printf("KeyVibe started with keyboard sound pack: %s, mouse sound pack: "
|
||||
printf("VBX started with keyboard sound pack: %s, mouse sound pack: "
|
||||
"%s\n",
|
||||
sound_name, mouse_sound_name);
|
||||
printf("Press Ctrl+C to exit.\n");
|
||||
@@ -443,7 +443,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
if (!is_daemon) {
|
||||
printf("KeyVibe exited.\n");
|
||||
printf("VBX exited.\n");
|
||||
}
|
||||
if (sound_name_owned) {
|
||||
free(sound_name);
|
||||
|
||||
+3
-3
@@ -10,11 +10,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define AUDIO_BASE_DIR KeyVibe_DATA_DIR "/soundpacks"
|
||||
#define AUDIO_BASE_DIR VBX_DATA_DIR "/soundpacks"
|
||||
#define KEYBOARD_AUDIO_DIR AUDIO_BASE_DIR "/keyboard"
|
||||
#define MOUSE_AUDIO_DIR AUDIO_BASE_DIR "/mouse"
|
||||
#define USER_KEYBOARD_AUDIO_SUBPATH "/.local/share/keyvibe/soundpacks/keyboard"
|
||||
#define USER_MOUSE_AUDIO_SUBPATH "/.local/share/keyvibe/soundpacks/mouse"
|
||||
#define USER_KEYBOARD_AUDIO_SUBPATH "/.local/share/vbx/soundpacks/keyboard"
|
||||
#define USER_MOUSE_AUDIO_SUBPATH "/.local/share/vbx/soundpacks/mouse"
|
||||
|
||||
static void get_user_keyboard_audio_dir(char *buffer, size_t buflen) {
|
||||
buffer[0] = '\0';
|
||||
|
||||
Reference in new issue
Block a user