aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2022-10-30 16:19:04 +0100
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2022-11-01 17:55:46 +0100
commitb825dc124a33f247cf35efd5e2d0646003a16f23 (patch)
tree0a1e657f29d85dd451acc5ad55b0208770f6e0ca /include
parent0b89d4b2a7ae84a852a707d71cf2697e55581ee7 (diff)
downloadi3-b825dc124a33f247cf35efd5e2d0646003a16f23.tar.gz
i3-b825dc124a33f247cf35efd5e2d0646003a16f23.zip
Merge gaps support as-is
This code was copied over unmodified from https://github.com/Airblader/i3-gaps. I have split out the differences between i3-gaps and i3 into three areas: 1. Gaps 2. i3bar height 3. rgba colors
Diffstat (limited to 'include')
-rw-r--r--include/commands.h6
-rw-r--r--include/con.h7
-rw-r--r--include/config_directives.h3
-rw-r--r--include/configuration.h9
-rw-r--r--include/data.h26
-rw-r--r--include/render.h2
6 files changed, 50 insertions, 3 deletions
diff --git a/include/commands.h b/include/commands.h
index d0f0140b..2ae2643c 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -333,6 +333,12 @@ void cmd_shmlog(I3_CMD, const char *argument);
void cmd_debuglog(I3_CMD, const char *argument);
/**
+ * Implementation of 'gaps inner|outer|top|right|bottom|left|horizontal|vertical current|all set|plus|minus|toggle <px>'
+ *
+ */
+void cmd_gaps(I3_CMD, const char *type, const char *scope, const char *mode, const char *value);
+
+/**
* Implementation of 'title_window_icon <yes|no|toggle>' and 'title_window_icon <padding|toggle> <px>'
*
*/
diff --git a/include/con.h b/include/con.h
index 8d344994..6577c2d6 100644
--- a/include/con.h
+++ b/include/con.h
@@ -526,6 +526,13 @@ void con_set_urgency(Con *con, bool urgent);
char *con_get_tree_representation(Con *con);
/**
+ * Calculates the effective gap sizes for a container depending
+ * on whether it is adjacent to the edge of the screen or another
+ * container.
+ */
+gaps_t calculate_effective_gaps(Con *con);
+
+/**
* force parent split containers to be redrawn
*
*/
diff --git a/include/config_directives.h b/include/config_directives.h
index 1cc0340f..600226e9 100644
--- a/include/config_directives.h
+++ b/include/config_directives.h
@@ -43,6 +43,9 @@ CFGFUN(include, const char *pattern);
CFGFUN(font, const char *font);
CFGFUN(exec, const char *exectype, const char *no_startup_id, const char *command);
CFGFUN(for_window, const char *command);
+CFGFUN(gaps, const char *workspace, const char *type, const long value);
+CFGFUN(smart_borders, const char *enable);
+CFGFUN(smart_gaps, const char *enable);
CFGFUN(floating_minimum_size, const long width, const long height);
CFGFUN(floating_maximum_size, const long width, const long height);
CFGFUN(default_orientation, const char *orientation);
diff --git a/include/configuration.h b/include/configuration.h
index 5eae5f87..99f4b64e 100644
--- a/include/configuration.h
+++ b/include/configuration.h
@@ -268,6 +268,15 @@ struct Config {
int number_barconfigs;
tiling_drag_t tiling_drag;
+
+ /* Gap sizes */
+ gaps_t gaps;
+
+ /* Should single containers on a workspace receive a border? */
+ smart_borders_t smart_borders;
+
+ /* Disable gaps if there is only one container on the workspace */
+ smart_gaps_t smart_gaps;
};
/**
diff --git a/include/data.h b/include/data.h
index 8078fd3e..67a573c2 100644
--- a/include/data.h
+++ b/include/data.h
@@ -47,6 +47,7 @@ typedef struct Con Con;
typedef struct Match Match;
typedef struct Assignment Assignment;
typedef struct Window i3Window;
+typedef struct gaps_t gaps_t;
typedef struct mark_t mark_t;
/******************************************************************************
@@ -80,11 +81,20 @@ typedef enum { ADJ_NONE = 0,
ADJ_UPPER_SCREEN_EDGE = (1 << 2),
ADJ_LOWER_SCREEN_EDGE = (1 << 4) } adjacent_t;
+typedef enum { SMART_BORDERS_OFF,
+ SMART_BORDERS_ON,
+ SMART_BORDERS_NO_GAPS } smart_borders_t;
+
+typedef enum { SMART_GAPS_OFF,
+ SMART_GAPS_ON,
+ SMART_GAPS_INVERSE_OUTER } smart_gaps_t;
+
typedef enum { HEBM_NONE = ADJ_NONE,
HEBM_VERTICAL = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE,
HEBM_HORIZONTAL = ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE,
HEBM_BOTH = HEBM_VERTICAL | HEBM_HORIZONTAL,
- HEBM_SMART = (1 << 5) } hide_edge_borders_mode_t;
+ HEBM_SMART = (1 << 5),
+ HEBM_SMART_NO_GAPS = (1 << 6) } hide_edge_borders_mode_t;
typedef enum { MM_REPLACE,
MM_ADD } mark_mode_t;
@@ -137,6 +147,14 @@ typedef enum {
POINTER_WARPING_NONE = 1
} warping_t;
+struct gaps_t {
+ int inner;
+ int top;
+ int right;
+ int bottom;
+ int left;
+};
+
/**
* Focus wrapping modes.
*/
@@ -204,12 +222,13 @@ struct deco_render_params {
};
/**
- * Stores which workspace (by name or number) goes to which output.
+ * Stores which workspace (by name or number) goes to which output and its gaps config.
*
*/
struct Workspace_Assignment {
char *name;
char *output;
+ gaps_t gaps;
TAILQ_ENTRY(Workspace_Assignment) ws_assignments;
};
@@ -645,6 +664,9 @@ struct Con {
* workspace is not a named workspace (for named workspaces, num == -1) */
int num;
+ /** Only applicable for containers of type CT_WORKSPACE. */
+ gaps_t gaps;
+
struct Con *parent;
/* The position and size for this con. These coordinates are absolute. Note
diff --git a/include/render.h b/include/render.h
index 03751c01..8500b71d 100644
--- a/include/render.h
+++ b/include/render.h
@@ -40,7 +40,7 @@ typedef struct render_params {
* updated in X11.
*
*/
-void render_con(Con *con);
+void render_con(Con *con, bool already_inset);
/**
* Returns the height for the decorations