summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
authorThorsten Wißmann <edu@thorsten-wissmann.de>2015-08-17 18:32:17 +0200
committerThorsten Wißmann <edu@thorsten-wissmann.de>2015-08-17 18:32:17 +0200
commitcf731b1504b66af6b6c0b0e8d99cd044cc046bb0 (patch)
tree2a963646661d3e71c6fab8ce4f61b9c7e05f2fb4 /source/x11-helper.c
parentfbb2e34aabcc694f7b2088fc85dba4d9326fdc95 (diff)
Monitor -2 stands for the focused window
When setting rofi's monitor to -2, rofi is placed over the focused window.
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r--source/x11-helper.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 907e0af4..5bd1c675 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -241,6 +241,20 @@ void monitor_active ( Display *display, workarea *mon )
-attr.border_width,
-attr.border_width,
&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 );
return;
}