Implement parsing of hide_edge_borders

This commit is contained in:
Mikkel Oscar Lyderik 2016-03-29 13:49:28 +02:00
parent cefcce48aa
commit 86ea79ea6d
4 changed files with 39 additions and 0 deletions

View file

@ -156,6 +156,13 @@ struct border_colors {
uint32_t child_border; uint32_t child_border;
}; };
enum edge_border_types {
E_NONE, /**< Don't hide edge borders */
E_VERTICAL, /**< hide vertical edge borders */
E_HORIZONTAL, /**< hide horizontal edge borders */
E_BOTH /**< hide vertical and horizontal edge borders */
};
/** /**
* The configuration struct. The result of loading a config file. * The configuration struct. The result of loading a config file.
*/ */
@ -196,6 +203,8 @@ struct sway_config {
list_t *config_chain; list_t *config_chain;
const char *current_config; const char *current_config;
enum edge_border_types hide_edge_borders;
// border colors // border colors
struct { struct {
struct border_colors focused; struct border_colors focused;

View file

@ -55,6 +55,7 @@ static sway_cmd cmd_font;
static sway_cmd cmd_for_window; static sway_cmd cmd_for_window;
static sway_cmd cmd_fullscreen; static sway_cmd cmd_fullscreen;
static sway_cmd cmd_gaps; static sway_cmd cmd_gaps;
static sway_cmd cmd_hide_edge_borders;
static sway_cmd cmd_include; static sway_cmd cmd_include;
static sway_cmd cmd_input; static sway_cmd cmd_input;
static sway_cmd cmd_kill; static sway_cmd cmd_kill;
@ -1506,6 +1507,29 @@ static struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }
static struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) {
return error;
}
if (strcasecmp(argv[0], "none") == 0) {
config->hide_edge_borders = E_NONE;
} else if (strcasecmp(argv[0], "vertical") == 0) {
config->hide_edge_borders = E_VERTICAL;
} else if (strcasecmp(argv[0], "horizontal") == 0) {
config->hide_edge_borders = E_HORIZONTAL;
} else if (strcasecmp(argv[0], "both") == 0) {
config->hide_edge_borders = E_BOTH;
} else {
return cmd_results_new(CMD_INVALID, "hide_edge_borders",
"Expected 'hide_edge_borders <none|vertical|horizontal|both>'");
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
static struct cmd_results *cmd_kill(int argc, char **argv) { static struct cmd_results *cmd_kill(int argc, char **argv) {
if (config->reading) return cmd_results_new(CMD_FAILURE, "kill", "Can't be used in config file."); if (config->reading) return cmd_results_new(CMD_FAILURE, "kill", "Can't be used in config file.");
if (!config->active) return cmd_results_new(CMD_FAILURE, "kill", "Can only be used when sway is running."); if (!config->active) return cmd_results_new(CMD_FAILURE, "kill", "Can only be used when sway is running.");
@ -2063,6 +2087,7 @@ static struct cmd_handler handlers[] = {
{ "for_window", cmd_for_window }, { "for_window", cmd_for_window },
{ "fullscreen", cmd_fullscreen }, { "fullscreen", cmd_fullscreen },
{ "gaps", cmd_gaps }, { "gaps", cmd_gaps },
{ "hide_edge_borders", cmd_hide_edge_borders },
{ "include", cmd_include }, { "include", cmd_include },
{ "input", cmd_input }, { "input", cmd_input },
{ "kill", cmd_kill }, { "kill", cmd_kill },

View file

@ -182,6 +182,8 @@ static void config_defaults(struct sway_config *config) {
config->config_chain = create_list(); config->config_chain = create_list();
config->current_config = NULL; config->current_config = NULL;
config->hide_edge_borders = E_NONE;
// border colors // border colors
config->border_colors.focused.border = 0x4C7899FF; config->border_colors.focused.border = 0x4C7899FF;
config->border_colors.focused.background = 0x285577FF; config->border_colors.focused.background = 0x285577FF;

View file

@ -67,6 +67,9 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
**fullscreen**:: **fullscreen**::
Toggles fullscreen status for the focused view. Toggles fullscreen status for the focused view.
**hide_edge_borders** <none|vertical|horizontal|both>::
Hide window borders adjacent to the screen edges. Default is _none_.
**layout** <mode>:: **layout** <mode>::
Sets the layout mode of the focused container. _mode_ can be one of _splith_, Sets the layout mode of the focused container. _mode_ can be one of _splith_,
_splitv_, or _toggle split_. _splitv_, or _toggle split_.