diff options
author | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-06-02 14:54:21 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-06-02 14:54:21 +0200 |
commit | 51d34b662e95399ca23caededa9f61f7a7e1dca3 (patch) | |
tree | a5ca20235b4f0feb93ef071df2db8018d46b8f83 /include | |
parent | 6fefbbf8ab47b87fc4cb4a70f82c7bcc0b91587b (diff) |
helper: Add API to support startup notification
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/display.h | 10 | ||||
-rw-r--r-- | include/helper.h | 28 |
2 files changed, 36 insertions, 2 deletions
diff --git a/include/display.h b/include/display.h index b0feb8c7..a6977808 100644 --- a/include/display.h +++ b/include/display.h @@ -29,6 +29,7 @@ #define ROFI_DISPLAY_H #include <glib.h> +#include "helper.h" #include "nkutils-bindings.h" /** @@ -63,4 +64,13 @@ void display_cleanup(void); */ void display_dump_monitor_layout ( void ); +/** + * @param context The startup notification context for the application to launch + * @param child_setup A pointer to return the child setup function + * @param user_data A pointer to return the child setup function user_data + * + * Provides the needed child setup function + */ +void display_startup_notification ( RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data ); + #endif diff --git a/include/helper.h b/include/helper.h index de9419dd..1b75f6c8 100644 --- a/include/helper.h +++ b/include/helper.h @@ -260,26 +260,50 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st int utf8_strncmp ( const char *a, const char* b, size_t n ) __attribute__( ( nonnull ( 1, 2 ) ) ); /** + * The startup notification context of the application to launch + */ +typedef struct +{ + /** The name of the application */ + const gchar *name; + /** The binary name of the application */ + const gchar *binary; + /** The description of the launch */ + const gchar *description; + /** The icon name of the application */ + const gchar *icon; + /** The application id (desktop file with the .desktop suffix) */ + const gchar *app_id; + /** The window manager class of the application */ + const gchar *wmclass; + /** The command we run */ + const gchar *command; +} RofiHelperExecuteContext; + +/** * @param args The arguments of the command to exec. * @param error_precmd Prefix to error message command. * @param error_cmd Error message command + * @param context The startup notification context, if any * * Executes the command * * @returns TRUE when successful, FALSE when failed. */ -gboolean helper_execute ( const char *wd, char **args, const char *error_precmd, const char *error_cmd ); +gboolean helper_execute ( const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context ); /** * @param wd The work directory (optional) * @param cmd The cmd to execute * @param run_in_term Indicate if command should be run in a terminal + * @param context The startup notification context, if any * * Execute command. + * If needed members of @param context are NULL, they will be filled. * * @returns FALSE On failure, TRUE on success */ -gboolean helper_execute_command ( const char *wd, const char *cmd, int run_in_term ); +gboolean helper_execute_command ( const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context ); /** * @param file The file path |