diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-04-29 21:42:31 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-04-29 21:42:31 +0200 |
commit | 09d1955338ea8c0d491ab0b286a4762cdbae9da2 (patch) | |
tree | 39a86150a209cd9c9fc7f2ea3de77f2268d23795 | |
parent | 91e68f4ded19ffb025f5347156cdf64d2e4c4e7f (diff) |
Issue: #395 adding more options.
-rw-r--r-- | doc/rofi-manpage.markdown | 2 | ||||
-rw-r--r-- | doc/rofi.1 | 6 | ||||
-rw-r--r-- | source/x11-helper.c | 18 |
3 files changed, 19 insertions, 7 deletions
diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 515dfb01..22c83f91 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -380,6 +380,8 @@ Negative numbers are handled differently: * **-2**: the currently focused window (i.e. rofi will be displayed on top of the focused window). * **-3**: Position at mouse (still follows the location setting, use `-location 1` to get normal context menu behaviour.) + * **-4**: the monitor with the focused window. + * **-5**: the monitor that shows the mouse pointer. Default: *-1* @@ -635,6 +635,12 @@ Select (Xinerama) monitor to display \fBrofi\fR on\. Negative numbers are handle .IP "\(bu" 4 \fB\-3\fR: Position at mouse (still follows the location setting, use \fB\-location 1\fR to get normal context menu behaviour\.) . +.IP "\(bu" 4 +\fB\-4\fR: the monitor with the focused window\. +. +.IP "\(bu" 4 +\fB\-5\fR: the monitor that shows the mouse pointer\. +. .IP Default: \fI\-1\fR . diff --git a/source/x11-helper.c b/source/x11-helper.c index 09306deb..9ccb5871 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -259,7 +259,7 @@ void monitor_active ( workarea *mon ) } // Get the current desktop. unsigned int current_desktop = 0; - if ( config.monitor != -2 && xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, + if ( config.monitor == -1 && xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr ), ¤t_desktop, NULL ) ) { xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport ( &xcb->ewmh, xcb->screen_nbr ); @@ -282,10 +282,10 @@ void monitor_active ( workarea *mon ) xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb->connection, active_window ); xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb->connection, c, NULL ); if ( r ) { - if ( config.monitor == -2 ) { - xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates ( xcb->connection, active_window, root, r->x, r->y ); - xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb->connection, ct, NULL ); - if ( t ) { + xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates ( xcb->connection, active_window, root, r->x, r->y ); + xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb->connection, ct, NULL ); + if ( t ) { + if ( config.monitor == -2 ) { // place the menu above the window // if some window is focused, place menu above window, else fall // back to selected monitor. @@ -300,11 +300,15 @@ void monitor_active ( workarea *mon ) free ( r ); free ( t ); return; + } else if ( config.monitor == -4 ){ + monitor_dimensions ( t->dst_x, t->dst_y, mon ); + free(r); + free(t); + return; + } } - monitor_dimensions ( r->x, r->y, mon ); free ( r ); - return; } } if ( pointer_get ( root, &x, &y ) ) { |