diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-19 13:02:29 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-19 13:02:29 -0700 |
commit | 48a983316c01d9ccd9fdd7aab56ee4e779654915 (patch) | |
tree | 326341b615dcdd6c2c4502399331be0538b4318f | |
parent | Minor style fix (diff) | |
download | sway-48a983316c01d9ccd9fdd7aab56ee4e779654915.tar.gz sway-48a983316c01d9ccd9fdd7aab56ee4e779654915.tar.zst sway-48a983316c01d9ccd9fdd7aab56ee4e779654915.zip |
floating mode_toggle
-rw-r--r-- | sway/commands.c | 11 | ||||
-rw-r--r-- | sway/handlers.c | 3 |
2 files changed, 14 insertions, 0 deletions
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 | } |