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

Monitor -2 stands for the focused window

When setting rofi's monitor to -2, rofi is placed over the focused
window.
This commit is contained in:
Thorsten Wißmann 2015-08-17 18:32:17 +02:00
parent fbb2e34aab
commit cf731b1504
3 changed files with 22 additions and 4 deletions

View file

@ -406,7 +406,9 @@ The following options are further explained in the theming section:
`-m` *num* `-m` *num*
`-monitor` *num* `-monitor` *num*
Select (Xinerama) monitor to display **rofi** on. Select (Xinerama) monitor to display **rofi** on. The special number -1 denotes the currently focused monitor, the number -2 denotes the currently focused window (i.e. rofi will be displayed on top of the focused window).
Default: *-1*
### PATTERN setting ### PATTERN setting

View file

@ -741,9 +741,11 @@ When one entry is left, automatically select this\.
. .
.IP "" 4 .IP "" 4
. .
.nf .P
Select (Xinerama) monitor to display **rofi** on\. The special number -1 denotes the currently focused monitor, the number -2 denotes the currently focused window (i.e. rofi will be displayed on top of the focused window).
Select (Xinerama) monitor to display **rofi** on\. .
.P
Default: \fI{cmd}\fR
. .
.fi .fi
. .

View file

@ -241,6 +241,20 @@ void monitor_active ( Display *display, workarea *mon )
-attr.border_width, -attr.border_width,
-attr.border_width, -attr.border_width,
&x, &y, &junkwin ) == True ) { &x, &y, &junkwin ) == True ) {
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.
mon->x = x;
mon->y = y;
mon->w = attr.width;
mon->h = attr.height;
mon->t = attr.border_width;
mon->b = attr.border_width;
mon->l = attr.border_width;
mon->r = attr.border_width;
return;
}
monitor_dimensions ( display, screen, x, y, mon ); monitor_dimensions ( display, screen, x, y, mon );
return; return;
} }