mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 08:51:27 +00:00
adder new option in Sway config - disable_titlebar
This commit is contained in:
parent
1a3cfc50c1
commit
2bcf7a02e1
|
@ -124,6 +124,7 @@ sway_cmd cmd_create_output;
|
||||||
sway_cmd cmd_default_border;
|
sway_cmd cmd_default_border;
|
||||||
sway_cmd cmd_default_floating_border;
|
sway_cmd cmd_default_floating_border;
|
||||||
sway_cmd cmd_default_orientation;
|
sway_cmd cmd_default_orientation;
|
||||||
|
sway_cmd cmd_disable_titlebar;
|
||||||
sway_cmd cmd_exec;
|
sway_cmd cmd_exec;
|
||||||
sway_cmd cmd_exec_always;
|
sway_cmd cmd_exec_always;
|
||||||
sway_cmd cmd_exit;
|
sway_cmd cmd_exit;
|
||||||
|
|
|
@ -532,6 +532,7 @@ struct sway_config {
|
||||||
bool validating;
|
bool validating;
|
||||||
bool auto_back_and_forth;
|
bool auto_back_and_forth;
|
||||||
bool show_marks;
|
bool show_marks;
|
||||||
|
bool disable_titlebar;
|
||||||
enum alignment title_align;
|
enum alignment title_align;
|
||||||
bool primary_selection;
|
bool primary_selection;
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
{ "client.urgent", cmd_client_urgent },
|
{ "client.urgent", cmd_client_urgent },
|
||||||
{ "default_border", cmd_default_border },
|
{ "default_border", cmd_default_border },
|
||||||
{ "default_floating_border", cmd_default_floating_border },
|
{ "default_floating_border", cmd_default_floating_border },
|
||||||
|
{ "disable_titlebar", cmd_disable_titlebar },
|
||||||
{ "exec", cmd_exec },
|
{ "exec", cmd_exec },
|
||||||
{ "exec_always", cmd_exec_always },
|
{ "exec_always", cmd_exec_always },
|
||||||
{ "floating_maximum_size", cmd_floating_maximum_size },
|
{ "floating_maximum_size", cmd_floating_maximum_size },
|
||||||
|
|
14
sway/commands/disable_titlebar.c
Normal file
14
sway/commands/disable_titlebar.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include "sway/commands.h"
|
||||||
|
#include "sway/config.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
struct cmd_results *cmd_disable_titlebar(int argc, char **argv) {
|
||||||
|
struct cmd_results *error = NULL;
|
||||||
|
if ((error = checkarg(argc, "disable_titlebar", EXPECTED_EQUAL_TO, 1))) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
config->disable_titlebar = parse_boolean(argv[0], config->disable_titlebar);
|
||||||
|
|
||||||
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
}
|
|
@ -270,6 +270,7 @@ static void config_defaults(struct sway_config *config) {
|
||||||
config->auto_back_and_forth = false;
|
config->auto_back_and_forth = false;
|
||||||
config->reading = false;
|
config->reading = false;
|
||||||
config->show_marks = true;
|
config->show_marks = true;
|
||||||
|
config->disable_titlebar = false;
|
||||||
config->title_align = ALIGN_LEFT;
|
config->title_align = ALIGN_LEFT;
|
||||||
config->tiling_drag = true;
|
config->tiling_drag = true;
|
||||||
config->tiling_drag_threshold = 9;
|
config->tiling_drag_threshold = 9;
|
||||||
|
|
|
@ -716,7 +716,7 @@ static void render_containers_linear(struct render_context *ctx, struct parent_d
|
||||||
marks_texture = child->marks_unfocused;
|
marks_texture = child->marks_unfocused;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->border == B_NORMAL) {
|
if (state->border == B_NORMAL && !config->disable_titlebar) {
|
||||||
render_titlebar(ctx, child, floor(state->x),
|
render_titlebar(ctx, child, floor(state->x),
|
||||||
floor(state->y), state->width, colors,
|
floor(state->y), state->width, colors,
|
||||||
title_texture, marks_texture);
|
title_texture, marks_texture);
|
||||||
|
@ -790,8 +790,10 @@ static void render_containers_tabbed(struct render_context *ctx, struct parent_d
|
||||||
tab_width = parent->box.width - tab_width * i;
|
tab_width = parent->box.width - tab_width * i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config->disable_titlebar) {
|
||||||
render_titlebar(ctx, child, x, parent->box.y, tab_width,
|
render_titlebar(ctx, child, x, parent->box.y, tab_width,
|
||||||
colors, title_texture, marks_texture);
|
colors, title_texture, marks_texture);
|
||||||
|
}
|
||||||
|
|
||||||
if (child == current) {
|
if (child == current) {
|
||||||
current_colors = colors;
|
current_colors = colors;
|
||||||
|
@ -851,9 +853,11 @@ static void render_containers_stacked(struct render_context *ctx, struct parent_
|
||||||
marks_texture = child->marks_unfocused;
|
marks_texture = child->marks_unfocused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config->disable_titlebar) {
|
||||||
int y = parent->box.y + titlebar_height * i;
|
int y = parent->box.y + titlebar_height * i;
|
||||||
render_titlebar(ctx, child, parent->box.x, y,
|
render_titlebar(ctx, child, parent->box.x, y,
|
||||||
parent->box.width, colors, title_texture, marks_texture);
|
parent->box.width, colors, title_texture, marks_texture);
|
||||||
|
}
|
||||||
|
|
||||||
if (child == current) {
|
if (child == current) {
|
||||||
current_colors = colors;
|
current_colors = colors;
|
||||||
|
@ -949,7 +953,7 @@ static void render_floating_container(struct render_context *ctx,
|
||||||
marks_texture = con->marks_unfocused;
|
marks_texture = con->marks_unfocused;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con->current.border == B_NORMAL) {
|
if (con->current.border == B_NORMAL && !config->disable_titlebar) {
|
||||||
render_titlebar(ctx, con, floor(con->current.x),
|
render_titlebar(ctx, con, floor(con->current.x),
|
||||||
floor(con->current.y), con->current.width, colors,
|
floor(con->current.y), con->current.width, colors,
|
||||||
title_texture, marks_texture);
|
title_texture, marks_texture);
|
||||||
|
|
|
@ -51,6 +51,7 @@ sway_sources = files(
|
||||||
'commands/default_border.c',
|
'commands/default_border.c',
|
||||||
'commands/default_floating_border.c',
|
'commands/default_floating_border.c',
|
||||||
'commands/default_orientation.c',
|
'commands/default_orientation.c',
|
||||||
|
'commands/disable_titlebar.c',
|
||||||
'commands/exit.c',
|
'commands/exit.c',
|
||||||
'commands/exec.c',
|
'commands/exec.c',
|
||||||
'commands/exec_always.c',
|
'commands/exec_always.c',
|
||||||
|
|
|
@ -726,6 +726,9 @@ The default colors are:
|
||||||
should be greater than titlebar_border_thickness. If _vertical_ value is
|
should be greater than titlebar_border_thickness. If _vertical_ value is
|
||||||
not specified it is set to the _horizontal_ value.
|
not specified it is set to the _horizontal_ value.
|
||||||
|
|
||||||
|
*disable_titlebar* yes|no.
|
||||||
|
Remove titlebar. Default is _no_.
|
||||||
|
|
||||||
*for_window* <criteria> <command>
|
*for_window* <criteria> <command>
|
||||||
Whenever a window that matches _criteria_ appears, run list of commands.
|
Whenever a window that matches _criteria_ appears, run list of commands.
|
||||||
See *CRITERIA* for more details.
|
See *CRITERIA* for more details.
|
||||||
|
|
|
@ -670,6 +670,10 @@ void container_update_representation(struct sway_container *con) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t container_titlebar_height(void) {
|
size_t container_titlebar_height(void) {
|
||||||
|
if(config->disable_titlebar) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return config->font_height + config->titlebar_v_padding * 2;
|
return config->font_height + config->titlebar_v_padding * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue