1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00
This commit is contained in:
Dave Davenport 2017-11-07 20:04:07 +01:00
parent 4ac428bace
commit 9cd1e3fac2
9 changed files with 162 additions and 160 deletions

View file

@ -36,39 +36,39 @@ Settings config = {
/** List of enabled modi. */ /** List of enabled modi. */
/** -modi */ /** -modi */
#ifdef WINDOW_MODE #ifdef WINDOW_MODE
.modi = "window,run,ssh", .modi = "window,run,ssh",
#else #else
.modi = "run,ssh", .modi = "run,ssh",
#endif #endif
/** Border width around the window. */ /** Border width around the window. */
.menu_bw = 1, .menu_bw = 1,
/** The width of the switcher. (0100 in % > 100 in pixels) */ /** The width of the switcher. (0100 in % > 100 in pixels) */
.menu_width = 50, .menu_width = 50,
/** Maximum number of options to show. */ /** Maximum number of options to show. */
.menu_lines = 15, .menu_lines = 15,
/** Number of columns */ /** Number of columns */
.menu_columns = 1, .menu_columns = 1,
/** Font */ /** Font */
.menu_font = "mono 12", .menu_font = "mono 12",
/** Whether to load and show icons */ /** Whether to load and show icons */
.show_icons = FALSE, .show_icons = FALSE,
/** Terminal to use. (for ssh and open in terminal) */ /** Terminal to use. (for ssh and open in terminal) */
.terminal_emulator = "rofi-sensible-terminal", .terminal_emulator = "rofi-sensible-terminal",
.ssh_client = "ssh", .ssh_client = "ssh",
/** Command when executing ssh. */ /** Command when executing ssh. */
.ssh_command = "{terminal} -e {ssh-client} {host}", .ssh_command = "{terminal} -e {ssh-client} {host}",
/** Command when running */ /** Command when running */
.run_command = "{cmd}", .run_command = "{cmd}",
/** Command used to list executable commands. empty -> internal */ /** Command used to list executable commands. empty -> internal */
.run_list_command = "", .run_list_command = "",
/** Command executed when running application in terminal */ /** Command executed when running application in terminal */
.run_shell_command = "{terminal} -e {cmd}", .run_shell_command = "{terminal} -e {cmd}",
/** Command executed on accep-entry-custom for window modus */ /** Command executed on accep-entry-custom for window modus */
.window_command = "xkill -id {window}", .window_command = "xkill -id {window}",
/** No default icon theme, we search Adwaita and gnome as fallback */ /** No default icon theme, we search Adwaita and gnome as fallback */
.drun_icon_theme = NULL, .drun_icon_theme = NULL,
/** /**
* Location of the window. * Location of the window.
* Enumeration indicating location or gravity of window. * Enumeration indicating location or gravity of window.
@ -80,71 +80,71 @@ Settings config = {
* WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST * WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST
* *
*/ */
.location = WL_CENTER, .location = WL_CENTER,
/** Padding between elements */ /** Padding between elements */
.padding = 5, .padding = 5,
/** Y offset */ /** Y offset */
.y_offset = 0, .y_offset = 0,
/** X offset */ /** X offset */
.x_offset = 0, .x_offset = 0,
/** Always show config.menu_lines lines, even if less lines are available */ /** Always show config.menu_lines lines, even if less lines are available */
.fixed_num_lines = TRUE, .fixed_num_lines = TRUE,
/** Do not use history */ /** Do not use history */
.disable_history = FALSE, .disable_history = FALSE,
/** Sort the displayed list */ /** Sort the displayed list */
.sort = FALSE, .sort = FALSE,
/** Use levenshtein sorting when matching */ /** Use levenshtein sorting when matching */
.levenshtein_sort = FALSE, .levenshtein_sort = FALSE,
/** Case sensitivity of the search */ /** Case sensitivity of the search */
.case_sensitive = FALSE, .case_sensitive = FALSE,
/** Cycle through in the element list */ /** Cycle through in the element list */
.cycle = TRUE, .cycle = TRUE,
/** Height of an element in #chars */ /** Height of an element in #chars */
.element_height = 1, .element_height = 1,
/** Sidebar mode, show the modi */ /** Sidebar mode, show the modi */
.sidebar_mode = FALSE, .sidebar_mode = FALSE,
/** auto select */ /** auto select */
.auto_select = FALSE, .auto_select = FALSE,
/** Parse /etc/hosts file in ssh view. */ /** Parse /etc/hosts file in ssh view. */
.parse_hosts = FALSE, .parse_hosts = FALSE,
/** Parse ~/.ssh/known_hosts file in ssh view. */ /** Parse ~/.ssh/known_hosts file in ssh view. */
.parse_known_hosts = TRUE, .parse_known_hosts = TRUE,
/** Modi to combine into one view. */ /** Modi to combine into one view. */
.combi_modi = "window,run", .combi_modi = "window,run",
.tokenize = TRUE, .tokenize = TRUE,
.matching = "normal", .matching = "normal",
.matching_method = MM_NORMAL, .matching_method = MM_NORMAL,
/** Desktop entry fields to match*/ /** Desktop entry fields to match*/
.drun_match_fields = "all", .drun_match_fields = "all",
/** Window fields to match in window mode*/ /** Window fields to match in window mode*/
.window_match_fields = "all", .window_match_fields = "all",
/** Monitor */ /** Monitor */
.monitor = "-5", .monitor = "-5",
/** set line margin */ /** set line margin */
.line_margin = 2, .line_margin = 2,
.line_padding = 1, .line_padding = 1,
/** Set filter */ /** Set filter */
.filter = NULL, .filter = NULL,
/** Separator style: dash/solid */ /** Separator style: dash/solid */
.separator_style = "dash", .separator_style = "dash",
/** Hide scrollbar */ /** Hide scrollbar */
.hide_scrollbar = FALSE, .hide_scrollbar = FALSE,
.fullscreen = FALSE, .fullscreen = FALSE,
.fake_transparency = FALSE, .fake_transparency = FALSE,
.dpi = -1, .dpi = -1,
.threads = 0, .threads = 0,
.scroll_method = 0, .scroll_method = 0,
.scrollbar_width = 8, .scrollbar_width = 8,
.fake_background = "screenshot", .fake_background = "screenshot",
.window_format = "{w} {i}{c} {t}", .window_format = "{w} {i}{c} {t}",
.click_to_exit = TRUE, .click_to_exit = TRUE,
.show_match = TRUE, .show_match = TRUE,
.theme = NULL, .theme = NULL,
.color_normal = NULL, .color_normal = NULL,
.color_active = NULL, .color_active = NULL,
.color_urgent = NULL, .color_urgent = NULL,
.color_window = NULL, .color_window = NULL,
.plugin_path = PLUGIN_PATH, .plugin_path = PLUGIN_PATH,
.max_history_size = 25, .max_history_size = 25,
.combi_hide_mode_prefix = FALSE, .combi_hide_mode_prefix = FALSE,
}; };

View file

@ -128,7 +128,7 @@ typedef struct
// Theme // Theme
const gchar *icon_theme; const gchar *icon_theme;
// DE // DE
gchar **current_desktop_list; gchar **current_desktop_list;
} DRunModePrivateData; } DRunModePrivateData;
struct RegexEvalArg struct RegexEvalArg
@ -267,8 +267,8 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
} }
GKeyFile *kf = g_key_file_new (); GKeyFile *kf = g_key_file_new ();
GError *error = NULL; GError *error = NULL;
gboolean res = g_key_file_load_from_file ( kf, path, 0, &error ); gboolean res = g_key_file_load_from_file ( kf, path, 0, &error );
if ( !res && error == NULL) { if ( !res && error == NULL ) {
g_debug ( "Failed to parse desktop file: %s because: unknown.", path ); g_debug ( "Failed to parse desktop file: %s because: unknown.", path );
g_key_file_free ( kf ); g_key_file_free ( kf );
return FALSE; return FALSE;
@ -316,8 +316,8 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
if ( g_key_file_has_key ( kf, "Desktop Entry", "OnlyShowIn", NULL ) ) { if ( g_key_file_has_key ( kf, "Desktop Entry", "OnlyShowIn", NULL ) ) {
gsize llength = 0; gsize llength = 0;
show = FALSE; show = FALSE;
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "OnlyShowIn", &llength, NULL); gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "OnlyShowIn", &llength, NULL );
if ( list ) { if ( list ) {
for ( gsize lcd = 0; !show && pd->current_desktop_list[lcd]; lcd++ ) { for ( gsize lcd = 0; !show && pd->current_desktop_list[lcd]; lcd++ ) {
for ( gsize lle = 0; !show && lle < llength; lle++ ) { for ( gsize lle = 0; !show && lle < llength; lle++ ) {
show = ( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 ); show = ( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 );
@ -326,20 +326,20 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
g_strfreev ( list ); g_strfreev ( list );
} }
} }
if ( show && g_key_file_has_key ( kf, "Desktop Entry", "NotShowIn", NULL )) { if ( show && g_key_file_has_key ( kf, "Desktop Entry", "NotShowIn", NULL ) ) {
gsize llength = 0; gsize llength = 0;
gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "NotShowIn", &llength, NULL); gchar **list = g_key_file_get_string_list ( kf, "Desktop Entry", "NotShowIn", &llength, NULL );
if ( list ) { if ( list ) {
for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) { for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) {
for ( gsize lle = 0; show && lle < llength; lle++ ) { for ( gsize lle = 0; show && lle < llength; lle++ ) {
show = ! ( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 ); show = !( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 );
} }
} }
g_strfreev ( list ); g_strfreev ( list );
} }
} }
if ( ! show ) { if ( !show ) {
g_debug ( "Adding desktop file: %s to disabled list because: OnlyShowIn/NotShowIn", path ); g_debug ( "Adding desktop file: %s to disabled list because: OnlyShowIn/NotShowIn", path );
g_key_file_free ( kf ); g_key_file_free ( kf );
g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) ); g_hash_table_add ( pd->disabled_entries, g_strdup ( id ) );
@ -583,10 +583,11 @@ static void drun_icon_fetch ( gpointer data, gpointer user_data )
return; return;
} }
const gchar *icon_path; const gchar *icon_path;
gchar *icon_path_ = NULL; gchar *icon_path_ = NULL;
if ( g_path_is_absolute ( dr->icon_name ) ) if ( g_path_is_absolute ( dr->icon_name ) ) {
icon_path = dr->icon_name; icon_path = dr->icon_name;
}
else { else {
icon_path = icon_path_ = nk_xdg_theme_get_icon ( pd->xdg_context, themes, NULL, dr->icon_name, dr->icon_size, 1, TRUE ); icon_path = icon_path_ = nk_xdg_theme_get_icon ( pd->xdg_context, themes, NULL, dr->icon_name, dr->icon_size, 1, TRUE );
if ( icon_path_ == NULL ) { if ( icon_path_ == NULL ) {
@ -673,8 +674,7 @@ static int drun_mode_init ( Mode *sw )
mode_set_private_data ( sw, (void *) pd ); mode_set_private_data ( sw, (void *) pd );
// current destkop // current destkop
const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" ); const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" );
pd->current_desktop_list = current_desktop? g_strsplit(current_desktop, ":", 0) : NULL; pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL;
// Theme // Theme
pd->xdg_context = nk_xdg_theme_context_new ( drun_icon_fallback_themes, NULL ); pd->xdg_context = nk_xdg_theme_context_new ( drun_icon_fallback_themes, NULL );

View file

@ -86,7 +86,7 @@ static WinModeField matching_window_fields[WIN_MATCH_NUM_FIELDS] = {
{ .field_name = "desktop", .enabled = TRUE, } { .field_name = "desktop", .enabled = TRUE, }
}; };
static gboolean window_matching_fields_parsed = FALSE; static gboolean window_matching_fields_parsed = FALSE;
// a manageable window // a manageable window
typedef struct typedef struct
@ -403,7 +403,7 @@ static int window_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned in
static void window_mode_parse_fields () static void window_mode_parse_fields ()
{ {
window_matching_fields_parsed = TRUE; window_matching_fields_parsed = TRUE;
char *savept = NULL; char *savept = NULL;
// Make a copy, as strtok will modify it. // Make a copy, as strtok will modify it.
char *switcher_str = g_strdup ( config.window_match_fields ); char *switcher_str = g_strdup ( config.window_match_fields );
@ -589,9 +589,9 @@ static int window_mode_init ( Mode *sw )
pd->window_regex = g_regex_new ( "{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL ); pd->window_regex = g_regex_new ( "{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL );
mode_set_private_data ( sw, (void *) pd ); mode_set_private_data ( sw, (void *) pd );
_window_mode_load_data ( sw, FALSE ); _window_mode_load_data ( sw, FALSE );
if ( !window_matching_fields_parsed ) { if ( !window_matching_fields_parsed ) {
window_mode_parse_fields (); window_mode_parse_fields ();
} }
} }
return TRUE; return TRUE;
} }
@ -602,9 +602,9 @@ static int window_mode_init_cd ( Mode *sw )
pd->window_regex = g_regex_new ( "{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL ); pd->window_regex = g_regex_new ( "{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL );
mode_set_private_data ( sw, (void *) pd ); mode_set_private_data ( sw, (void *) pd );
_window_mode_load_data ( sw, TRUE ); _window_mode_load_data ( sw, TRUE );
if ( !window_matching_fields_parsed ) { if ( !window_matching_fields_parsed ) {
window_mode_parse_fields (); window_mode_parse_fields ();
} }
} }
return TRUE; return TRUE;
} }

View file

@ -79,7 +79,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *length ) static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *length )
{ {
unsigned int real_length = 0; unsigned int real_length = 0;
char **retv = NULL;; char **retv = NULL;;
if ( length == NULL ) { if ( length == NULL ) {
return NULL; return NULL;
} }
@ -93,9 +93,11 @@ static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *lengt
ssize_t l = 0; ssize_t l = 0;
while ( ( l = getline ( &buffer, &buffer_length, fd ) ) > 0 ) { while ( ( l = getline ( &buffer, &buffer_length, fd ) ) > 0 ) {
// Jump to the first space. // Jump to the first space.
const char *start = strchr( buffer, ' '); const char *start = strchr ( buffer, ' ' );
// not found, skip. // not found, skip.
if ( start == NULL ) continue; if ( start == NULL ) {
continue;
}
start++; start++;
// remove trailing \n // remove trailing \n
buffer[l - 1] = '\0'; buffer[l - 1] = '\0';
@ -110,7 +112,6 @@ static char ** __history_get_element_list_fields ( FILE *fd, unsigned int *lengt
retv[( *length ) + 1] = NULL; retv[( *length ) + 1] = NULL;
( *length )++; ( *length )++;
} }
return retv; return retv;
} }
@ -311,9 +312,9 @@ char ** history_get_list ( const char *filename, unsigned int *length )
if ( config.disable_history ) { if ( config.disable_history ) {
return NULL; return NULL;
} }
char **retv = NULL; char **retv = NULL;
// Open file. // Open file.
FILE *fd = g_fopen ( filename, "r" ); FILE *fd = g_fopen ( filename, "r" );
if ( fd == NULL ) { if ( fd == NULL ) {
// File that does not exists is not an error, so ignore it. // File that does not exists is not an error, so ignore it.
// Everything else? panic. // Everything else? panic.

View file

@ -48,7 +48,7 @@
#ifdef USE_NK_GIT_VERSION #ifdef USE_NK_GIT_VERSION
#include "nkutils-git-version.h" #include "nkutils-git-version.h"
#ifdef NK_GIT_VERSION #ifdef NK_GIT_VERSION
#define GIT_VERSION NK_GIT_VERSION #define GIT_VERSION NK_GIT_VERSION
#endif #endif
#endif #endif
@ -537,7 +537,7 @@ static void rofi_collect_modi ( void )
rofi_collect_modi_add ( &help_keys_mode ); rofi_collect_modi_add ( &help_keys_mode );
if ( find_arg ( "-no-plugins" ) < 0 ) { if ( find_arg ( "-no-plugins" ) < 0 ) {
find_arg_str ( "-plugin-path", &(config.plugin_path) ); find_arg_str ( "-plugin-path", &( config.plugin_path ) );
g_debug ( "Parse plugin path: %s", config.plugin_path ); g_debug ( "Parse plugin path: %s", config.plugin_path );
rofi_collect_modi_dir ( config.plugin_path ); rofi_collect_modi_dir ( config.plugin_path );
} }
@ -888,19 +888,19 @@ int main ( int argc, char *argv[] )
} }
if ( rofi_theme_is_empty ( ) ) { if ( rofi_theme_is_empty ( ) ) {
GBytes *theme_data = g_resource_lookup_data ( GBytes *theme_data = g_resource_lookup_data (
resources_get_resource(), resources_get_resource (),
"/org/qtools/rofi/default_theme.rasi", "/org/qtools/rofi/default_theme.rasi",
G_RESOURCE_LOOKUP_FLAGS_NONE, G_RESOURCE_LOOKUP_FLAGS_NONE,
NULL ); NULL );
if ( theme_data ) { if ( theme_data ) {
const char *theme = g_bytes_get_data ( theme_data, NULL ); const char *theme = g_bytes_get_data ( theme_data, NULL );
if ( rofi_theme_parse_string ( (const char *)theme ) ) { if ( rofi_theme_parse_string ( (const char *) theme ) ) {
g_warning ( "Failed to parse default theme. Giving up.." ); g_warning ( "Failed to parse default theme. Giving up.." );
if ( list_of_error_msgs ) { if ( list_of_error_msgs ) {
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;

View file

@ -142,7 +142,7 @@ void rofi_theme_free ( ThemeWidget *widget )
inline static void printf_double ( double d ) inline static void printf_double ( double d )
{ {
char buf[G_ASCII_DTOSTR_BUF_SIZE]; char buf[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_formatd ( buf, G_ASCII_DTOSTR_BUF_SIZE,"%.4lf", d ); g_ascii_formatd ( buf, G_ASCII_DTOSTR_BUF_SIZE, "%.4lf", d );
fputs ( buf, stdout ); fputs ( buf, stdout );
} }
static void rofi_theme_print_distance ( RofiDistance d ) static void rofi_theme_print_distance ( RofiDistance d )
@ -297,7 +297,8 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
fputs ( name, stdout ); fputs ( name, stdout );
if ( iter->prev == NULL && iter->next ) { if ( iter->prev == NULL && iter->next ) {
putchar ( ' ' ); putchar ( ' ' );
} else if ( iter->next ) { }
else if ( iter->next ) {
putchar ( '.' ); putchar ( '.' );
} }
} }
@ -328,7 +329,7 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
void rofi_theme_print ( ThemeWidget *widget ) void rofi_theme_print ( ThemeWidget *widget )
{ {
if ( widget != NULL ) { if ( widget != NULL ) {
printf("/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION); printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
rofi_theme_print_index ( widget ); rofi_theme_print_index ( widget );
} }
} }

View file

@ -1461,10 +1461,10 @@ static int rofi_view_calculate_height ( RofiViewState *state )
return CacheState.mon.h; return CacheState.mon.h;
} }
RofiDistance h = rofi_theme_get_distance ( WIDGET ( state->main_window ), "height", 0 ); RofiDistance h = rofi_theme_get_distance ( WIDGET ( state->main_window ), "height", 0 );
unsigned int height = distance_get_pixel ( h, ROFI_ORIENTATION_VERTICAL ); unsigned int height = distance_get_pixel ( h, ROFI_ORIENTATION_VERTICAL );
// If height is set, return it. // If height is set, return it.
if ( height > 0 ) { if ( height > 0 ) {
return height; return height;
} }
// Autosize based on widgets. // Autosize based on widgets.

View file

@ -483,16 +483,16 @@ static int monitor_active_from_winid ( xcb_drawable_t id, workarea *mon )
} }
static int monitor_active_from_id_focused ( int mon_id, workarea *mon ) static int monitor_active_from_id_focused ( int mon_id, workarea *mon )
{ {
int retv = FALSE; int retv = FALSE;
xcb_window_t active_window; xcb_window_t active_window;
xcb_get_property_cookie_t awc; xcb_get_property_cookie_t awc;
awc = xcb_ewmh_get_active_window ( &xcb->ewmh, xcb->screen_nbr ); awc = xcb_ewmh_get_active_window ( &xcb->ewmh, xcb->screen_nbr );
if ( ! xcb_ewmh_get_active_window_reply ( &xcb->ewmh, awc, &active_window, NULL ) ) { if ( !xcb_ewmh_get_active_window_reply ( &xcb->ewmh, awc, &active_window, NULL ) ) {
g_debug ( "Failed to get active window, falling back to mouse location (-5)." ); g_debug ( "Failed to get active window, falling back to mouse location (-5)." );
return retv; return retv;
} }
xcb_query_tree_cookie_t tree_cookie = xcb_query_tree ( xcb->connection, active_window ); xcb_query_tree_cookie_t tree_cookie = xcb_query_tree ( xcb->connection, active_window );
xcb_query_tree_reply_t *tree_reply = xcb_query_tree_reply ( xcb->connection, tree_cookie, NULL ); xcb_query_tree_reply_t *tree_reply = xcb_query_tree_reply ( xcb->connection, tree_cookie, NULL );
if ( !tree_reply ) { if ( !tree_reply ) {
g_debug ( "Failed to get parent window, falling back to mouse location (-5)." ); g_debug ( "Failed to get parent window, falling back to mouse location (-5)." );
return retv; return retv;
@ -516,7 +516,7 @@ static int monitor_active_from_id_focused ( int mon_id, workarea *mon )
mon->y = t->dst_y - r->y; mon->y = t->dst_y - r->y;
mon->w = r->width; mon->w = r->width;
mon->h = r->height; mon->h = r->height;
retv = TRUE; retv = TRUE;
} }
else if ( mon_id == -4 ) { else if ( mon_id == -4 ) {
monitor_dimensions ( t->dst_x, t->dst_y, mon ); monitor_dimensions ( t->dst_x, t->dst_y, mon );
@ -574,7 +574,7 @@ static int monitor_active_from_id ( int mon_id, workarea *mon )
} }
} }
else if ( mon_id == -2 || mon_id == -4 ) { else if ( mon_id == -2 || mon_id == -4 ) {
if ( monitor_active_from_id_focused ( mon_id, mon ) ){ if ( monitor_active_from_id_focused ( mon_id, mon ) ) {
return TRUE; return TRUE;
} }
} }

View file

@ -81,134 +81,134 @@ 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, "borderwidth", { .num = &config.menu_bw }, NULL, { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
"", CONFIG_DEFAULT }, "", CONFIG_DEFAULT },
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL, { xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
"Border width", CONFIG_DEFAULT }, "Border width", 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_Number, "padding", { .num = &config.padding }, NULL, { xrm_Number, "padding", { .num = &config.padding }, NULL,
"Padding", CONFIG_DEFAULT }, "Padding", 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_Boolean, "show-icons", { .snum = &config.show_icons }, NULL, { xrm_Boolean, "show-icons", { .snum = &config.show_icons }, NULL,
"Whether to load and show icons", CONFIG_DEFAULT }, "Whether to load and show icons", 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_String, "window-match-fields", { .str = &config.window_match_fields }, NULL, { xrm_String, "window-match-fields", { .str = &config.window_match_fields }, NULL,
"Window fields to match in window mode", CONFIG_DEFAULT }, "Window fields to match in window mode", CONFIG_DEFAULT },
{ xrm_String, "drun-icon-theme", { .str = &config.drun_icon_theme }, NULL, { xrm_String, "drun-icon-theme", { .str = &config.drun_icon_theme }, NULL,
"Theme to use to look for icons", CONFIG_DEFAULT }, "Theme to use to look for icons", CONFIG_DEFAULT },
{ xrm_String, "drun-match-fields", { .str = &config.drun_match_fields }, NULL, { xrm_String, "drun-match-fields", { .str = &config.drun_match_fields }, NULL,
"Desktop entry fields to match in drun", CONFIG_DEFAULT }, "Desktop entry fields to match in drun", 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_Number, "line-margin", { .num = &config.line_margin }, NULL, { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
"Margin between rows *DEPRECATED*", CONFIG_DEFAULT }, "Margin between rows *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Number, "line-padding", { .num = &config.line_padding }, NULL, { xrm_Number, "line-padding", { .num = &config.line_padding }, NULL,
"Padding within rows *DEPRECATED*", CONFIG_DEFAULT }, "Padding within rows *DEPRECATED*", 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_String, "separator-style", { .str = &config.separator_style }, NULL, { xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
"Separator style (none, dash, solid) *DEPRECATED*", CONFIG_DEFAULT }, "Separator style (none, dash, solid) *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
"Hide scroll-bar *DEPRECATED*", CONFIG_DEFAULT }, "Hide scroll-bar *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
"Fullscreen", CONFIG_DEFAULT }, "Fullscreen", CONFIG_DEFAULT },
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
"Fake transparency *DEPRECATED*", CONFIG_DEFAULT }, "Fake transparency *DEPRECATED*", 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, "scrollbar-width", { .num = &config.scrollbar_width }, NULL, { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
"Scrollbar width *DEPRECATED*", CONFIG_DEFAULT }, "Scrollbar width *DEPRECATED*", 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, "fake-background", { .str = &config.fake_background }, NULL, { xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT }, "Background to use for fake transparency. (background or screenshot)", 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) *DEPRECATED*", CONFIG_DEFAULT }, "Window Format. w (desktop name), t (title), n (name), r (role), c (class) *DEPRECATED*", 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_Number, "max-history-size", { .num = &config.max_history_size }, NULL, { xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL,
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT }, "Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
{ xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL, { xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL,
"Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT }, "Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT },
}; };