mirror of https://github.com/davatorium/rofi.git
Merge remote-tracking branch 'origin/master' into barview
This commit is contained in:
commit
4cd2d87ed2
|
@ -29,6 +29,7 @@
|
||||||
#define ROFI_DISPLAY_H
|
#define ROFI_DISPLAY_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "helper.h"
|
||||||
#include "nkutils-bindings.h"
|
#include "nkutils-bindings.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,4 +64,13 @@ void display_cleanup(void);
|
||||||
*/
|
*/
|
||||||
void display_dump_monitor_layout ( 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
|
#endif
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string The input string.
|
* @param string The input string.
|
||||||
* @param output Pointer to 2 dimensional array with parsed string.
|
* @param output Pointer to 2 dimensional array with parsed string.
|
||||||
|
@ -258,16 +259,51 @@ 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 ) ) );
|
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, RofiHelperExecuteContext *context );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wd The work directory (optional)
|
* @param wd The work directory (optional)
|
||||||
* @param cmd The cmd to execute
|
* @param cmd The cmd to execute
|
||||||
* @param run_in_term Indicate if command should be run in a terminal
|
* @param run_in_term Indicate if command should be run in a terminal
|
||||||
|
* @param context The startup notification context, if any
|
||||||
*
|
*
|
||||||
* Execute command.
|
* Execute command.
|
||||||
|
* If needed members of @param context are NULL, they will be filled.
|
||||||
*
|
*
|
||||||
* @returns FALSE On failure, TRUE on success
|
* @returns FALSE On failure, TRUE on success
|
||||||
*/
|
*/
|
||||||
int 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
|
* @param file The file path
|
||||||
|
|
|
@ -57,9 +57,10 @@ struct _xcb_stuff
|
||||||
uint8_t first_event;
|
uint8_t first_event;
|
||||||
/** Keyboard device id */
|
/** Keyboard device id */
|
||||||
int32_t device_id;
|
int32_t device_id;
|
||||||
} xkb;
|
} xkb;
|
||||||
NkBindingsSeat *bindings_seat;
|
xcb_timestamp_t last_timestamp;
|
||||||
gboolean mouse_seen;
|
NkBindingsSeat *bindings_seat;
|
||||||
|
gboolean mouse_seen;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,6 +65,8 @@ typedef struct
|
||||||
char *root;
|
char *root;
|
||||||
/* Path to desktop file */
|
/* Path to desktop file */
|
||||||
char *path;
|
char *path;
|
||||||
|
/* Application id (.desktop filename) */
|
||||||
|
char *app_id;
|
||||||
/* Icon stuff */
|
/* Icon stuff */
|
||||||
int icon_size;
|
int icon_size;
|
||||||
char *icon_name;
|
char *icon_name;
|
||||||
|
@ -187,15 +189,27 @@ static void exec_cmd_entry ( DRunModeEntry *e )
|
||||||
exec_path = NULL;
|
exec_path = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RofiHelperExecuteContext context = {
|
||||||
|
.name = e->name,
|
||||||
|
.icon = e->icon_name,
|
||||||
|
.app_id = e->app_id,
|
||||||
|
};
|
||||||
|
gboolean sn = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "StartupNotify", NULL );
|
||||||
|
gchar *wmclass = NULL;
|
||||||
|
if ( sn && g_key_file_has_key ( e->key_file, "Desktop Entry", "StartupWMClass", NULL ) ) {
|
||||||
|
context.wmclass = wmclass = g_key_file_get_string ( e->key_file, "Desktop Entry", "StartupWMClass", NULL );
|
||||||
|
}
|
||||||
|
|
||||||
// Returns false if not found, if key not found, we don't want run in terminal.
|
// Returns false if not found, if key not found, we don't want run in terminal.
|
||||||
gboolean terminal = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "Terminal", NULL );
|
gboolean terminal = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "Terminal", NULL );
|
||||||
if ( helper_execute_command ( exec_path, fp, terminal ) ) {
|
if ( helper_execute_command ( exec_path, fp, terminal, sn ? &context : NULL ) ) {
|
||||||
char *path = g_build_filename ( cache_dir, DRUN_CACHE_FILE, NULL );
|
char *path = g_build_filename ( cache_dir, DRUN_CACHE_FILE, NULL );
|
||||||
char *key = g_strdup_printf ( "%s:::%s", e->root, e->path );
|
char *key = g_strdup_printf ( "%s:::%s", e->root, e->path );
|
||||||
history_set ( path, key );
|
history_set ( path, key );
|
||||||
g_free ( key );
|
g_free ( key );
|
||||||
g_free ( path );
|
g_free ( path );
|
||||||
}
|
}
|
||||||
|
g_free ( wmclass );
|
||||||
g_free ( exec_path );
|
g_free ( exec_path );
|
||||||
g_free ( str );
|
g_free ( str );
|
||||||
g_free ( fp );
|
g_free ( fp );
|
||||||
|
@ -203,7 +217,7 @@ static void exec_cmd_entry ( DRunModeEntry *e )
|
||||||
/**
|
/**
|
||||||
* This function absorbs/freeś path, so this is no longer available afterwards.
|
* This function absorbs/freeś path, so this is no longer available afterwards.
|
||||||
*/
|
*/
|
||||||
static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, const char *path )
|
static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, const char *path, const gchar *basename )
|
||||||
{
|
{
|
||||||
// Create ID on stack.
|
// Create ID on stack.
|
||||||
// We know strlen (path ) > strlen(root)+1
|
// We know strlen (path ) > strlen(root)+1
|
||||||
|
@ -280,8 +294,9 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
pd->entry_list = g_realloc ( pd->entry_list, pd->cmd_list_length_actual * sizeof ( *( pd->entry_list ) ) );
|
pd->entry_list = g_realloc ( pd->entry_list, pd->cmd_list_length_actual * sizeof ( *( pd->entry_list ) ) );
|
||||||
}
|
}
|
||||||
pd->entry_list[pd->cmd_list_length].icon_size = 0;
|
pd->entry_list[pd->cmd_list_length].icon_size = 0;
|
||||||
pd->entry_list[pd->cmd_list_length].root = g_strdup ( root );
|
pd->entry_list[pd->cmd_list_length].root = g_strdup ( root );
|
||||||
pd->entry_list[pd->cmd_list_length].path = g_strdup ( path );
|
pd->entry_list[pd->cmd_list_length].path = g_strdup ( path );
|
||||||
|
pd->entry_list[pd->cmd_list_length].app_id = g_strndup ( basename, strlen ( basename ) - strlen ( ".desktop" ) );
|
||||||
gchar *n = g_key_file_get_locale_string ( kf, "Desktop Entry", "Name", NULL, NULL );
|
gchar *n = g_key_file_get_locale_string ( kf, "Desktop Entry", "Name", NULL, NULL );
|
||||||
pd->entry_list[pd->cmd_list_length].name = n;
|
pd->entry_list[pd->cmd_list_length].name = n;
|
||||||
gchar *gn = g_key_file_get_locale_string ( kf, "Desktop Entry", "GenericName", NULL, NULL );
|
gchar *gn = g_key_file_get_locale_string ( kf, "Desktop Entry", "GenericName", NULL, NULL );
|
||||||
|
@ -356,7 +371,7 @@ static void walk_dir ( DRunModePrivateData *pd, const char *root, const char *di
|
||||||
case DT_REG:
|
case DT_REG:
|
||||||
// Skip files not ending on .desktop.
|
// Skip files not ending on .desktop.
|
||||||
if ( g_str_has_suffix ( file->d_name, ".desktop" ) ) {
|
if ( g_str_has_suffix ( file->d_name, ".desktop" ) ) {
|
||||||
read_desktop_file ( pd, root, filename );
|
read_desktop_file ( pd, root, filename, file->d_name );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_DIR:
|
case DT_DIR:
|
||||||
|
@ -391,7 +406,8 @@ static void get_apps_history ( DRunModePrivateData *pd )
|
||||||
for ( unsigned int index = 0; index < length; index++ ) {
|
for ( unsigned int index = 0; index < length; index++ ) {
|
||||||
char **st = g_strsplit ( retv[index], ":::", 2 );
|
char **st = g_strsplit ( retv[index], ":::", 2 );
|
||||||
if ( st && st[0] && st[1] ) {
|
if ( st && st[0] && st[1] ) {
|
||||||
if ( !read_desktop_file ( pd, st[0], st[1] ) ) {
|
const gchar *basename = g_utf8_strrchr ( st[1], -1, G_DIR_SEPARATOR );
|
||||||
|
if ( basename == NULL || !read_desktop_file ( pd, st[0], st[1], ++basename ) ) {
|
||||||
history_remove ( path, retv[index] );
|
history_remove ( path, retv[index] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,6 +506,7 @@ static void drun_entry_clear ( DRunModeEntry *e )
|
||||||
{
|
{
|
||||||
g_free ( e->root );
|
g_free ( e->root );
|
||||||
g_free ( e->path );
|
g_free ( e->path );
|
||||||
|
g_free ( e->app_id );
|
||||||
if ( e->icon != NULL ) {
|
if ( e->icon != NULL ) {
|
||||||
cairo_surface_destroy ( e->icon );
|
cairo_surface_destroy ( e->icon );
|
||||||
}
|
}
|
||||||
|
@ -521,7 +538,9 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
|
||||||
exec_cmd_entry ( &( rmpd->entry_list[selected_line] ) );
|
exec_cmd_entry ( &( rmpd->entry_list[selected_line] ) );
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||||
helper_execute_command ( NULL, *input, run_in_term );
|
RofiHelperExecuteContext context = { .name = NULL };
|
||||||
|
// FIXME: We assume startup notification in terminals, not in others
|
||||||
|
helper_execute_command ( NULL, *input, run_in_term, run_in_term ? &context : NULL );
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) {
|
else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) {
|
||||||
if ( selected_line < rmpd->history_length ) {
|
if ( selected_line < rmpd->history_length ) {
|
||||||
|
|
|
@ -92,7 +92,9 @@ static void exec_cmd ( const char *cmd, int run_in_term )
|
||||||
}
|
}
|
||||||
|
|
||||||
char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
|
char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
|
||||||
if ( helper_execute_command ( NULL, lf_cmd, run_in_term ) ) {
|
RofiHelperExecuteContext context = { .name = NULL };
|
||||||
|
// FIXME: assume startup notification support for terminals
|
||||||
|
if ( helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) {
|
||||||
/**
|
/**
|
||||||
* This happens in non-critical time (After launching app)
|
* This happens in non-critical time (After launching app)
|
||||||
* It is allowed to be a bit slower.
|
* It is allowed to be a bit slower.
|
||||||
|
|
|
@ -78,25 +78,20 @@ static inline int execshssh ( const char *host )
|
||||||
{
|
{
|
||||||
char **args = NULL;
|
char **args = NULL;
|
||||||
int argsv = 0;
|
int argsv = 0;
|
||||||
|
|
||||||
helper_parse_setup ( config.ssh_command, &args, &argsv, "{host}", host, NULL );
|
helper_parse_setup ( config.ssh_command, &args, &argsv, "{host}", host, NULL );
|
||||||
|
|
||||||
GError *error = NULL;
|
gsize l = strlen ( "Connecting to '' via rofi" ) + strlen ( host ) + 1;
|
||||||
g_spawn_async ( NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error );
|
gchar *desc = g_newa ( gchar, l );
|
||||||
|
|
||||||
if ( error != NULL ) {
|
g_snprintf ( desc, l, "Connecting to '%s' via rofi", host );
|
||||||
char *msg = g_strdup_printf ( "Failed to execute: 'ssh %s'\nError: '%s'", host, error->message );
|
|
||||||
rofi_view_error_dialog ( msg, FALSE );
|
|
||||||
g_free ( msg );
|
|
||||||
// print error.
|
|
||||||
g_error_free ( error );
|
|
||||||
|
|
||||||
g_strfreev ( args );
|
RofiHelperExecuteContext context = {
|
||||||
return FALSE;
|
.name = "ssh",
|
||||||
}
|
.description = desc,
|
||||||
// Free the args list.
|
.command = "ssh",
|
||||||
g_strfreev ( args );
|
};
|
||||||
|
return helper_execute ( NULL, args, "ssh ", host, &context );
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <pango/pango-fontmap.h>
|
#include <pango/pango-fontmap.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
#include <librsvg/rsvg.h>
|
#include <librsvg/rsvg.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "helper-theme.h"
|
#include "helper-theme.h"
|
||||||
|
@ -962,21 +963,19 @@ int utf8_strncmp ( const char* a, const char* b, size_t n )
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int helper_execute_command ( const char *wd, const char *cmd, int run_in_term )
|
gboolean helper_execute ( const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context )
|
||||||
{
|
{
|
||||||
int retv = TRUE;
|
gboolean retv = TRUE;
|
||||||
char **args = NULL;
|
GError *error = NULL;
|
||||||
int argc = 0;
|
|
||||||
if ( run_in_term ) {
|
GSpawnChildSetupFunc child_setup = NULL;
|
||||||
helper_parse_setup ( config.run_shell_command, &args, &argc, "{cmd}", cmd, NULL );
|
gpointer user_data = NULL;
|
||||||
}
|
|
||||||
else {
|
display_startup_notification ( context, &child_setup, &user_data );
|
||||||
helper_parse_setup ( config.run_command, &args, &argc, "{cmd}", cmd, NULL );
|
|
||||||
}
|
g_spawn_async ( wd, args, NULL, G_SPAWN_SEARCH_PATH, child_setup, user_data, NULL, &error );
|
||||||
GError *error = NULL;
|
|
||||||
g_spawn_async ( wd, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error );
|
|
||||||
if ( error != NULL ) {
|
if ( error != NULL ) {
|
||||||
char *msg = g_strdup_printf ( "Failed to execute: '%s'\nError: '%s'", cmd, error->message );
|
char *msg = g_strdup_printf ( "Failed to execute: '%s%s'\nError: '%s'", error_precmd, error_cmd, error->message );
|
||||||
rofi_view_error_dialog ( msg, FALSE );
|
rofi_view_error_dialog ( msg, FALSE );
|
||||||
g_free ( msg );
|
g_free ( msg );
|
||||||
// print error.
|
// print error.
|
||||||
|
@ -989,6 +988,40 @@ int helper_execute_command ( const char *wd, const char *cmd, int run_in_term )
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean helper_execute_command ( const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context )
|
||||||
|
{
|
||||||
|
char **args = NULL;
|
||||||
|
int argc = 0;
|
||||||
|
|
||||||
|
if ( run_in_term ) {
|
||||||
|
helper_parse_setup ( config.run_shell_command, &args, &argc, "{cmd}", cmd, NULL );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
helper_parse_setup ( config.run_command, &args, &argc, "{cmd}", cmd, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( context != NULL ) {
|
||||||
|
if ( context->name == NULL ) {
|
||||||
|
context->name = args[0];
|
||||||
|
}
|
||||||
|
if ( context->binary == NULL ) {
|
||||||
|
context->binary = args[0];
|
||||||
|
}
|
||||||
|
if ( context->description == NULL ) {
|
||||||
|
gsize l = strlen ( "Launching '' via rofi" ) + strlen ( cmd ) + 1;
|
||||||
|
gchar *description = g_newa ( gchar, l );
|
||||||
|
|
||||||
|
g_snprintf ( description, l, "Launching '%s' via rofi", cmd );
|
||||||
|
context->description = description;
|
||||||
|
}
|
||||||
|
if ( context->command == NULL ) {
|
||||||
|
context->command = cmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return helper_execute ( wd, args, "", cmd, context );
|
||||||
|
}
|
||||||
|
|
||||||
char *helper_get_theme_path ( const char *file )
|
char *helper_get_theme_path ( const char *file )
|
||||||
{
|
{
|
||||||
char *filename = rofi_expand_path ( file );
|
char *filename = rofi_expand_path ( file );
|
||||||
|
|
51
source/xcb.c
51
source/xcb.c
|
@ -49,6 +49,10 @@
|
||||||
#include <xcb/xkb.h>
|
#include <xcb/xkb.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xkbcommon/xkbcommon-x11.h>
|
#include <xkbcommon/xkbcommon-x11.h>
|
||||||
|
#define SN_API_NOT_YET_FROZEN
|
||||||
|
/* This function is declared as sn_launcher_context_set_application_id but implemented as sn_launcher_set_application_id */
|
||||||
|
#define sn_launcher_context_set_application_id sn_launcher_set_application_id
|
||||||
|
#include <libsn/sn.h>
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
|
@ -359,6 +363,45 @@ void display_dump_monitor_layout ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data )
|
||||||
|
{
|
||||||
|
if ( context == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SnLauncherContext *sncontext;
|
||||||
|
|
||||||
|
sncontext = sn_launcher_context_new ( xcb->sndisplay, xcb->screen_nbr );
|
||||||
|
|
||||||
|
sn_launcher_context_set_name ( sncontext, context->name );
|
||||||
|
sn_launcher_context_set_description ( sncontext, context->description );
|
||||||
|
if ( context->binary != NULL ) {
|
||||||
|
sn_launcher_context_set_binary_name ( sncontext, context->binary );
|
||||||
|
}
|
||||||
|
if ( context->icon != NULL ) {
|
||||||
|
sn_launcher_context_set_icon_name ( sncontext, context->icon );
|
||||||
|
}
|
||||||
|
if ( context->app_id != NULL ) {
|
||||||
|
sn_launcher_context_set_application_id ( sncontext, context->app_id );
|
||||||
|
}
|
||||||
|
if ( context->wmclass != NULL ) {
|
||||||
|
sn_launcher_context_set_wmclass ( sncontext, context->wmclass );
|
||||||
|
}
|
||||||
|
|
||||||
|
xcb_get_property_cookie_t c;
|
||||||
|
unsigned int current_desktop = 0;
|
||||||
|
|
||||||
|
c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
|
||||||
|
if ( xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, ¤t_desktop, NULL ) ) {
|
||||||
|
sn_launcher_context_set_workspace ( sncontext, current_desktop );
|
||||||
|
}
|
||||||
|
|
||||||
|
sn_launcher_context_initiate ( sncontext, "rofi", context->command, xcb->last_timestamp );
|
||||||
|
|
||||||
|
*child_setup = (GSpawnChildSetupFunc) sn_launcher_context_setup_child_process;
|
||||||
|
*user_data = sncontext;
|
||||||
|
}
|
||||||
|
|
||||||
static int monitor_get_dimension ( int monitor_id, workarea *mon )
|
static int monitor_get_dimension ( int monitor_id, workarea *mon )
|
||||||
{
|
{
|
||||||
memset ( mon, 0, sizeof ( workarea ) );
|
memset ( mon, 0, sizeof ( workarea ) );
|
||||||
|
@ -597,6 +640,7 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
|
||||||
case XCB_BUTTON_PRESS:
|
case XCB_BUTTON_PRESS:
|
||||||
{
|
{
|
||||||
xcb_button_press_event_t *bpe = (xcb_button_press_event_t *) event;
|
xcb_button_press_event_t *bpe = (xcb_button_press_event_t *) event;
|
||||||
|
xcb->last_timestamp = bpe->time;
|
||||||
rofi_view_handle_mouse_motion ( state, bpe->event_x, bpe->event_y );
|
rofi_view_handle_mouse_motion ( state, bpe->event_x, bpe->event_y );
|
||||||
nk_bindings_seat_handle_button ( xcb->bindings_seat, bpe->detail, NK_BINDINGS_BUTTON_STATE_PRESS, bpe->time );
|
nk_bindings_seat_handle_button ( xcb->bindings_seat, bpe->detail, NK_BINDINGS_BUTTON_STATE_PRESS, bpe->time );
|
||||||
break;
|
break;
|
||||||
|
@ -604,6 +648,7 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
|
||||||
case XCB_BUTTON_RELEASE:
|
case XCB_BUTTON_RELEASE:
|
||||||
{
|
{
|
||||||
xcb_button_release_event_t *bre = (xcb_button_release_event_t *) event;
|
xcb_button_release_event_t *bre = (xcb_button_release_event_t *) event;
|
||||||
|
xcb->last_timestamp = bre->time;
|
||||||
nk_bindings_seat_handle_button ( xcb->bindings_seat, bre->detail, NK_BINDINGS_BUTTON_STATE_RELEASE, bre->time );
|
nk_bindings_seat_handle_button ( xcb->bindings_seat, bre->detail, NK_BINDINGS_BUTTON_STATE_RELEASE, bre->time );
|
||||||
if ( config.click_to_exit == TRUE ) {
|
if ( config.click_to_exit == TRUE ) {
|
||||||
if ( ! xcb->mouse_seen ) {
|
if ( ! xcb->mouse_seen ) {
|
||||||
|
@ -635,8 +680,9 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
|
||||||
xcb_key_press_event_t *xkpe = (xcb_key_press_event_t *) event;
|
xcb_key_press_event_t *xkpe = (xcb_key_press_event_t *) event;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
text = nk_bindings_seat_handle_key ( xcb->bindings_seat, xkpe->detail, NK_BINDINGS_KEY_STATE_PRESS );
|
xcb->last_timestamp = xkpe->time;
|
||||||
if ( text != NULL ) {
|
text = nk_bindings_seat_handle_key ( xcb->bindings_seat, xkpe->detail, NK_BINDINGS_KEY_STATE_PRESS );
|
||||||
|
if ( text != NULL ) {
|
||||||
rofi_view_handle_text ( state, text );
|
rofi_view_handle_text ( state, text );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -644,6 +690,7 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
|
||||||
case XCB_KEY_RELEASE:
|
case XCB_KEY_RELEASE:
|
||||||
{
|
{
|
||||||
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) event;
|
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) event;
|
||||||
|
xcb->last_timestamp = xkre->time;
|
||||||
nk_bindings_seat_handle_key ( xcb->bindings_seat, xkre->detail, NK_BINDINGS_KEY_STATE_RELEASE );
|
nk_bindings_seat_handle_key ( xcb->bindings_seat, xkre->detail, NK_BINDINGS_KEY_STATE_RELEASE );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
@ -65,6 +66,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
@ -66,6 +67,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( int argc, char ** argv )
|
int main ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
cmd_set_arguments ( argc, argv );
|
cmd_set_arguments ( argc, argv );
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
@ -56,6 +57,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
||||||
{
|
{
|
||||||
if ( setlocale ( LC_ALL, "" ) == NULL ) {
|
if ( setlocale ( LC_ALL, "" ) == NULL ) {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
@ -75,6 +76,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( int argc, char ** argv )
|
int main ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
cmd_set_arguments ( argc, argv );
|
cmd_set_arguments ( argc, argv );
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
@ -56,6 +57,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
|
||||||
{
|
{
|
||||||
if ( setlocale ( LC_ALL, "" ) == NULL ) {
|
if ( setlocale ( LC_ALL, "" ) == NULL ) {
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <dialogs/help-keys.h>
|
#include <dialogs/help-keys.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include <keyb.h>
|
#include <keyb.h>
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
|
@ -73,6 +74,11 @@ gboolean rofi_view_trigger_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_U
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _ck_assert_ptr_null
|
#ifndef _ck_assert_ptr_null
|
||||||
/* Pointer against NULL comparison macros with improved output
|
/* Pointer against NULL comparison macros with improved output
|
||||||
* compared to ck_assert(). */
|
* compared to ck_assert(). */
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <widgets/textbox.h>
|
#include <widgets/textbox.h>
|
||||||
#include <rofi.h>
|
#include <rofi.h>
|
||||||
#include <cairo-xlib.h>
|
#include <cairo-xlib.h>
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "xrmoptions.h"
|
#include "xrmoptions.h"
|
||||||
|
@ -76,6 +77,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
{
|
{
|
||||||
cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, 100, 100 );
|
cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, 100, 100 );
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "css-colors.h"
|
#include "css-colors.h"
|
||||||
|
@ -70,6 +71,10 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _ck_assert_ptr_null
|
#ifndef _ck_assert_ptr_null
|
||||||
/* Pointer against NULL comparison macros with improved output
|
/* Pointer against NULL comparison macros with improved output
|
||||||
* compared to ck_assert(). */
|
* compared to ck_assert(). */
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <widgets/widget.h>
|
#include <widgets/widget.h>
|
||||||
#include <widgets/widget-internal.h>
|
#include <widgets/widget-internal.h>
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
|
#include "display.h"
|
||||||
#include "xrmoptions.h"
|
#include "xrmoptions.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
unsigned int test =0;
|
unsigned int test =0;
|
||||||
|
@ -66,6 +67,10 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
{
|
{
|
||||||
// box 20 by 40
|
// box 20 by 40
|
||||||
|
|
Loading…
Reference in New Issue