aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-29 11:06:07 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-29 11:08:19 +1000
commit415a48ac6387a62a59adb8ed1168e851509a0ce3 (patch)
treefd0027a67439414e164318182be29a3529805543 /sway/tree/workspace.c
parentMerge pull request #2724 from RedSoxFan/update-man-pages (diff)
downloadsway-415a48ac6387a62a59adb8ed1168e851509a0ce3.tar.gz
sway-415a48ac6387a62a59adb8ed1168e851509a0ce3.tar.zst
sway-415a48ac6387a62a59adb8ed1168e851509a0ce3.zip
Make gaps implementation consistent with i3-gaps
This changes our gaps implementation to behave like i3-gaps. Our previous implementation allowed you to set gaps on a per container basis. This isn't supported by i3-gaps and doesn't seem to have a practical use case. The gaps_outer and gaps_inner properties on containers are now removed as they just read the gaps_inner from the workspace. `gaps inner|outer <px>` no longer changes the gaps for all workspaces. It only sets defaults for new workspaces. `gaps inner|outer current|workspace|all set|plus|minus <px>` is now runtime only, and the workspace option is now removed. `current` now sets gaps for the current workspace as opposed to the current container. `workspace <ws> gaps inner|outer <px>` is now implemented. This sets defaults for a workspace. This also fixes a bug where changing the layout of a split container from linear to tabbed would cause gaps to not be applied to it until you switch to another workspace and back.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index d65a3e4c..9dd5c815 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -68,6 +68,20 @@ struct sway_workspace *workspace_create(struct sway_output *output,
68 ws->output_priority = create_list(); 68 ws->output_priority = create_list();
69 workspace_output_add_priority(ws, output); 69 workspace_output_add_priority(ws, output);
70 70
71 ws->gaps_outer = config->gaps_outer;
72 ws->gaps_inner = config->gaps_inner;
73 if (name) {
74 struct workspace_config *wsc = workspace_find_config(name);
75 if (wsc) {
76 if (wsc->gaps_outer != -1) {
77 ws->gaps_outer = wsc->gaps_outer;
78 }
79 if (wsc->gaps_inner != -1) {
80 ws->gaps_inner = wsc->gaps_inner;
81 }
82 }
83 }
84
71 output_add_workspace(output, ws); 85 output_add_workspace(output, ws);
72 output_sort_workspaces(output); 86 output_sort_workspaces(output);
73 87
@@ -632,13 +646,13 @@ void workspace_add_gaps(struct sway_workspace *ws) {
632 return; 646 return;
633 } 647 }
634 648
635 ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer; 649 ws->current_gaps = ws->gaps_outer;
636 650
637 if (ws->layout == L_TABBED || ws->layout == L_STACKED) { 651 if (ws->layout == L_TABBED || ws->layout == L_STACKED) {
638 // We have to add inner gaps for this, because children of tabbed and 652 // We have to add inner gaps for this, because children of tabbed and
639 // stacked containers don't apply their own gaps - they assume the 653 // stacked containers don't apply their own gaps - they assume the
640 // tabbed/stacked container is using gaps. 654 // tabbed/stacked container is using gaps.
641 ws->current_gaps += ws->has_gaps ? ws->gaps_inner : config->gaps_inner; 655 ws->current_gaps += ws->gaps_inner;
642 } 656 }
643 657
644 ws->x += ws->current_gaps; 658 ws->x += ws->current_gaps;