1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

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,
.regex = FALSE,
/** Monitor */
.monitor = "-1",
.monitor = "-5",
/** set line margin */
.line_margin = 2,
/** Set filter */

View file

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

View file

@ -49,6 +49,13 @@
#include "rofi.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_screen_t *xcb_screen;
static int stored_argc = 0;
@ -482,7 +489,14 @@ int config_sanity_check ( void )
ssize = MIN ( mon.w, mon.h );
}
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;
}
// Have todo an estimate here.