Add new_float config option.

This option sets the default border style for containers automatically put into floating mode.

Fixes #264
This commit is contained in:
Mateusz Poszwa 2011-08-08 21:51:21 +02:00 committed by Michael Stapelberg
parent cd5ebc2dca
commit 42db9de7ec
5 changed files with 20 additions and 0 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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 <number> layout_mode
%type <number> border_style
%type <number> new_window
%type <number> new_float
%type <number> colorpixel
%type <number> bool
%type <number> 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; }

View File

@ -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;

View File

@ -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 GIMPs color picker window) get mapped
* to (0, 0), so we push them to a reasonable position
* (centered over their leader) */