Issue 448, Take another default that should not fail, better error mesg

This commit is contained in:
Dave Davenport 2016-08-19 18:01:26 +02:00
parent a5acff542d
commit 6225b29d94
3 changed files with 17 additions and 3 deletions

View File

@ -112,7 +112,7 @@ Settings config = {
.tokenize = TRUE, .tokenize = TRUE,
.regex = FALSE, .regex = FALSE,
/** Monitor */ /** Monitor */
.monitor = "-1", .monitor = "-5",
/** set line margin */ /** set line margin */
.line_margin = 2, .line_margin = 2,
/** Set filter */ /** Set filter */

View File

@ -388,7 +388,7 @@ detection). Negative numbers are handled differently:
* **-4**: the monitor with the focused window. * **-4**: the monitor with the focused window.
* **-5**: the monitor that shows the mouse pointer. * **-5**: the monitor that shows the mouse pointer.
Default: *-1* Default: *-5*
See `rofi -h` output for the detected monitors, their position and size. See `rofi -h` output for the detected monitors, their position and size.

View File

@ -49,6 +49,13 @@
#include "rofi.h" #include "rofi.h"
#include "view.h" #include "view.h"
const char *const monitor_position_entries[] = {
"on focused monitor",
"on focused window",
"at mouse pointer",
"on monitor with focused window",
"on monitor that has mouse pointer"
};
extern xcb_connection_t *xcb_connection; extern xcb_connection_t *xcb_connection;
extern xcb_screen_t *xcb_screen; extern xcb_screen_t *xcb_screen;
static int stored_argc = 0; static int stored_argc = 0;
@ -482,7 +489,14 @@ int config_sanity_check ( void )
ssize = MIN ( mon.w, mon.h ); ssize = MIN ( mon.w, mon.h );
} }
else{ else{
g_string_append_printf ( msg, "\t<b>config.monitor</b>=%s Could not find monitor.\n", config.monitor ); const char *name = config.monitor;
if ( name && name[0] == '-' ) {
int index = name[1] - '0';
if ( index < 5 && index > 0 ) {
name = monitor_position_entries[index - 1];
}
}
g_string_append_printf ( msg, "\t<b>config.monitor</b>=%s Could not find monitor.\n", name );
ssize = 0; ssize = 0;
} }
// Have todo an estimate here. // Have todo an estimate here.