Skip to content

Commit

Permalink
#130 float native macOS fullscreen spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Jul 14, 2019
1 parent 84506d5 commit 88bc334
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Float native macOS fullscreen spaces [#130](https://github.com/koekeishiya/yabai/issues/130)

## [1.1.1] - 2019-07-14
### Changed
Expand Down
30 changes: 23 additions & 7 deletions src/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,20 @@ static void handle_domain_config(FILE *rsp, struct token domain, char *message)
if (!token_is_valid(value)) {
fprintf(rsp, "%s\n", view_type_str[view->layout]);
} else if (token_equals(value, ARGUMENT_CONFIG_LAYOUT_BSP)) {
view->layout = VIEW_BSP;
view->custom_layout = true;
window_manager_check_for_windows_on_space(&g_space_manager, &g_window_manager, sel_sid);
if (space_is_user(sel_sid)) {
view->layout = VIEW_BSP;
view->custom_layout = true;
window_manager_check_for_windows_on_space(&g_space_manager, &g_window_manager, sel_sid);
} else {
daemon_fail(rsp, "cannot set layout for a macOS fullscreen space!\n");
}
} else if (token_equals(value, ARGUMENT_CONFIG_LAYOUT_FLOAT)) {
view->layout = VIEW_FLOAT;
view->custom_layout = true;
if (space_is_user(sel_sid)) {
view->layout = VIEW_FLOAT;
view->custom_layout = true;
} else {
daemon_fail(rsp, "cannot set layout for a macOS fullscreen space!\n");
}
} else {
daemon_fail(rsp, "unknown value '%.*s' given to command '%.*s' for domain '%.*s'\n", value.length, value.text, command.length, command.text, domain.length, domain.text);
}
Expand Down Expand Up @@ -1233,9 +1241,17 @@ static void handle_domain_space(FILE *rsp, struct token domain, char *message)
} else if (token_equals(command, COMMAND_SPACE_LAYOUT)) {
struct token value = get_token(&message);
if (token_equals(value, ARGUMENT_SPACE_LAYOUT_BSP)) {
space_manager_set_layout_for_space(&g_space_manager, acting_sid, VIEW_BSP);
if (space_is_user(acting_sid)) {
space_manager_set_layout_for_space(&g_space_manager, acting_sid, VIEW_BSP);
} else {
daemon_fail(rsp, "cannot set layout for a macOS fullscreen space!\n");
}
} else if (token_equals(value, ARGUMENT_SPACE_LAYOUT_FLT)) {
space_manager_set_layout_for_space(&g_space_manager, acting_sid, VIEW_FLOAT);
if (space_is_user(acting_sid)) {
space_manager_set_layout_for_space(&g_space_manager, acting_sid, VIEW_FLOAT);
} else {
daemon_fail(rsp, "cannot set layout for a macOS fullscreen space!\n");
}
} else {
daemon_fail(rsp, "unknown value '%.*s' given to command '%.*s' for domain '%.*s'\n", value.length, value.text, command.length, command.text, domain.length, domain.text);
}
Expand Down
12 changes: 7 additions & 5 deletions src/space_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ void space_manager_set_layout_for_all_spaces(struct space_manager *sm, enum view
if (bucket->value) {
struct view *view = bucket->value;
if (!view->custom_layout) {
view->layout = layout;
if (view->layout == VIEW_BSP) {
window_manager_check_for_windows_on_space(sm, &g_window_manager, view->sid);
} else if (view->layout == VIEW_FLOAT) {
view_clear(view);
if (space_is_user(view->sid)) {
view->layout = layout;
if (view->layout == VIEW_BSP) {
window_manager_check_for_windows_on_space(sm, &g_window_manager, view->sid);
} else if (view->layout == VIEW_FLOAT) {
view_clear(view);
}
}
}
}
Expand Down
18 changes: 11 additions & 7 deletions src/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,17 @@ struct view *view_create(uint64_t sid)
view->enable_gap = true;
view->sid = sid;

if (!view->custom_layout) view->layout = g_space_manager.layout;
if (!view->custom_top_padding) view->top_padding = g_space_manager.top_padding;
if (!view->custom_bottom_padding) view->bottom_padding = g_space_manager.bottom_padding;
if (!view->custom_left_padding) view->left_padding = g_space_manager.left_padding;
if (!view->custom_right_padding) view->right_padding = g_space_manager.right_padding;
if (!view->custom_window_gap) view->window_gap = g_space_manager.window_gap;
view_update(view);
if (space_is_user(view->sid)) {
if (!view->custom_layout) view->layout = g_space_manager.layout;
if (!view->custom_top_padding) view->top_padding = g_space_manager.top_padding;
if (!view->custom_bottom_padding) view->bottom_padding = g_space_manager.bottom_padding;
if (!view->custom_left_padding) view->left_padding = g_space_manager.left_padding;
if (!view->custom_right_padding) view->right_padding = g_space_manager.right_padding;
if (!view->custom_window_gap) view->window_gap = g_space_manager.window_gap;
view_update(view);
} else {
view->layout = VIEW_FLOAT;
}

return view;
}
Expand Down

0 comments on commit 88bc334

Please sign in to comment.