mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-06 06:46:54 -04:00
feat: add option drag_tile_small
This commit is contained in:
parent
aa5b907613
commit
b9300aac82
5 changed files with 18 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ enable_floating_snap=0
|
|||
snap_distance=30
|
||||
cursor_size=24
|
||||
drag_tile_to_tile=1
|
||||
drag_tile_small=1
|
||||
|
||||
# keyboard
|
||||
repeat_rate=25
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ description: Advanced settings for XWayland, focus behavior, and system integrat
|
|||
| `warpcursor` | `1` | Warp the cursor to the center of the window when focus changes via keyboard. |
|
||||
| `cursor_hide_timeout` | `0` | Hide the cursor after `N` seconds of inactivity (`0` to disable). |
|
||||
| `drag_tile_to_tile` | `0` | Allow dragging a tiled window onto another to swap their positions. |
|
||||
| `drag_tile_small` | `1` | Allow dragging a tiled window temporarily to small size.|
|
||||
| `drag_corner` | `3` | Corner for drag-to-tile detection (0: none, 1–3: corners, 4: auto-detect). |
|
||||
| `drag_warp_cursor` | `1` | Warp cursor when dragging windows to tile. |
|
||||
| `axis_bind_apply_timeout` | `100` | Timeout (ms) for detecting consecutive scroll events for axis bindings. |
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ typedef struct {
|
|||
int32_t snap_distance;
|
||||
int32_t enable_floating_snap;
|
||||
int32_t drag_tile_to_tile;
|
||||
int32_t drag_tile_small;
|
||||
uint32_t swipe_min_threshold;
|
||||
float focused_opacity;
|
||||
float unfocused_opacity;
|
||||
|
|
@ -1445,6 +1446,8 @@ bool parse_option(Config *config, char *key, char *value) {
|
|||
config->enable_floating_snap = atoi(value);
|
||||
} else if (strcmp(key, "drag_tile_to_tile") == 0) {
|
||||
config->drag_tile_to_tile = atoi(value);
|
||||
} else if (strcmp(key, "drag_tile_small") == 0) {
|
||||
config->drag_tile_small = atoi(value);
|
||||
} else if (strcmp(key, "swipe_min_threshold") == 0) {
|
||||
config->swipe_min_threshold = atoi(value);
|
||||
} else if (strcmp(key, "focused_opacity") == 0) {
|
||||
|
|
@ -3189,6 +3192,7 @@ void override_config(void) {
|
|||
config.drag_floating_refresh_interval =
|
||||
CLAMP_FLOAT(config.drag_floating_refresh_interval, 0.0f, 1000.0f);
|
||||
config.drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1);
|
||||
config.drag_tile_small = CLAMP_INT(config.drag_tile_small, 0, 1);
|
||||
config.allow_tearing = CLAMP_INT(config.allow_tearing, 0, 2);
|
||||
config.allow_shortcuts_inhibit =
|
||||
CLAMP_INT(config.allow_shortcuts_inhibit, 0, 1);
|
||||
|
|
@ -3358,6 +3362,7 @@ void set_value_default() {
|
|||
config.no_radius_when_single = 0;
|
||||
config.snap_distance = 30;
|
||||
config.drag_tile_to_tile = 0;
|
||||
config.drag_tile_small = 1;
|
||||
config.enable_floating_snap = 0;
|
||||
config.swipe_min_threshold = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -378,11 +378,20 @@ int32_t moveresize(const Arg *arg) {
|
|||
grabc->drag_to_tile = true;
|
||||
exit_scroller_stack(grabc);
|
||||
setfloating(grabc, 1);
|
||||
grabc->drag_tile_float_backup_geom = grabc->float_geom;
|
||||
grabc->old_stack_inner_per = 0.0f;
|
||||
grabc->old_master_inner_per = 0.0f;
|
||||
set_size_per(grabc->mon, grabc);
|
||||
}
|
||||
|
||||
if (grabc && grabc->drag_to_tile && config.drag_tile_small) {
|
||||
grabc->geom.x = cursor->x - 150;
|
||||
grabc->geom.y = cursor->y - 150;
|
||||
grabc->geom.width = 300;
|
||||
grabc->geom.height = 300;
|
||||
resize(grabc, grabc->geom, 1);
|
||||
}
|
||||
|
||||
switch (cursor_mode = arg->ui) {
|
||||
case CurMove:
|
||||
|
||||
|
|
|
|||
|
|
@ -425,6 +425,7 @@ struct Client {
|
|||
struct Client *prev_in_stack;
|
||||
bool enable_drop_area_draw;
|
||||
int32_t drop_direction;
|
||||
struct wlr_box drag_tile_float_backup_geom;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -2313,6 +2314,7 @@ buttonpress(struct wl_listener *listener, void *data) {
|
|||
last_apply_drap_time = 0;
|
||||
if (tmpc->drag_to_tile && config.drag_tile_to_tile) {
|
||||
place_drag_tile_client(tmpc);
|
||||
tmpc->float_geom = tmpc->drag_tile_float_backup_geom;
|
||||
} else {
|
||||
apply_window_snap(tmpc);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue