diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-19 16:15:38 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-19 16:15:38 -0400 |
commit | 532598947d2e995983017846cff66aea1ab63e95 (patch) | |
tree | 8a77cad250649625eddce7af3da1645100a3a9fa | |
parent | Minor style fix (diff) | |
parent | man page update (diff) | |
download | sway-532598947d2e995983017846cff66aea1ab63e95.tar.gz sway-532598947d2e995983017846cff66aea1ab63e95.tar.zst sway-532598947d2e995983017846cff66aea1ab63e95.zip |
Merge pull request #90 from taiyu-len/master
floating mode_toggle
-rw-r--r-- | sway.5.txt | 3 | ||||
-rw-r--r-- | sway/commands.c | 11 | ||||
-rw-r--r-- | sway/handlers.c | 3 |
3 files changed, 17 insertions, 0 deletions
@@ -41,6 +41,9 @@ Commands | |||
41 | **floating** toggle:: | 41 | **floating** toggle:: |
42 | Toggles the "floating" status of the focused view. | 42 | Toggles the "floating" status of the focused view. |
43 | 43 | ||
44 | **floating** mode_toggle:: | ||
45 | Toggles focus between floating view and tiled view. | ||
46 | |||
44 | **focus** <direction>:: | 47 | **focus** <direction>:: |
45 | Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The | 48 | Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The |
46 | directional focus commands will move the focus in that direction. The parent | 49 | directional focus commands will move the focus in that direction. The parent |
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) { | |||
231 | return true; | 231 | return true; |
232 | } | 232 | } |
233 | set_focused_container(view); | 233 | set_focused_container(view); |
234 | } else if (strcasecmp(argv[0], "mode_toggle") == 0) { | ||
235 | if (get_focused_view(active_workspace)->is_floating) { | ||
236 | if (active_workspace->children->length > 0) { | ||
237 | set_focused_container(get_focused_view(active_workspace->children->items[0])); | ||
238 | } | ||
239 | } else { | ||
240 | if (active_workspace->floating->length > 0) { | ||
241 | swayc_t *floating = active_workspace->floating->items[active_workspace->floating->length-1]; | ||
242 | set_focused_container(get_focused_view(floating)); | ||
243 | } | ||
244 | } | ||
234 | } | 245 | } |
235 | 246 | ||
236 | return true; | 247 | 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 | |||
316 | } | 316 | } |
317 | bool cmd_success = false; | 317 | bool cmd_success = false; |
318 | 318 | ||
319 | sway_log(L_DEBUG, "modifier %x: state %d: key %d, sym: %d", | ||
320 | modifiers->mods, state, key, sym); | ||
321 | |||
319 | if ((modifiers->mods & config->floating_mod) && (dragging || resizing)) { | 322 | if ((modifiers->mods & config->floating_mod) && (dragging || resizing)) { |
320 | reset_floating(get_focused_view(&root_container)); | 323 | reset_floating(get_focused_view(&root_container)); |
321 | } | 324 | } |