Clean up, update configs to be actually useful now...

This commit is contained in:
Adriel Sand
2024-01-04 18:49:24 -08:00
parent 68d016d03e
commit c93f5d7caa
412 changed files with 4462 additions and 63004 deletions

View File

@@ -0,0 +1,31 @@
#include "cpu.h"
#include "sketchybar.h"
struct cpu g_cpu;
void handler(env env) {
// Environment variables passed from sketchybar can be accessed as seen below
char* name = env_get_value_for_key(env, "NAME");
char* sender = env_get_value_for_key(env, "SENDER");
char* info = env_get_value_for_key(env, "INFO");
char* selected = env_get_value_for_key(env, "SELECTED");
if ((strcmp(name, "cpu.percent") == 0)) {
// CPU graph updates
cpu_update(&g_cpu);
if (strlen(g_cpu.command) > 0) sketchybar(g_cpu.command);
}
}
int main (int argc, char** argv) {
cpu_init(&g_cpu);
if (argc < 2) {
printf("Usage: helper \"<bootstrap name>\"\n");
exit(1);
}
event_server_begin(handler, argv[1]);
return 0;
}