summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-29 13:49:28 +0200
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-30 00:47:58 +0200
commit86ea79ea6de62c0958511d45e755a4a7767efcd0 (patch)
tree96369d7356313ad86c1064c74db54258500814f2
parentMake client/pango.h not depend on client/window.h (diff)
downloadsway-86ea79ea6de62c0958511d45e755a4a7767efcd0.tar.gz
sway-86ea79ea6de62c0958511d45e755a4a7767efcd0.tar.zst
sway-86ea79ea6de62c0958511d45e755a4a7767efcd0.zip
Implement parsing of hide_edge_borders
-rw-r--r--include/config.h9
-rw-r--r--sway/commands.c25
-rw-r--r--sway/config.c2
-rw-r--r--sway/sway.5.txt3
4 files changed, 39 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index 5a58c07c..fe69e310 100644
--- a/include/config.h
+++ b/include/config.h
@@ -156,6 +156,13 @@ struct border_colors {
156 uint32_t child_border; 156 uint32_t child_border;
157}; 157};
158 158
159enum edge_border_types {
160 E_NONE, /**< Don't hide edge borders */
161 E_VERTICAL, /**< hide vertical edge borders */
162 E_HORIZONTAL, /**< hide horizontal edge borders */
163 E_BOTH /**< hide vertical and horizontal edge borders */
164};
165
159/** 166/**
160 * The configuration struct. The result of loading a config file. 167 * The configuration struct. The result of loading a config file.
161 */ 168 */
@@ -196,6 +203,8 @@ struct sway_config {
196 list_t *config_chain; 203 list_t *config_chain;
197 const char *current_config; 204 const char *current_config;
198 205
206 enum edge_border_types hide_edge_borders;
207
199 // border colors 208 // border colors
200 struct { 209 struct {
201 struct border_colors focused; 210 struct border_colors focused;
diff --git a/sway/commands.c b/sway/commands.c
index 333af1b4..4a3ebf9e 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -55,6 +55,7 @@ static sway_cmd cmd_font;
55static sway_cmd cmd_for_window; 55static sway_cmd cmd_for_window;
56static sway_cmd cmd_fullscreen; 56static sway_cmd cmd_fullscreen;
57static sway_cmd cmd_gaps; 57static sway_cmd cmd_gaps;
58static sway_cmd cmd_hide_edge_borders;
58static sway_cmd cmd_include; 59static sway_cmd cmd_include;
59static sway_cmd cmd_input; 60static sway_cmd cmd_input;
60static sway_cmd cmd_kill; 61static sway_cmd cmd_kill;
@@ -1506,6 +1507,29 @@ static struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
1506 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1507 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1507} 1508}
1508 1509
1510static struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
1511 struct cmd_results *error = NULL;
1512 if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) {
1513 return error;
1514 }
1515
1516 if (strcasecmp(argv[0], "none") == 0) {
1517 config->hide_edge_borders = E_NONE;
1518 } else if (strcasecmp(argv[0], "vertical") == 0) {
1519 config->hide_edge_borders = E_VERTICAL;
1520 } else if (strcasecmp(argv[0], "horizontal") == 0) {
1521 config->hide_edge_borders = E_HORIZONTAL;
1522 } else if (strcasecmp(argv[0], "both") == 0) {
1523 config->hide_edge_borders = E_BOTH;
1524 } else {
1525 return cmd_results_new(CMD_INVALID, "hide_edge_borders",
1526 "Expected 'hide_edge_borders <none|vertical|horizontal|both>'");
1527 }
1528
1529 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1530}
1531
1532
1509static struct cmd_results *cmd_kill(int argc, char **argv) { 1533static struct cmd_results *cmd_kill(int argc, char **argv) {
1510 if (config->reading) return cmd_results_new(CMD_FAILURE, "kill", "Can't be used in config file."); 1534 if (config->reading) return cmd_results_new(CMD_FAILURE, "kill", "Can't be used in config file.");
1511 if (!config->active) return cmd_results_new(CMD_FAILURE, "kill", "Can only be used when sway is running."); 1535 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[] = {
2063 { "for_window", cmd_for_window }, 2087 { "for_window", cmd_for_window },
2064 { "fullscreen", cmd_fullscreen }, 2088 { "fullscreen", cmd_fullscreen },
2065 { "gaps", cmd_gaps }, 2089 { "gaps", cmd_gaps },
2090 { "hide_edge_borders", cmd_hide_edge_borders },
2066 { "include", cmd_include }, 2091 { "include", cmd_include },
2067 { "input", cmd_input }, 2092 { "input", cmd_input },
2068 { "kill", cmd_kill }, 2093 { "kill", cmd_kill },
diff --git a/sway/config.c b/sway/config.c
index 4cb8cced..565acd05 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -182,6 +182,8 @@ static void config_defaults(struct sway_config *config) {
182 config->config_chain = create_list(); 182 config->config_chain = create_list();
183 config->current_config = NULL; 183 config->current_config = NULL;
184 184
185 config->hide_edge_borders = E_NONE;
186
185 // border colors 187 // border colors
186 config->border_colors.focused.border = 0x4C7899FF; 188 config->border_colors.focused.border = 0x4C7899FF;
187 config->border_colors.focused.background = 0x285577FF; 189 config->border_colors.focused.background = 0x285577FF;
diff --git a/sway/sway.5.txt b/sway/sway.5.txt
index 1bb5cd3b..13d304bb 100644
--- a/sway/sway.5.txt
+++ b/sway/sway.5.txt
@@ -67,6 +67,9 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
67**fullscreen**:: 67**fullscreen**::
68 Toggles fullscreen status for the focused view. 68 Toggles fullscreen status for the focused view.
69 69
70**hide_edge_borders** <none|vertical|horizontal|both>::
71 Hide window borders adjacent to the screen edges. Default is _none_.
72
70**layout** <mode>:: 73**layout** <mode>::
71 Sets the layout mode of the focused container. _mode_ can be one of _splith_, 74 Sets the layout mode of the focused container. _mode_ can be one of _splith_,
72 _splitv_, or _toggle split_. 75 _splitv_, or _toggle split_.