mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Re-Indent code
This commit is contained in:
parent
b1ecb6ca77
commit
ce4b1b23b4
17 changed files with 118 additions and 105 deletions
|
@ -166,7 +166,7 @@ typedef struct
|
||||||
|
|
||||||
char *theme;
|
char *theme;
|
||||||
/** Path where plugins can be found. */
|
/** Path where plugins can be found. */
|
||||||
char * plugin_path;
|
char * plugin_path;
|
||||||
} Settings;
|
} Settings;
|
||||||
/** Global Settings structure. */
|
/** Global Settings structure. */
|
||||||
extern Settings config;
|
extern Settings config;
|
||||||
|
|
|
@ -116,7 +116,6 @@ typedef enum
|
||||||
P_HIGHLIGHT,
|
P_HIGHLIGHT,
|
||||||
} PropertyType;
|
} PropertyType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent the color in theme.
|
* Represent the color in theme.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -280,5 +280,10 @@ void rofi_view_workers_finalize ( void );
|
||||||
* @returns the current monitor workarea
|
* @returns the current monitor workarea
|
||||||
*/
|
*/
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height );
|
void rofi_view_get_current_monitor ( int *width, int *height );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a screenshot.
|
||||||
|
*/
|
||||||
|
void rofi_capture_screenshot ( void );
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "Dialogs.Combi"
|
#define G_LOG_DOMAIN "Dialogs.Combi"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "Dialogs.DRun"
|
#define G_LOG_DOMAIN "Dialogs.DRun"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#ifdef ENABLE_DRUN
|
#ifdef ENABLE_DRUN
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** The log domain of this dialog. */
|
/** The log domain of this dialog. */
|
||||||
#define G_LOG_DOMAIN "Dialogs.Run"
|
#define G_LOG_DOMAIN "Dialogs.Run"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -189,7 +189,7 @@ static char ** get_apps_external ( char **retv, unsigned int *length, unsigned i
|
||||||
}
|
}
|
||||||
if ( fclose ( inp ) != 0 ) {
|
if ( fclose ( inp ) != 0 ) {
|
||||||
g_warning ( "Failed to close stdout off executor script: '%s'",
|
g_warning ( "Failed to close stdout off executor script: '%s'",
|
||||||
g_strerror ( errno ) );
|
g_strerror ( errno ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ static char ** get_apps ( unsigned int *length )
|
||||||
char *strtok_savepointer = NULL;
|
char *strtok_savepointer = NULL;
|
||||||
for ( const char *dirname = strtok_r ( path, sep, &strtok_savepointer ); dirname != NULL; dirname = strtok_r ( NULL, sep, &strtok_savepointer ) ) {
|
for ( const char *dirname = strtok_r ( path, sep, &strtok_savepointer ); dirname != NULL; dirname = strtok_r ( NULL, sep, &strtok_savepointer ) ) {
|
||||||
char *fpath = rofi_expand_path ( dirname );
|
char *fpath = rofi_expand_path ( dirname );
|
||||||
DIR *dir = opendir ( fpath );
|
DIR *dir = opendir ( fpath );
|
||||||
g_debug ( "Checking path %s for executable.", fpath );
|
g_debug ( "Checking path %s for executable.", fpath );
|
||||||
g_free ( fpath );
|
g_free ( fpath );
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "Dialogs.Script"
|
#define G_LOG_DOMAIN "Dialogs.Script"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -69,7 +69,7 @@ static char **get_script_output ( const char *command, unsigned int *length )
|
||||||
}
|
}
|
||||||
if ( fclose ( inp ) != 0 ) {
|
if ( fclose ( inp ) != 0 ) {
|
||||||
g_warning ( "Failed to close stdout off executor script: '%s'",
|
g_warning ( "Failed to close stdout off executor script: '%s'",
|
||||||
g_strerror ( errno ) );
|
g_strerror ( errno ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,5 +211,5 @@ Mode *script_switcher_parse_setup ( const char *str )
|
||||||
|
|
||||||
gboolean script_switcher_is_valid ( const char *token )
|
gboolean script_switcher_is_valid ( const char *token )
|
||||||
{
|
{
|
||||||
return strchr ( token, ':') != NULL;
|
return strchr ( token, ':' ) != NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
/**
|
/**
|
||||||
* Log domain for the ssh modi.
|
* Log domain for the ssh modi.
|
||||||
*/
|
*/
|
||||||
#define G_LOG_DOMAIN "Dialogs.Ssh"
|
#define G_LOG_DOMAIN "Dialogs.Ssh"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "Dialogs.Window"
|
#define G_LOG_DOMAIN "Dialogs.Window"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ const char ** find_arg_strv ( const char *const key )
|
||||||
retv = g_malloc0 ( ( length + 1 ) * sizeof ( char* ) );
|
retv = g_malloc0 ( ( length + 1 ) * sizeof ( char* ) );
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for ( int i = 0; i < stored_argc; i++ ) {
|
for ( int i = 0; i < stored_argc; i++ ) {
|
||||||
if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) {
|
if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) {
|
||||||
retv[index++] = stored_argv[i + 1];
|
retv[index++] = stored_argv[i + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ char *rofi_expand_path ( const char *input )
|
||||||
|
|
||||||
unsigned int levenshtein ( const char *needle, const glong needlelen, const char *haystack, const glong haystacklen )
|
unsigned int levenshtein ( const char *needle, const glong needlelen, const char *haystack, const glong haystacklen )
|
||||||
{
|
{
|
||||||
if ( needlelen == G_MAXLONG ){
|
if ( needlelen == G_MAXLONG ) {
|
||||||
// String to long, we cannot handle this.
|
// String to long, we cannot handle this.
|
||||||
return UINT_MAX;
|
return UINT_MAX;
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st
|
||||||
const gchar *pit = pattern, *sit;
|
const gchar *pit = pattern, *sit;
|
||||||
enum CharClass prev = NON_WORD;
|
enum CharClass prev = NON_WORD;
|
||||||
for ( si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char ( sit ) ) {
|
for ( si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char ( sit ) ) {
|
||||||
enum CharClass cur = rofi_scorer_get_character_class ( g_utf8_get_char ( sit ) );
|
enum CharClass cur = rofi_scorer_get_character_class ( g_utf8_get_char ( sit ) );
|
||||||
score[si] = rofi_scorer_get_score_for ( prev, cur );
|
score[si] = rofi_scorer_get_score_for ( prev, cur );
|
||||||
prev = cur;
|
prev = cur;
|
||||||
dp[si] = MIN_SCORE;
|
dp[si] = MIN_SCORE;
|
||||||
|
@ -964,7 +964,6 @@ int helper_execute_command ( const char *wd, const char *cmd, int run_in_term )
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 );
|
||||||
|
@ -975,7 +974,8 @@ char *helper_get_theme_path ( const char *file )
|
||||||
|
|
||||||
if ( g_str_has_suffix ( file, ".rasi" ) ) {
|
if ( g_str_has_suffix ( file, ".rasi" ) ) {
|
||||||
filename = g_strdup ( file );
|
filename = g_strdup ( file );
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
filename = g_strconcat ( file, ".rasi", NULL );
|
filename = g_strconcat ( file, ".rasi", NULL );
|
||||||
}
|
}
|
||||||
// Check config directory.
|
// Check config directory.
|
||||||
|
|
|
@ -283,13 +283,12 @@ static void print_list_of_modi ( int is_term )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf ( " * %s%s%s%s\n",
|
printf ( " * %s%s%s%s\n",
|
||||||
active?"+":"" ,
|
active ? "+" : "",
|
||||||
is_term ? (active?color_green:color_red) : "",
|
is_term ? ( active ? color_green : color_red ) : "",
|
||||||
available_modi[i]->name,
|
available_modi[i]->name,
|
||||||
is_term ? color_reset : ""
|
is_term ? color_reset : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void print_main_application_options ( int is_term )
|
static void print_main_application_options ( int is_term )
|
||||||
{
|
{
|
||||||
|
@ -319,8 +318,8 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
||||||
print_options ();
|
print_options ();
|
||||||
printf ( "\n" );
|
printf ( "\n" );
|
||||||
x11_dump_monitor_layout ();
|
x11_dump_monitor_layout ();
|
||||||
printf("\n");
|
printf ( "\n" );
|
||||||
printf("Detected modi:\n");
|
printf ( "Detected modi:\n" );
|
||||||
print_list_of_modi ( is_term );
|
print_list_of_modi ( is_term );
|
||||||
printf ( "\n" );
|
printf ( "\n" );
|
||||||
printf ( "Compile time options:\n" );
|
printf ( "Compile time options:\n" );
|
||||||
|
@ -372,9 +371,9 @@ static void help_print_disabled_mode ( const char *mode )
|
||||||
int is_term = isatty ( fileno ( stdout ) );
|
int is_term = isatty ( fileno ( stdout ) );
|
||||||
// Only output to terminal
|
// Only output to terminal
|
||||||
if ( is_term ) {
|
if ( is_term ) {
|
||||||
fprintf ( stderr, "Mode %s%s%s is not enabled. I have enabled it for now.\n",
|
fprintf ( stderr, "Mode %s%s%s is not enabled. I have enabled it for now.\n",
|
||||||
color_red, mode, color_reset );
|
color_red, mode, color_reset );
|
||||||
fprintf ( stderr, "Please consider adding %s%s%s to the list of enabled modi: %smodi: %s%s%s,%s%s.\n",
|
fprintf ( stderr, "Please consider adding %s%s%s to the list of enabled modi: %smodi: %s%s%s,%s%s.\n",
|
||||||
color_red, mode, color_reset,
|
color_red, mode, color_reset,
|
||||||
color_green, config.modi, color_reset,
|
color_green, config.modi, color_reset,
|
||||||
color_red, mode, color_reset
|
color_red, mode, color_reset
|
||||||
|
@ -385,8 +384,8 @@ static void help_print_mode_not_found ( const char *mode )
|
||||||
{
|
{
|
||||||
int is_term = isatty ( fileno ( stdout ) );
|
int is_term = isatty ( fileno ( stdout ) );
|
||||||
fprintf ( stderr, "Mode %s%s%s is not found.\n",
|
fprintf ( stderr, "Mode %s%s%s is not found.\n",
|
||||||
is_term?color_red:"", mode, is_term?color_reset:"");
|
is_term ? color_red : "", mode, is_term ? color_reset : "" );
|
||||||
fprintf( stderr, "The following modi are known:\n");
|
fprintf ( stderr, "The following modi are known:\n" );
|
||||||
print_list_of_modi ( is_term );
|
print_list_of_modi ( is_term );
|
||||||
printf ( "\n" );
|
printf ( "\n" );
|
||||||
}
|
}
|
||||||
|
@ -629,7 +628,7 @@ static int add_mode ( const char * token )
|
||||||
modi[num_modi] = mode;
|
modi[num_modi] = mode;
|
||||||
num_modi++;
|
num_modi++;
|
||||||
}
|
}
|
||||||
else if ( script_switcher_is_valid ( token ) ){
|
else if ( script_switcher_is_valid ( token ) ) {
|
||||||
// If not build in, use custom modi.
|
// If not build in, use custom modi.
|
||||||
Mode *sw = script_switcher_parse_setup ( token );
|
Mode *sw = script_switcher_parse_setup ( token );
|
||||||
if ( sw != NULL ) {
|
if ( sw != NULL ) {
|
||||||
|
@ -647,7 +646,7 @@ static gboolean setup_modi ( void )
|
||||||
char *switcher_str = g_strdup ( config.modi );
|
char *switcher_str = g_strdup ( config.modi );
|
||||||
// Split token on ','. This modifies switcher_str.
|
// Split token on ','. This modifies switcher_str.
|
||||||
for ( char *token = strtok_r ( switcher_str, sep, &savept ); token != NULL; token = strtok_r ( NULL, sep, &savept ) ) {
|
for ( char *token = strtok_r ( switcher_str, sep, &savept ); token != NULL; token = strtok_r ( NULL, sep, &savept ) ) {
|
||||||
if ( add_mode ( token ) == -1 ){
|
if ( add_mode ( token ) == -1 ) {
|
||||||
help_print_mode_not_found ( token );
|
help_print_mode_not_found ( token );
|
||||||
g_free ( switcher_str );
|
g_free ( switcher_str );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -680,11 +679,12 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
|
||||||
{
|
{
|
||||||
if ( ev == NULL ) {
|
if ( ev == NULL ) {
|
||||||
int status = xcb_connection_has_error ( xcb->connection );
|
int status = xcb_connection_has_error ( xcb->connection );
|
||||||
if(status > 0) {
|
if ( status > 0 ) {
|
||||||
g_warning ( "The XCB connection to X server had a fatal error: %d", status );
|
g_warning ( "The XCB connection to X server had a fatal error: %d", status );
|
||||||
g_main_loop_quit ( main_loop );
|
g_main_loop_quit ( main_loop );
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
g_warning ( "main_loop_x11_event_handler: ev == NULL, status == %d", status );
|
g_warning ( "main_loop_x11_event_handler: ev == NULL, status == %d", status );
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -908,6 +908,11 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean record ( void )
|
||||||
|
{
|
||||||
|
rofi_capture_screenshot ();
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param argc number of input arguments.
|
* @param argc number of input arguments.
|
||||||
* @param argv array of the input arguments.
|
* @param argv array of the input arguments.
|
||||||
|
@ -995,7 +1000,7 @@ int main ( int argc, char *argv[] )
|
||||||
|
|
||||||
xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr );
|
xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr );
|
||||||
if ( xcb_connection_has_error ( xcb->connection ) ) {
|
if ( xcb_connection_has_error ( xcb->connection ) ) {
|
||||||
g_warning( "Failed to open display: %s", display_str );
|
g_warning ( "Failed to open display: %s", display_str );
|
||||||
cleanup ();
|
cleanup ();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1163,8 +1168,7 @@ int main ( int argc, char *argv[] )
|
||||||
|
|
||||||
if ( !dmenu_mode ) {
|
if ( !dmenu_mode ) {
|
||||||
// setup_modi
|
// setup_modi
|
||||||
if ( setup_modi () )
|
if ( setup_modi () ) {
|
||||||
{
|
|
||||||
cleanup ();
|
cleanup ();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1188,7 +1192,7 @@ int main ( int argc, char *argv[] )
|
||||||
for ( GList *iter = g_list_first ( list_of_error_msgs );
|
for ( GList *iter = g_list_first ( list_of_error_msgs );
|
||||||
iter != NULL; iter = g_list_next ( iter ) ) {
|
iter != NULL; iter = g_list_next ( iter ) ) {
|
||||||
g_warning ( "Error: %s%s%s",
|
g_warning ( "Error: %s%s%s",
|
||||||
color_bold, ( (GString *) iter->data )->str, color_reset );
|
color_bold, ( (GString *) iter->data )->str, color_reset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rofi_theme = NULL;
|
rofi_theme = NULL;
|
||||||
|
@ -1215,6 +1219,11 @@ int main ( int argc, char *argv[] )
|
||||||
cleanup ();
|
cleanup ();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int interval = 1;
|
||||||
|
if ( find_arg_uint ( "-record-screenshots", &interval ) ) {
|
||||||
|
g_timeout_add ( 1000 / (double) interval, record, NULL );
|
||||||
|
}
|
||||||
main_loop_source = g_water_xcb_source_new_for_connection ( NULL, xcb->connection, main_loop_x11_event_handler, NULL, NULL );
|
main_loop_source = g_water_xcb_source_new_for_connection ( NULL, xcb->connection, main_loop_x11_event_handler, NULL, NULL );
|
||||||
|
|
||||||
TICK_N ( "X11 Setup " );
|
TICK_N ( "X11 Setup " );
|
||||||
|
|
|
@ -446,10 +446,10 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
g_debug ( "Found property: '%s' on '%s', but type %s does not match expected type %s.",
|
g_debug ( "Found property: '%s' on '%s', but type %s does not match expected type %s.",
|
||||||
property, widget->name,
|
property, widget->name,
|
||||||
PropertyTypeName[p->type],
|
PropertyTypeName[p->type],
|
||||||
PropertyTypeName[type]
|
PropertyTypeName[type]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( exact ) {
|
if ( exact ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -173,7 +173,7 @@ static int lev_sort ( const void *p1, const void *p2, void *arg )
|
||||||
/**
|
/**
|
||||||
* Stores a screenshot of Rofi at that point in time.
|
* Stores a screenshot of Rofi at that point in time.
|
||||||
*/
|
*/
|
||||||
static void menu_capture_screenshot ( void )
|
void rofi_capture_screenshot ( void )
|
||||||
{
|
{
|
||||||
const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" );
|
const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" );
|
||||||
if ( CacheState.edit_surf == NULL ) {
|
if ( CacheState.edit_surf == NULL ) {
|
||||||
|
@ -190,7 +190,7 @@ static void menu_capture_screenshot ( void )
|
||||||
GDateTime *now = g_date_time_new_now_local ();
|
GDateTime *now = g_date_time_new_now_local ();
|
||||||
// Format filename.
|
// Format filename.
|
||||||
char *timestmp = g_date_time_format ( now, "rofi-%Y-%m-%d-%H%M" );
|
char *timestmp = g_date_time_format ( now, "rofi-%Y-%m-%d-%H%M" );
|
||||||
char *filename = g_strdup_printf ( "%s.png", timestmp );
|
char *filename = g_strdup_printf ( "%s-%05d.png", timestmp, 0 );
|
||||||
// Build full path
|
// Build full path
|
||||||
char *fpath = NULL;
|
char *fpath = NULL;
|
||||||
if ( outp == NULL ) {
|
if ( outp == NULL ) {
|
||||||
|
@ -202,7 +202,7 @@ static void menu_capture_screenshot ( void )
|
||||||
// Try the next index.
|
// Try the next index.
|
||||||
index++;
|
index++;
|
||||||
// Format filename.
|
// Format filename.
|
||||||
filename = g_strdup_printf ( "%s-%d.png", timestmp, index );
|
filename = g_strdup_printf ( "%s-%05d.png", timestmp, index );
|
||||||
// Build full path
|
// Build full path
|
||||||
fpath = g_build_filename ( xdg_pict_dir, filename, NULL );
|
fpath = g_build_filename ( xdg_pict_dir, filename, NULL );
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ static void menu_capture_screenshot ( void )
|
||||||
cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath );
|
cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath );
|
||||||
if ( status != CAIRO_STATUS_SUCCESS ) {
|
if ( status != CAIRO_STATUS_SUCCESS ) {
|
||||||
g_warning ( "Failed to produce screenshot '%s', got error: '%s'", fpath,
|
g_warning ( "Failed to produce screenshot '%s', got error: '%s'", fpath,
|
||||||
cairo_status_to_string ( status ) );
|
cairo_status_to_string ( status ) );
|
||||||
}
|
}
|
||||||
g_free ( fpath );
|
g_free ( fpath );
|
||||||
g_free ( filename );
|
g_free ( filename );
|
||||||
|
@ -617,7 +617,7 @@ static void rofi_view_setup_fake_transparency ( const char* const fake_backgroun
|
||||||
if ( s != NULL ) {
|
if ( s != NULL ) {
|
||||||
if ( cairo_surface_status ( s ) != CAIRO_STATUS_SUCCESS ) {
|
if ( cairo_surface_status ( s ) != CAIRO_STATUS_SUCCESS ) {
|
||||||
g_debug ( "Failed to open surface fake background: %s",
|
g_debug ( "Failed to open surface fake background: %s",
|
||||||
cairo_status_to_string ( cairo_surface_status ( s ) ) );
|
cairo_status_to_string ( cairo_surface_status ( s ) ) );
|
||||||
cairo_surface_destroy ( s );
|
cairo_surface_destroy ( s );
|
||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
|
@ -771,18 +771,18 @@ void __create_window ( MenuFlags menu_flags )
|
||||||
TICK_N ( "done" );
|
TICK_N ( "done" );
|
||||||
|
|
||||||
// Set the PID.
|
// Set the PID.
|
||||||
pid_t pid= getpid ();
|
pid_t pid = getpid ();
|
||||||
xcb_ewmh_set_wm_pid (&(xcb->ewmh), CacheState.main_window, pid );
|
xcb_ewmh_set_wm_pid ( &( xcb->ewmh ), CacheState.main_window, pid );
|
||||||
|
|
||||||
// Get hostname
|
// Get hostname
|
||||||
const char *hostname = g_get_host_name ();
|
const char *hostname = g_get_host_name ();
|
||||||
char *ahost = g_hostname_to_ascii ( hostname );
|
char *ahost = g_hostname_to_ascii ( hostname );
|
||||||
if ( ahost != NULL ) {
|
if ( ahost != NULL ) {
|
||||||
xcb_icccm_set_wm_client_machine(xcb->connection,
|
xcb_icccm_set_wm_client_machine ( xcb->connection,
|
||||||
CacheState.main_window,
|
CacheState.main_window,
|
||||||
XCB_ATOM_STRING, 8,
|
XCB_ATOM_STRING, 8,
|
||||||
strlen(ahost), ahost);
|
strlen ( ahost ), ahost );
|
||||||
g_free(ahost);
|
g_free ( ahost );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,7 +1164,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio
|
||||||
xcb_flush ( xcb->connection );
|
xcb_flush ( xcb->connection );
|
||||||
break;
|
break;
|
||||||
case SCREENSHOT:
|
case SCREENSHOT:
|
||||||
menu_capture_screenshot ( );
|
rofi_capture_screenshot ( );
|
||||||
break;
|
break;
|
||||||
case TOGGLE_SORT:
|
case TOGGLE_SORT:
|
||||||
if ( state->case_indicator != NULL ) {
|
if ( state->case_indicator != NULL ) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "Widgets.Box"
|
#define G_LOG_DOMAIN "Widgets.Box"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -325,7 +325,7 @@ box * box_create ( const char *name, boxType type )
|
||||||
b->widget.clicked = box_clicked;
|
b->widget.clicked = box_clicked;
|
||||||
b->widget.motion_notify = box_motion_notify;
|
b->widget.motion_notify = box_motion_notify;
|
||||||
b->widget.get_desired_height = box_get_desired_height;
|
b->widget.get_desired_height = box_get_desired_height;
|
||||||
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
|
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
|
||||||
|
|
||||||
b->spacing = rofi_theme_get_distance ( WIDGET ( b ), "spacing", DEFAULT_SPACING );
|
b->spacing = rofi_theme_get_distance ( WIDGET ( b ), "spacing", DEFAULT_SPACING );
|
||||||
return b;
|
return b;
|
||||||
|
|
|
@ -123,7 +123,7 @@ container * container_create ( const char *name )
|
||||||
b->widget.clicked = container_clicked;
|
b->widget.clicked = container_clicked;
|
||||||
b->widget.motion_notify = container_motion_notify;
|
b->widget.motion_notify = container_motion_notify;
|
||||||
b->widget.get_desired_height = container_get_desired_height;
|
b->widget.get_desired_height = container_get_desired_height;
|
||||||
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
|
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
|
||||||
lv->widget.clicked = listview_clicked;
|
lv->widget.clicked = listview_clicked;
|
||||||
lv->widget.motion_notify = listview_motion_notify;
|
lv->widget.motion_notify = listview_motion_notify;
|
||||||
lv->widget.get_desired_height = listview_get_desired_height;
|
lv->widget.get_desired_height = listview_get_desired_height;
|
||||||
lv->widget.enabled = rofi_theme_get_boolean ( WIDGET ( lv ), "enabled", TRUE );
|
lv->widget.enabled = rofi_theme_get_boolean ( WIDGET ( lv ), "enabled", TRUE );
|
||||||
lv->eh = eh;
|
lv->eh = eh;
|
||||||
|
|
||||||
char *n = g_strjoin ( ".", lv->listview_name, "scrollbar", NULL );
|
char *n = g_strjoin ( ".", lv->listview_name, "scrollbar", NULL );
|
||||||
|
|
|
@ -84,103 +84,103 @@ typedef struct
|
||||||
* Currently supports string, boolean and number (signed and unsigned).
|
* Currently supports string, boolean and number (signed and unsigned).
|
||||||
*/
|
*/
|
||||||
static XrmOption xrmOptions[] = {
|
static XrmOption xrmOptions[] = {
|
||||||
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
|
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
|
||||||
"", CONFIG_DEFAULT },
|
"", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "modi", { .str = &config.modi }, NULL,
|
{ xrm_String, "modi", { .str = &config.modi }, NULL,
|
||||||
"Enabled modi", CONFIG_DEFAULT },
|
"Enabled modi", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
|
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
|
||||||
"Window width", CONFIG_DEFAULT },
|
"Window width", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
|
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
|
||||||
"Number of lines", CONFIG_DEFAULT },
|
"Number of lines", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
|
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
|
||||||
"Number of columns", CONFIG_DEFAULT },
|
"Number of columns", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
||||||
"Font to use", CONFIG_DEFAULT },
|
"Font to use", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
||||||
"Location on screen", CONFIG_DEFAULT },
|
"Location on screen", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
||||||
"Y-offset relative to location", CONFIG_DEFAULT },
|
"Y-offset relative to location", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
||||||
"X-offset relative to location", CONFIG_DEFAULT },
|
"X-offset relative to location", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
||||||
"Always show number of lines", CONFIG_DEFAULT },
|
"Always show number of lines", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
|
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
|
||||||
"Terminal to use", CONFIG_DEFAULT },
|
"Terminal to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
|
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
|
||||||
"Ssh client to use", CONFIG_DEFAULT },
|
"Ssh client to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
|
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
|
||||||
"Ssh command to execute", CONFIG_DEFAULT },
|
"Ssh command to execute", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
|
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
|
||||||
"Run command to execute", CONFIG_DEFAULT },
|
"Run command to execute", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
|
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
|
||||||
"Command to get extra run targets", CONFIG_DEFAULT },
|
"Command to get extra run targets", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
||||||
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
||||||
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
||||||
"Disable history in run/ssh", CONFIG_DEFAULT },
|
"Disable history in run/ssh", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
|
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
|
||||||
"Use sorting", CONFIG_DEFAULT },
|
"Use sorting", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
|
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
|
||||||
"Use levenshtein sorting also for fuzzy matching", CONFIG_DEFAULT },
|
"Use levenshtein sorting also for fuzzy matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
|
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
|
||||||
"Set case-sensitivity", CONFIG_DEFAULT },
|
"Set case-sensitivity", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
|
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
|
||||||
"Cycle through the results list", CONFIG_DEFAULT },
|
"Cycle through the results list", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
|
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
|
||||||
"Enable sidebar-mode", CONFIG_DEFAULT },
|
"Enable sidebar-mode", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
|
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
|
||||||
"Row height (in chars)", CONFIG_DEFAULT },
|
"Row height (in chars)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
|
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
|
||||||
"Enable auto select mode", CONFIG_DEFAULT },
|
"Enable auto select mode", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
|
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
|
||||||
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
|
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
|
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
|
||||||
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
|
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
|
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
|
||||||
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
|
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "matching", { .str = &config.matching }, NULL,
|
{ xrm_String, "matching", { .str = &config.matching }, NULL,
|
||||||
"Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
|
"Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
||||||
"Tokenize input string", CONFIG_DEFAULT },
|
"Tokenize input string", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "monitor", { .str = &config.monitor }, NULL,
|
{ xrm_String, "monitor", { .str = &config.monitor }, NULL,
|
||||||
"", CONFIG_DEFAULT },
|
"", CONFIG_DEFAULT },
|
||||||
/* Alias for dmenu compatibility. */
|
/* Alias for dmenu compatibility. */
|
||||||
{ xrm_String, "m", { .str = &config.monitor }, NULL,
|
{ xrm_String, "m", { .str = &config.monitor }, NULL,
|
||||||
"Monitor id to show on", CONFIG_DEFAULT },
|
"Monitor id to show on", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
||||||
"Pre-set filter", CONFIG_DEFAULT },
|
"Pre-set filter", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
||||||
"Fullscreen", CONFIG_DEFAULT },
|
"Fullscreen", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
||||||
"DPI", CONFIG_DEFAULT },
|
"DPI", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
||||||
"Threads to use for string matching", CONFIG_DEFAULT },
|
"Threads to use for string matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
||||||
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
||||||
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
|
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
|
||||||
"Click outside the window to exit", CONFIG_DEFAULT },
|
"Click outside the window to exit", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "show-match", { .snum = &config.show_match }, NULL,
|
{ xrm_Boolean, "show-match", { .snum = &config.show_match }, NULL,
|
||||||
"Indicate how it match by underlining it.", CONFIG_DEFAULT },
|
"Indicate how it match by underlining it.", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "theme", { .str = &config.theme }, NULL,
|
{ xrm_String, "theme", { .str = &config.theme }, NULL,
|
||||||
"New style theme file", CONFIG_DEFAULT },
|
"New style theme file", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
||||||
"Color scheme for normal row", CONFIG_DEFAULT },
|
"Color scheme for normal row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
||||||
"Color scheme for urgent row", CONFIG_DEFAULT },
|
"Color scheme for urgent row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
||||||
"Color scheme for active row", CONFIG_DEFAULT },
|
"Color scheme for active row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
||||||
"Color scheme window", CONFIG_DEFAULT },
|
"Color scheme window", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
|
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
|
||||||
"Directory containing plugins", CONFIG_DEFAULT },
|
"Directory containing plugins", CONFIG_DEFAULT },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue