mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 13:54:16 +00:00
force events to run regardless of previous state via --update
This commit is contained in:
parent
f4b439e686
commit
bf939fa5ae
4 changed files with 9 additions and 1 deletions
|
@ -6,7 +6,7 @@ extern int g_connection;
|
|||
extern bool g_brightness_events;
|
||||
|
||||
|
||||
float g_last_brightness = -1;
|
||||
float g_last_brightness = -1.f;
|
||||
static void brightness_handler(void* notification_center, uint32_t did, void* name, const void* sender, CFDictionaryRef info) {
|
||||
float* brightness = malloc(sizeof(float));
|
||||
memset(brightness, 0, sizeof(float));
|
||||
|
@ -256,6 +256,7 @@ bool display_end() {
|
|||
}
|
||||
|
||||
void forced_brightness_event() {
|
||||
g_last_brightness = -1.f;
|
||||
brightness_handler(NULL, display_active_display_id(), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ void power_handler(void* context) {
|
|||
}
|
||||
|
||||
void forced_power_event() {
|
||||
g_power_source = 0;
|
||||
power_handler(NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ OSStatus device_changed(AudioObjectID id, uint32_t address_count, const AudioObj
|
|||
}
|
||||
|
||||
void forced_volume_event() {
|
||||
g_last_volume = -1.f;
|
||||
handler(g_audio_id, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ void update_ssid(SCDynamicStoreRef store, CFArrayRef keys, void* info) {
|
|||
ssid[[data length]] = '\0';
|
||||
|
||||
if (!g_current_ssid || strcmp(g_current_ssid, ssid) != 0) {
|
||||
if (g_current_ssid) free(g_current_ssid);
|
||||
g_current_ssid = string_copy(ssid);
|
||||
|
||||
struct event *event = event_create(&g_event_loop,
|
||||
WIFI_CHANGED,
|
||||
(void *) ssid );
|
||||
|
@ -23,6 +26,8 @@ void update_ssid(SCDynamicStoreRef store, CFArrayRef keys, void* info) {
|
|||
}
|
||||
|
||||
void forced_network_event() {
|
||||
if (g_current_ssid) free(g_current_ssid);
|
||||
g_current_ssid = NULL;
|
||||
update_ssid(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue