smart placement
This commit is contained in:
23
cerberus.c
23
cerberus.c
@@ -296,8 +296,8 @@ void spot_xywh(int spot, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
spot = MAX(SPOT1, MIN(SPOT3, spot));
|
||||
|
||||
int width_spot1 = (double)screen_w / 100 * SPOT1_WIDTH_PCT;
|
||||
int height_spot2 = (double)screen_h / 100 * SPOT2_HEIGHT_PCT;
|
||||
int width_spot1 = (double)screen_w / 100 * MIN(90, MAX(10, SPOT1_WIDTH_PCT));
|
||||
int height_spot2 = (double)screen_h / 100 * MIN(90, MAX(10, SPOT2_HEIGHT_PCT));
|
||||
|
||||
// default, left 2/3 of screen
|
||||
*x = screen_x, *y = screen_y, *w = width_spot1, *h = screen_h;
|
||||
@@ -536,7 +536,24 @@ void map_request(XMapEvent *e)
|
||||
{
|
||||
client_review(c);
|
||||
|
||||
int spot = SPOT_START == SPOT_CURRENT ? current_spot: SPOT_START;
|
||||
int spot = SPOT_START;
|
||||
|
||||
if (SPOT_START == SPOT_CURRENT)
|
||||
spot = current_spot;
|
||||
|
||||
if (SPOT_START == SPOT_SMART)
|
||||
{
|
||||
int x, y, w, h;
|
||||
spot = SPOT1;
|
||||
|
||||
spot_xywh(SPOT2, &x, &y, &w, &h);
|
||||
if (c->attr.width <= w && c->attr.height <= h)
|
||||
spot = SPOT2;
|
||||
|
||||
spot_xywh(SPOT3, &x, &y, &w, &h);
|
||||
if (c->attr.width <= w && c->attr.height <= h)
|
||||
spot = SPOT3;
|
||||
}
|
||||
client_spot(c, spot, 0);
|
||||
}
|
||||
client_free(c);
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef struct {
|
||||
|
||||
enum {
|
||||
SPOT_CURRENT,
|
||||
SPOT_SMART,
|
||||
SPOT1, // large left pane
|
||||
SPOT2, // medium top right pane
|
||||
SPOT3 // small bottom right pane
|
||||
|
||||
14
config.h
14
config.h
@@ -2,7 +2,19 @@
|
||||
#define BORDER 2
|
||||
#define BORDER_BLUR "Dark Gray"
|
||||
#define BORDER_FOCUS "Royal Blue"
|
||||
#define SPOT_START SPOT1
|
||||
|
||||
// new windows go to the same tile as the active window.
|
||||
// this implies auto-raise and focus stealing.
|
||||
//#define SPOT_START SPOT_CURRENT
|
||||
|
||||
// new windows go to the tile of best fit.
|
||||
// works best when apps remember their size.
|
||||
// if tile is not current, window won't steal focus.
|
||||
#define SPOT_START SPOT_SMART
|
||||
|
||||
// all new windows go to a specific tile.
|
||||
// if tile is not current, window won't steal focus.
|
||||
//#define SPOT_START SPOT1
|
||||
|
||||
#define SPOT1_WIDTH_PCT 67
|
||||
#define SPOT2_HEIGHT_PCT 67
|
||||
|
||||
Reference in New Issue
Block a user