mirror of
https://gitlab.com/thebiblelover7/dotfiles.git
synced 2025-12-14 04:03:50 +00:00
Clean up, update configs to be actually useful now...
This commit is contained in:
31
.config/sketchybar/helper/helper.c
Normal file
31
.config/sketchybar/helper/helper.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user