-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce stacking|tabbed_titlebar commands
Stacking and tabbed layouts effectively override the titlebar control of the border command, always showing the titlebar to allow navigation. Allow users to also hide the titlebar of stacking/tabbed layouts, through new commands that specify whether titlebars for these layouts should always be visible (the default) or if they should follow the active container's border configuration.
- Loading branch information
1 parent
c30c451
commit 5b855f7
Showing
11 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "log.h" | ||
#include "sway/commands.h" | ||
#include "sway/config.h" | ||
#include "sway/tree/container.h" | ||
|
||
struct cmd_results *cmd_default_stacking_titlebar(int argc, char **argv) { | ||
struct cmd_results *error = NULL; | ||
if ((error = checkarg(argc, "default_stacking_titlebar", EXPECTED_EQUAL_TO, 1))) { | ||
return error; | ||
} | ||
|
||
if (strcmp(argv[0], "always_visible") == 0) { | ||
config->stacking_titlebar_follows_border = false; | ||
} else if (strcmp(argv[0], "follows_border") == 0) { | ||
config->stacking_titlebar_follows_border = true; | ||
} else { | ||
return cmd_results_new(CMD_INVALID, | ||
"Expected 'default_stacking_titlebar <always_visible|follows_border>"); | ||
} | ||
|
||
return cmd_results_new(CMD_SUCCESS, NULL); | ||
} | ||
|
||
struct cmd_results *cmd_default_tabbed_titlebar(int argc, char **argv) { | ||
struct cmd_results *error = NULL; | ||
if ((error = checkarg(argc, "default_tabbed_titlebar", EXPECTED_EQUAL_TO, 1))) { | ||
return error; | ||
} | ||
|
||
if (strcmp(argv[0], "always_visible") == 0) { | ||
config->tabbed_titlebar_follows_border = false; | ||
} else if (strcmp(argv[0], "follows_border") == 0) { | ||
config->tabbed_titlebar_follows_border = true; | ||
} else { | ||
return cmd_results_new(CMD_INVALID, | ||
"Expected 'default_tabbed_titlebar <always_visible|follows_border>"); | ||
} | ||
|
||
return cmd_results_new(CMD_SUCCESS, NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "log.h" | ||
#include "sway/commands.h" | ||
#include "sway/config.h" | ||
#include "sway/tree/arrange.h" | ||
#include "sway/tree/container.h" | ||
#include "sway/tree/view.h" | ||
|
||
struct cmd_results *cmd_stacking_titlebar(int argc, char **argv) { | ||
struct cmd_results *error = NULL; | ||
if ((error = checkarg(argc, "border", EXPECTED_EQUAL_TO, 1))) { | ||
return error; | ||
} | ||
|
||
struct sway_container *container = config->handler_context.container; | ||
if (!container) { | ||
return cmd_results_new(CMD_INVALID, "No container to set"); | ||
} | ||
|
||
if (strcmp(argv[0], "always_visible") == 0) { | ||
container->pending.stacking_titlebar_follows_border = false; | ||
} else if (strcmp(argv[0], "follows_border") == 0) { | ||
container->pending.stacking_titlebar_follows_border = true; | ||
} else { | ||
return cmd_results_new(CMD_INVALID, | ||
"Expected 'stacking_titlebar <always_visible|follows_border>"); | ||
} | ||
|
||
if (container_is_floating(container)) { | ||
container_set_geometry_from_content(container); | ||
} | ||
|
||
arrange_container(container); | ||
|
||
return cmd_results_new(CMD_SUCCESS, NULL); | ||
} | ||
|
||
struct cmd_results *cmd_tabbed_titlebar(int argc, char **argv) { | ||
struct cmd_results *error = NULL; | ||
if ((error = checkarg(argc, "border", EXPECTED_EQUAL_TO, 1))) { | ||
return error; | ||
} | ||
|
||
struct sway_container *container = config->handler_context.container; | ||
if (!container) { | ||
return cmd_results_new(CMD_INVALID, "No container to set"); | ||
} | ||
|
||
if (strcmp(argv[0], "always_visible") == 0) { | ||
container->pending.tabbed_titlebar_follows_border = false; | ||
} else if (strcmp(argv[0], "follows_border") == 0) { | ||
container->pending.tabbed_titlebar_follows_border = true; | ||
} else { | ||
return cmd_results_new(CMD_INVALID, | ||
"Expected 'tabbed_titlebar <always_visible|follows_border>"); | ||
} | ||
|
||
if (container_is_floating(container)) { | ||
container_set_geometry_from_content(container); | ||
} | ||
|
||
arrange_container(container); | ||
|
||
return cmd_results_new(CMD_SUCCESS, NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters