From bd49c80d5f70f2b379aff74ff5af618c94da7871 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 10 Jun 2011 02:06:47 +0200 Subject: [PATCH] CONFIG BREAK: rename 'mode floating/tiling' to 'floating enable/disable' The three different variants now: floating enable floating disable floating toggle --- docs/userguide | 6 +++--- i3.config | 2 +- src/cmdparse.l | 7 +++++++ src/cmdparse.y | 20 +++++++++++--------- testcases/t/32-move-workspace.t | 2 +- testcases/t/46-floating-reinsert.t | 4 ++-- testcases/t/53-floating-originalsize.t | 2 +- testcases/t/55-floating-split-size.t | 2 +- 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/docs/userguide b/docs/userguide index 86319974..bf0e84a2 100644 --- a/docs/userguide +++ b/docs/userguide @@ -611,8 +611,8 @@ focus_follows_mouse no To change the layout of the current container to stacking, use +layout stacking+, for default use +layout default+ and for tabbed, use +layout tabbed+. To make the current client (!) fullscreen, use +fullscreen+, to make -it floating (or tiling again) use +mode floating+ respectively +mode tiling+ -(or +mode toggle+): +it floating (or tiling again) use +floating enable+ respectively +floating disable+ +(or +floating toggle+): *Examples*: -------------- @@ -624,7 +624,7 @@ bindsym Mod1+w layout tabbed bindsym Mod1+f fullscreen # Toggle floating/tiling -bindsym Mod1+t mode toggle +bindsym Mod1+t floating toggle -------------- === Focusing/Moving containers diff --git a/i3.config b/i3.config index 72399dfa..1ce396de 100644 --- a/i3.config +++ b/i3.config @@ -38,7 +38,7 @@ bindsym Mod1+w layout tabbed bindsym Mod1+l layout default # toggle tiling / floating -bindsym Mod1+Shift+space mode toggle +bindsym Mod1+Shift+space floating toggle # focus the parent container bindsym Mod1+u focus parent diff --git a/src/cmdparse.l b/src/cmdparse.l index 545def7d..6c57984e 100644 --- a/src/cmdparse.l +++ b/src/cmdparse.l @@ -140,6 +140,13 @@ nop { WS_STRING; return TOK_NOP; } restore { WS_STRING; return TOK_RESTORE; } mark { WS_STRING; return TOK_MARK; } +enable { return TOK_ENABLE; } +true { return TOK_ENABLE; } +yes { return TOK_ENABLE; } +disable { return TOK_DISABLE; } +false { return TOK_DISABLE; } +no { return TOK_DISABLE; } + class { BEGIN(WANT_QSTRING); return TOK_CLASS; } id { BEGIN(WANT_QSTRING); return TOK_ID; } con_id { BEGIN(WANT_QSTRING); return TOK_CON_ID; } diff --git a/src/cmdparse.y b/src/cmdparse.y index 8cf7858b..0738d0c9 100644 --- a/src/cmdparse.y +++ b/src/cmdparse.y @@ -135,6 +135,8 @@ char *parse_cmd(const char *new) { %token TOK_MODE "mode" %token TOK_TILING "tiling" %token TOK_FLOATING "floating" +%token TOK_ENABLE "enable" +%token TOK_DISABLE "disable" %token TOK_WORKSPACE "workspace" %token TOK_TOGGLE "toggle" %token TOK_FOCUS "focus" @@ -170,7 +172,7 @@ char *parse_cmd(const char *new) { %type direction %type level -%type window_mode +%type boolean %type border_style %type layout_mode %type resize_px @@ -345,7 +347,7 @@ operation: | open | fullscreen | split - | mode + | floating | mark | resize | nop @@ -541,8 +543,8 @@ direction: | 'v' { $$ = 'v'; } ; -mode: - TOK_MODE window_mode +floating: + TOK_FLOATING boolean { HANDLE_EMPTY_MATCH; @@ -554,7 +556,7 @@ mode: toggle_floating_mode(current->con, false); } else { printf("should switch mode to %s\n", ($2 == TOK_FLOATING ? "floating" : "tiling")); - if ($2 == TOK_FLOATING) { + if ($2 == TOK_ENABLE) { floating_enable(current->con, false); } else { floating_disable(current->con, false); @@ -566,10 +568,10 @@ mode: } ; -window_mode: - TOK_FLOATING { $$ = TOK_FLOATING; } - | TOK_TILING { $$ = TOK_TILING; } - | TOK_TOGGLE { $$ = TOK_TOGGLE; } +boolean: + TOK_ENABLE { $$ = TOK_ENABLE; } + | TOK_DISABLE { $$ = TOK_DISABLE; } + | TOK_TOGGLE { $$ = TOK_TOGGLE; } ; border: diff --git a/testcases/t/32-move-workspace.t b/testcases/t/32-move-workspace.t index affd18f2..93bd4f8f 100644 --- a/testcases/t/32-move-workspace.t +++ b/testcases/t/32-move-workspace.t @@ -47,7 +47,7 @@ $tmp2 = get_unused_workspace(); cmd "workspace $tmp"; cmd "open"; -cmd "mode toggle"; +cmd "floating toggle"; my $ws = get_ws($tmp); is(@{$ws->{nodes}}, 0, 'no nodes on workspace'); diff --git a/testcases/t/46-floating-reinsert.t b/testcases/t/46-floating-reinsert.t index b75c08e1..a4e90d4d 100644 --- a/testcases/t/46-floating-reinsert.t +++ b/testcases/t/46-floating-reinsert.t @@ -54,10 +54,10 @@ is(@{$nodes->[1]->{nodes}}, 2, 'two windows in split con'); # 2: make it tiling, see where it ends up ############################################################################# -cmd 'mode toggle'; +cmd 'floating toggle'; my ($nodes, $focus) = get_ws_content($tmp); -is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after mode toggle'); +is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after floating toggle'); done_testing; diff --git a/testcases/t/53-floating-originalsize.t b/testcases/t/53-floating-originalsize.t index 16694593..16e62c20 100644 --- a/testcases/t/53-floating-originalsize.t +++ b/testcases/t/53-floating-originalsize.t @@ -29,7 +29,7 @@ ok($window->mapped, 'Window is mapped'); cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width'); cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height'); -cmd 'mode toggle'; +cmd 'floating toggle'; sleep 0.25; ($absolute, $top) = $window->rect; diff --git a/testcases/t/55-floating-split-size.t b/testcases/t/55-floating-split-size.t index 3ff1d8f3..c6f42b97 100644 --- a/testcases/t/55-floating-split-size.t +++ b/testcases/t/55-floating-split-size.t @@ -49,7 +49,7 @@ sleep 0.25; ##################################################################### cmd 'nop setting floating'; cmd 'focus parent'; -cmd 'mode floating'; +cmd 'floating enable'; ##################################################################### # Get geometry of the first floating node (the split container) -- 2.39.5