mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
Add no_titlebars command
This commit is contained in:
parent
5f1fe33d36
commit
f802346abe
9 changed files with 40 additions and 1 deletions
|
|
@ -160,6 +160,7 @@ sway_cmd cmd_opacity;
|
|||
sway_cmd cmd_new_float;
|
||||
sway_cmd cmd_new_window;
|
||||
sway_cmd cmd_no_focus;
|
||||
sway_cmd cmd_no_titlebars;
|
||||
sway_cmd cmd_output;
|
||||
sway_cmd cmd_permit;
|
||||
sway_cmd cmd_popup_during_fullscreen;
|
||||
|
|
|
|||
|
|
@ -511,6 +511,7 @@ struct sway_config {
|
|||
|
||||
bool tiling_drag;
|
||||
int tiling_drag_threshold;
|
||||
bool no_titlebars;
|
||||
|
||||
bool smart_gaps;
|
||||
int gaps_inner;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ static struct cmd_handler handlers[] = {
|
|||
{ "new_float", cmd_new_float },
|
||||
{ "new_window", cmd_new_window },
|
||||
{ "no_focus", cmd_no_focus },
|
||||
{ "no_titlebars", cmd_no_titlebars },
|
||||
{ "output", cmd_output },
|
||||
{ "popup_during_fullscreen", cmd_popup_during_fullscreen },
|
||||
{ "seat", cmd_seat },
|
||||
|
|
|
|||
24
sway/commands/no_titlebars.c
Normal file
24
sway/commands/no_titlebars.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *cmd_no_titlebars(int argc, char **argv) {
|
||||
struct cmd_results *error = checkarg(argc, "no_titlebars", EXPECTED_EQUAL_TO, 1);
|
||||
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
config->no_titlebars = parse_boolean(argv[0], config->no_titlebars);
|
||||
|
||||
arrange_root();
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -266,6 +266,7 @@ static void config_defaults(struct sway_config *config) {
|
|||
config->title_align = ALIGN_LEFT;
|
||||
config->tiling_drag = true;
|
||||
config->tiling_drag_threshold = 9;
|
||||
config->no_titlebars = false;
|
||||
|
||||
config->smart_gaps = false;
|
||||
config->gaps_inner = 0;
|
||||
|
|
|
|||
|
|
@ -659,6 +659,9 @@ static void render_titlebar(struct sway_output *output,
|
|||
static void render_top_border(struct sway_output *output,
|
||||
pixman_region32_t *output_damage, struct sway_container *con,
|
||||
struct border_colors *colors) {
|
||||
if (config->no_titlebars) {
|
||||
return;
|
||||
}
|
||||
struct sway_container_state *state = &con->current;
|
||||
if (!state->border_top) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ sway_sources = files(
|
|||
'commands/new_float.c',
|
||||
'commands/new_window.c',
|
||||
'commands/no_focus.c',
|
||||
'commands/no_titlebars.c',
|
||||
'commands/nop.c',
|
||||
'commands/output.c',
|
||||
'commands/popup_during_fullscreen.c',
|
||||
|
|
|
|||
|
|
@ -639,6 +639,9 @@ The default colors are:
|
|||
may make it unnecessarily hard to tell which window originally raised the
|
||||
event. This option allows to set a _timeout_ in ms to delay the urgency hint reset.
|
||||
|
||||
*no_titlebars* enable|disable|toggle
|
||||
Do not render titlebars
|
||||
|
||||
*titlebar_border_thickness* <thickness>
|
||||
Thickness of the titlebar border in pixels
|
||||
|
||||
|
|
|
|||
|
|
@ -617,7 +617,11 @@ void container_update_representation(struct sway_container *con) {
|
|||
}
|
||||
|
||||
size_t container_titlebar_height(void) {
|
||||
return config->font_height + config->titlebar_v_padding * 2;
|
||||
if (config->no_titlebars) {
|
||||
return 0;
|
||||
} else {
|
||||
return config->font_height + config->titlebar_v_padding * 2;
|
||||
}
|
||||
}
|
||||
|
||||
void floating_calculate_constraints(int *min_width, int *max_width,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue