From 48a983316c01d9ccd9fdd7aab56ee4e779654915 Mon Sep 17 00:00:00 2001
From: taiyu <taiyu.len@gmail.com>
Date: Wed, 19 Aug 2015 13:02:29 -0700
Subject: [PATCH 1/2] floating mode_toggle

---
 sway/commands.c | 11 +++++++++++
 sway/handlers.c |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/sway/commands.c b/sway/commands.c
index aafa51f3..f87ab0e5 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -231,6 +231,17 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) {
 			return true;
 		}
 		set_focused_container(view);
+	} else if (strcasecmp(argv[0], "mode_toggle") == 0) {
+		if (get_focused_view(active_workspace)->is_floating) {
+			if (active_workspace->children->length > 0) {
+				set_focused_container(get_focused_view(active_workspace->children->items[0]));
+			}
+		} else {
+			if (active_workspace->floating->length > 0) {
+				swayc_t *floating = active_workspace->floating->items[active_workspace->floating->length-1];
+				set_focused_container(get_focused_view(floating));
+			}
+		}
 	}
 
 	return true;
diff --git a/sway/handlers.c b/sway/handlers.c
index 7b82fd03..75adf7dd 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -316,6 +316,9 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
 	}
 	bool cmd_success = false;
 
+	sway_log(L_DEBUG, "modifier %x: state %d: key %d, sym: %d",
+			modifiers->mods, state, key, sym);
+
 	if ((modifiers->mods & config->floating_mod) && (dragging || resizing)) {
 		reset_floating(get_focused_view(&root_container));
 	}

From 6cc29ebbf53503a2ea72545fcdd495f5c1a89dfc Mon Sep 17 00:00:00 2001
From: taiyu <taiyu.len@gmail.com>
Date: Wed, 19 Aug 2015 13:10:58 -0700
Subject: [PATCH 2/2] man page update

---
 sway.5.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sway.5.txt b/sway.5.txt
index b03fb73e..9c40558b 100644
--- a/sway.5.txt
+++ b/sway.5.txt
@@ -41,6 +41,9 @@ Commands
 **floating** toggle::
 	Toggles the "floating" status of the focused view.
 
+**floating** mode_toggle::
+	Toggles focus between floating view and tiled view.
+
 **focus** <direction>::
 	Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The
 	directional focus commands will move the focus in that direction. The parent