From: Mateusz Poszwa Date: Mon, 8 Aug 2011 19:51:21 +0000 (+0200) Subject: Add new_float config option. X-Git-Tag: 4.1~229^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=42db9de7ec1c0b82ced3fa08abd238c5ba12d844;p=i3%2Fi3 Add new_float config option. This option sets the default border style for containers automatically put into floating mode. Fixes #264 --- diff --git a/include/config.h b/include/config.h index 1021a612..3234b91e 100644 --- a/include/config.h +++ b/include/config.h @@ -126,6 +126,9 @@ struct Config { /** The default border style for new windows. */ border_style_t default_border; + /** The default border style for new floating windows. */ + border_style_t default_floating_border; + /** The modifier which needs to be pressed in combination with your mouse * buttons to do things with floating windows (move, resize) */ uint32_t floating_modifier; diff --git a/src/cfgparse.l b/src/cfgparse.l index 4cf1a1c3..e29f6efc 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -118,6 +118,7 @@ vertical { return TOK_VERT; } auto { return TOK_AUTO; } workspace_layout { return TOK_WORKSPACE_LAYOUT; } new_window { return TOKNEWWINDOW; } +new_float { return TOKNEWFLOAT; } normal { return TOK_NORMAL; } none { return TOK_NONE; } 1pixel { return TOK_1PIXEL; } diff --git a/src/cfgparse.y b/src/cfgparse.y index 68173757..4a4c26ca 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -579,6 +579,7 @@ void parse_file(const char *f) { %token TOK_AUTO "auto" %token TOK_WORKSPACE_LAYOUT "workspace_layout" %token TOKNEWWINDOW "new_window" +%token TOKNEWFLOAT "new_float" %token TOK_NORMAL "normal" %token TOK_NONE "none" %token TOK_1PIXEL "1pixel" @@ -610,6 +611,7 @@ void parse_file(const char *f) { %type layout_mode %type border_style %type new_window +%type new_float %type colorpixel %type bool %type popup_setting @@ -634,6 +636,7 @@ line: | orientation | workspace_layout | new_window + | new_float | focus_follows_mouse | force_focus_wrapping | workspace_bar @@ -924,6 +927,14 @@ new_window: } ; +new_float: + TOKNEWFLOAT border_style + { + DLOG("new floating windows should start with border style %d\n", $2); + config.default_floating_border = $2; + } + ; + border_style: TOK_NORMAL { $$ = BS_NORMAL; } | TOK_NONE { $$ = BS_NONE; } diff --git a/src/config.c b/src/config.c index 14fc6e02..b3a20442 100644 --- a/src/config.c +++ b/src/config.c @@ -333,6 +333,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, INIT_COLOR(config.bar.urgent, "#2f343a", "#900000", "#ffffff"); config.default_border = BS_NORMAL; + config.default_floating_border = BS_NORMAL; /* Set default_orientation to NO_ORIENTATION for auto orientation. */ config.default_orientation = NO_ORIENTATION; diff --git a/src/floating.c b/src/floating.c index b394f315..2ba08330 100644 --- a/src/floating.c +++ b/src/floating.c @@ -129,6 +129,10 @@ void floating_enable(Con *con, bool automatic) { con->percent = 1.0; con->floating = FLOATING_USER_ON; + /* 4: set the border style as specified with new_float */ + if (automatic) + con->border_style = config.default_floating_border; + /* Some clients (like GIMP’s color picker window) get mapped * to (0, 0), so we push them to a reasonable position * (centered over their leader) */