Added the drun-print_desktop_file option
This commit is contained in:
parent
3410f97499
commit
1f5161eb66
@ -56,6 +56,9 @@ If true then generic names will be displayed in () next to the application name,
|
|||||||
.TP
|
.TP
|
||||||
.B disable_prime=\fIBOOL\fR
|
.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.
|
If true then wofi will ignore the PrefersNonDefaultGPU desktop variable, specifically this prevents wofi from setting DRI_PRIME, default is false.
|
||||||
|
.TP
|
||||||
|
.B print_desktop_file=\fIBOOL\fR
|
||||||
|
If true the path to the desktop file and the name of the corresponding action(if present) will be printed to stdout instead of invoking it, default is false.
|
||||||
|
|
||||||
.SH DRUN
|
.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.
|
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.
|
||||||
|
10
modes/drun.c
10
modes/drun.c
@ -29,7 +29,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
|
|
||||||
static const char* arg_names[] = {"print_command", "display_generic", "disable_prime"};
|
static const char* arg_names[] = {"print_command", "display_generic", "disable_prime", "print_desktop_file"};
|
||||||
|
|
||||||
static struct mode* mode;
|
static struct mode* mode;
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ static struct wl_list desktop_entries;
|
|||||||
static bool print_command;
|
static bool print_command;
|
||||||
static bool display_generic;
|
static bool display_generic;
|
||||||
static bool disable_prime;
|
static bool disable_prime;
|
||||||
|
static bool print_desktop_file;
|
||||||
|
|
||||||
static char* get_search_text(char* file) {
|
static char* get_search_text(char* file) {
|
||||||
GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(file);
|
GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(file);
|
||||||
@ -338,6 +339,7 @@ void wofi_drun_init(struct mode* this, struct map* config) {
|
|||||||
print_command = strcmp(config_get(config, "print_command", "false"), "true") == 0;
|
print_command = strcmp(config_get(config, "print_command", "false"), "true") == 0;
|
||||||
display_generic = strcmp(config_get(config, "display_generic", "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;
|
disable_prime = strcmp(config_get(config, "disable_prime", "false"), "true") == 0;
|
||||||
|
print_desktop_file = strcmp(config_get(config, "print_desktop_file", "false"), "true") == 0;
|
||||||
|
|
||||||
entries = map_init();
|
entries = map_init();
|
||||||
struct wl_list* cache = wofi_read_cache(mode);
|
struct wl_list* cache = wofi_read_cache(mode);
|
||||||
@ -448,6 +450,9 @@ void wofi_drun_exec(const gchar* cmd) {
|
|||||||
printf("%s\n", cmd);
|
printf("%s\n", cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
} else if(print_desktop_file) {
|
||||||
|
printf("%s\n", cmd);
|
||||||
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
set_dri_prime(info);
|
set_dri_prime(info);
|
||||||
if(uses_dbus(info)) {
|
if(uses_dbus(info)) {
|
||||||
@ -468,6 +473,9 @@ void wofi_drun_exec(const gchar* cmd) {
|
|||||||
printf("%s\n", cmd);
|
printf("%s\n", cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
fprintf(stderr, "Printing the command line for an action is not supported\n");
|
fprintf(stderr, "Printing the command line for an action is not supported\n");
|
||||||
|
} else if(print_desktop_file) {
|
||||||
|
printf("%s %s\n", cmd, action);
|
||||||
|
exit(0);
|
||||||
} 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user