From 9aa93ed2725f6dff9ebf964bc1e0f05258ed5452 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Sun, 25 Dec 2022 15:54:50 -0800 Subject: [PATCH] Added the config option drun-disable_prime to disable prime GPU offloading --- man/wofi.7 | 3 +++ modes/drun.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/man/wofi.7 b/man/wofi.7 index 8d1ce0f..8acf101 100644 --- a/man/wofi.7 +++ b/man/wofi.7 @@ -53,6 +53,9 @@ If true the command used to launch the desktop file will be printed to stdout in .TP .B display_generic=\fIBOOL\fR If true then generic names will be displayed in () next to the application name, default is false. +.TP +.B disable_prime=\fIBOOL\fR +If true then wofi will ignore the PrefersNonDefaultGPU desktop variable, specifically this prevents wofi from setting DRI_PRIME, default is false. .SH DRUN When images are enabled drun mode will pull icon themes however being a GTK app it's possible you'll need to run gtk\-update\-icon\-cache to get them to apply. diff --git a/modes/drun.c b/modes/drun.c index e4d9ca8..14aedc8 100644 --- a/modes/drun.c +++ b/modes/drun.c @@ -29,7 +29,7 @@ #include #include -static const char* arg_names[] = {"print_command", "display_generic"}; +static const char* arg_names[] = {"print_command", "display_generic", "disable_prime"}; static struct mode* mode; @@ -43,6 +43,7 @@ static struct wl_list desktop_entries; static bool print_command; static bool display_generic; +static bool disable_prime; static char* get_search_text(char* file) { GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(file); @@ -335,6 +336,7 @@ void wofi_drun_init(struct mode* this, struct map* config) { print_command = strcmp(config_get(config, "print_command", "false"), "true") == 0; display_generic = strcmp(config_get(config, "display_generic", "false"), "true") == 0; + disable_prime = strcmp(config_get(config, "disable_prime", "false"), "true") == 0; entries = map_init(); struct wl_list* cache = wofi_read_cache(mode); @@ -407,7 +409,7 @@ static void launch_done(GObject* obj, GAsyncResult* result, gpointer data) { static void set_dri_prime(GDesktopAppInfo* info) { bool dri_prime = g_desktop_app_info_get_boolean(info, "PrefersNonDefaultGPU"); - if(dri_prime) { + if(dri_prime && !disable_prime) { setenv("DRI_PRIME", "1", true); } }