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

Issue: #395 adding more options.

This commit is contained in:
Dave Davenport 2016-04-29 21:42:31 +02:00
parent 91e68f4ded
commit 09d1955338
3 changed files with 19 additions and 7 deletions

View file

@ -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). * **-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 * **-3**: Position at mouse (still follows the location setting, use `-location 1` to get normal context menu
behaviour.) behaviour.)
* **-4**: the monitor with the focused window.
* **-5**: the monitor that shows the mouse pointer.
Default: *-1* Default: *-1*

View file

@ -635,6 +635,12 @@ Select (Xinerama) monitor to display \fBrofi\fR on\. Negative numbers are handle
.IP "\(bu" 4 .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\.) \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 .IP
Default: \fI\-1\fR Default: \fI\-1\fR
. .

View file

@ -259,7 +259,7 @@ void monitor_active ( workarea *mon )
} }
// Get the current desktop. // Get the current desktop.
unsigned int current_desktop = 0; 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 ), xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr ),
&current_desktop, NULL ) ) { &current_desktop, NULL ) ) {
xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport ( &xcb->ewmh, xcb->screen_nbr ); 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_cookie_t c = xcb_get_geometry ( xcb->connection, active_window );
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb->connection, c, NULL ); xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb->connection, c, NULL );
if ( r ) { 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_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 ); xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb->connection, ct, NULL );
if ( t ) { if ( t ) {
if ( config.monitor == -2 ) {
// place the menu above the window // place the menu above the window
// if some window is focused, place menu above window, else fall // if some window is focused, place menu above window, else fall
// back to selected monitor. // back to selected monitor.
@ -300,11 +300,15 @@ void monitor_active ( workarea *mon )
free ( r ); free ( r );
free ( t ); free ( t );
return; return;
} } else if ( config.monitor == -4 ){
} monitor_dimensions ( t->dst_x, t->dst_y, mon );
monitor_dimensions ( r->x, r->y, mon ); free(r);
free ( r ); free(t);
return; return;
}
}
free ( r );
} }
} }
if ( pointer_get ( root, &x, &y ) ) { if ( pointer_get ( root, &x, &y ) ) {