mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
Add "tiling_drag_threshold_on_focused" command
This commit is contained in:
parent
1450a9e9f9
commit
9d8233d3a0
8 changed files with 25 additions and 1 deletions
|
|
@ -173,6 +173,7 @@ sway_cmd cmd_swaynag_command;
|
|||
sway_cmd cmd_swap;
|
||||
sway_cmd cmd_tiling_drag;
|
||||
sway_cmd cmd_tiling_drag_threshold;
|
||||
sway_cmd cmd_tiling_drag_threshold_on_focused;
|
||||
sway_cmd cmd_title_align;
|
||||
sway_cmd cmd_title_format;
|
||||
sway_cmd cmd_titlebar_border_thickness;
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ struct sway_config {
|
|||
|
||||
bool tiling_drag;
|
||||
int tiling_drag_threshold;
|
||||
bool tiling_drag_threshold_on_focused;
|
||||
|
||||
bool smart_gaps;
|
||||
int gaps_inner;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ static struct cmd_handler handlers[] = {
|
|||
{ "smart_gaps", cmd_smart_gaps },
|
||||
{ "tiling_drag", cmd_tiling_drag },
|
||||
{ "tiling_drag_threshold", cmd_tiling_drag_threshold },
|
||||
{ "tiling_drag_threshold_on_focused", cmd_tiling_drag_threshold_on_focused },
|
||||
{ "title_align", cmd_title_align },
|
||||
{ "titlebar_border_thickness", cmd_titlebar_border_thickness },
|
||||
{ "titlebar_padding", cmd_titlebar_padding },
|
||||
|
|
|
|||
13
sway/commands/tiling_drag_threshold_on_focused.c
Normal file
13
sway/commands/tiling_drag_threshold_on_focused.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "sway/commands.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *cmd_tiling_drag_threshold_on_focused(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "tiling_drag_threshold_on_focused", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
config->tiling_drag_threshold_on_focused = parse_boolean(argv[0], config->tiling_drag_threshold_on_focused);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
@ -234,6 +234,7 @@ static void config_defaults(struct sway_config *config) {
|
|||
config->title_align = ALIGN_LEFT;
|
||||
config->tiling_drag = true;
|
||||
config->tiling_drag_threshold = 9;
|
||||
config->tiling_drag_threshold_on_focused = false;
|
||||
|
||||
config->smart_gaps = false;
|
||||
config->gaps_inner = 0;
|
||||
|
|
|
|||
|
|
@ -1022,7 +1022,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
|
|||
|
||||
// If moving a previously unfocused container by it's title bar, use a
|
||||
// threshold for the drag.
|
||||
if (!mod_pressed && !focused && config->tiling_drag_threshold > 0) {
|
||||
if (!mod_pressed &&
|
||||
(!focused || config->tiling_drag_threshold_on_focused) &&
|
||||
config->tiling_drag_threshold > 0) {
|
||||
seat_begin_move_tiling_threshold(seat, cont, button);
|
||||
} else {
|
||||
seat_begin_move_tiling(seat, cont, button);
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ sway_sources = files(
|
|||
'commands/swap.c',
|
||||
'commands/tiling_drag.c',
|
||||
'commands/tiling_drag_threshold.c',
|
||||
'commands/tiling_drag_threshold_on_focused.c',
|
||||
'commands/title_align.c',
|
||||
'commands/title_format.c',
|
||||
'commands/titlebar_border_thickness.c',
|
||||
|
|
|
|||
|
|
@ -581,6 +581,10 @@ The default colors are:
|
|||
_threshold_ is multiplied by the scale of the output that the cursor on.
|
||||
The default is 9.
|
||||
|
||||
*tiling\_drag\_threshold\_on\_focused* yes|no
|
||||
If set to yes, the _tiling\_drag\_threshold_ is also applied to focused
|
||||
containers. The default is _no_.
|
||||
|
||||
*title\_align* left|center|right
|
||||
Sets the title alignment. If _right_ is selected and _show\_marks_ is set
|
||||
to _yes_, the marks will be shown on the _left_ side instead of the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue