From 235425ae857fd1f9fb9c9415f28cb77be43bda59 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Apr 2026 09:24:33 +0530 Subject: [PATCH] Allow optionally dropping anywhere --- kittens/dnd/main.go | 10 +++++++++- kittens/dnd/main.py | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/kittens/dnd/main.go b/kittens/dnd/main.go index bf74e25c6..8c76e1265 100644 --- a/kittens/dnd/main.go +++ b/kittens/dnd/main.go @@ -128,7 +128,15 @@ func run_loop(opts *Options, drop_dests map[string]drop_dest, drag_sources map[s } else if move_button_region.has(cell_x, cell_y) { drop_status.action = move_on_drop } else { - drop_status.action = 0 + switch opts.DropAnywhere { + case "disallowed": + drop_status.action = 0 + drop_status.accepted_mimes = nil + case "copy": + drop_status.action = copy_on_drop + case "move": + drop_status.action = move_on_drop + } } drop_status.in_window = cell_x > -1 && cell_y > -1 mimes_changed := !slices.Equal(prev_status.accepted_mimes, drop_status.accepted_mimes) diff --git a/kittens/dnd/main.py b/kittens/dnd/main.py index 60634a665..1f0cdf803 100644 --- a/kittens/dnd/main.py +++ b/kittens/dnd/main.py @@ -27,6 +27,14 @@ files to be overwritten. Note that confirmation is asked only for actual file co conflicting files are automatically created. +--drop-anywhere +choices=disallowed,copy,move +default=disallowed +type=choices +Allow dropping anywhere, not just on the Copy or Move drop regions. Dropping anywhere will perform +the specified action. + + --machine-id The machine id to use instead of the actual machine id. '''.format