mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-27 05:40:17 +00:00
harden app name passing
This commit is contained in:
parent
aeb5771b87
commit
bf82350f51
2 changed files with 7 additions and 3 deletions
|
@ -396,7 +396,7 @@ void bar_manager_handle_mouse_exited(struct bar_manager* bar_manager) {
|
|||
void bar_manager_handle_front_app_switch(struct bar_manager* bar_manager, char* info) {
|
||||
struct env_vars env_vars;
|
||||
env_vars_init(&env_vars);
|
||||
env_vars_set(&env_vars, string_copy("INFO"), info);
|
||||
if (info) env_vars_set(&env_vars, string_copy("INFO"), info);
|
||||
bar_manager_custom_events_trigger(bar_manager, COMMAND_SUBSCRIBE_FRONT_APP_SWITCHED, &env_vars);
|
||||
env_vars_destroy(&env_vars);
|
||||
}
|
||||
|
|
|
@ -86,8 +86,12 @@ void workspace_create_custom_observer (void **context, char* notification) {
|
|||
}
|
||||
|
||||
- (void)appSwitched:(NSNotification *)notification {
|
||||
NSRunningApplication *app = [notification.userInfo objectForKey:NSWorkspaceApplicationKey];
|
||||
struct event *event = event_create(&g_event_loop, APPLICATION_FRONT_SWITCHED, string_copy((char*)[[app localizedName] UTF8String]));
|
||||
char* name = NULL;
|
||||
if (notification && notification.userInfo) {
|
||||
NSRunningApplication* app = [notification.userInfo objectForKey:NSWorkspaceApplicationKey];
|
||||
if (app) name = string_copy((char*)[[app localizedName] UTF8String]);
|
||||
}
|
||||
struct event *event = event_create(&g_event_loop, APPLICATION_FRONT_SWITCHED, name);
|
||||
event_loop_post(&g_event_loop, event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue