Moved to a synchronous based launch of desktop apps as async was causing mysterious hangs in GIO for some people
This commit is contained in:
parent
ea9631678b
commit
acb335d01b
21
modes/drun.c
21
modes/drun.c
@ -373,21 +373,6 @@ struct widget* wofi_drun_get_widget(void) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void launch_done(GObject* obj, GAsyncResult* result, gpointer data) {
|
|
||||||
GError* err = NULL;
|
|
||||||
if(g_app_info_launch_uris_finish(G_APP_INFO(obj), result, &err)) {
|
|
||||||
exit(0);
|
|
||||||
} else if(err != NULL) {
|
|
||||||
char* cmd = data;
|
|
||||||
fprintf(stderr, "%s cannot be executed: %s\n", cmd, err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
} else {
|
|
||||||
char* cmd = data;
|
|
||||||
fprintf(stderr, "%s cannot be executed\n", cmd);
|
|
||||||
}
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_dri_prime(GDesktopAppInfo* info) {
|
static void set_dri_prime(GDesktopAppInfo* info) {
|
||||||
bool dri_prime = g_desktop_app_info_get_boolean(info, "PrefersNonDefaultGPU");
|
bool dri_prime = g_desktop_app_info_get_boolean(info, "PrefersNonDefaultGPU");
|
||||||
if(dri_prime) {
|
if(dri_prime) {
|
||||||
@ -404,7 +389,7 @@ void wofi_drun_exec(const gchar* cmd) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
set_dri_prime(info);
|
set_dri_prime(info);
|
||||||
g_app_info_launch_uris_async(G_APP_INFO(info), NULL, NULL, NULL, launch_done, (gchar*) cmd);
|
g_app_info_launch_uris(G_APP_INFO(info), NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
} else if(strrchr(cmd, ' ') != NULL) {
|
} else if(strrchr(cmd, ' ') != NULL) {
|
||||||
char* space = strrchr(cmd, ' ');
|
char* space = strrchr(cmd, ' ');
|
||||||
@ -418,13 +403,13 @@ void wofi_drun_exec(const gchar* cmd) {
|
|||||||
} else {
|
} else {
|
||||||
set_dri_prime(info);
|
set_dri_prime(info);
|
||||||
g_desktop_app_info_launch_action(info, action, NULL);
|
g_desktop_app_info_launch_action(info, action, NULL);
|
||||||
utils_sleep_millis(500);
|
|
||||||
}
|
}
|
||||||
exit(0);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s cannot be executed\n", cmd);
|
fprintf(stderr, "%s cannot be executed\n", cmd);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
utils_sleep_millis(100);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char** wofi_drun_get_arg_names(void) {
|
const char** wofi_drun_get_arg_names(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user