lin-ycv / EverythingPowerToys

Everything search plugin for PowerToys Run
Eclipse Public License 2.0
2.21k stars 58 forks source link

[Request] Copy file instead of path - change Ctrl+C to copy the file instead of copying the file path #34

Closed daniel-richter closed 1 year ago

daniel-richter commented 1 year ago

Is your feature request related to a problem? Please describe. Currently, there is an context menu item "Copy path to clipboard" associated with Ctrl+C. There were only a few scenarios where I need the path of a found file. Instead I tend to use the file itself. Adding an option to copy the file instead of copying the file path to the clipboard would be a solution (or feasible workaround) for https://github.com/microsoft/PowerToys/issues/4462. Changing the default behaviour of the Ctrl+C to that would solve https://github.com/microsoft/PowerToys/issues/13006

Describe the solution you'd like Currently, copy the file's path to the clipboard is implemented as follows: https://github.com/lin-ycv/EverythingPowerToys/blob/f0372aa625e74a9507ba89921f5fac76d374326d/ContextMenuLoader.cs#L63

Changing that line as follows would copy the complete file.

Clipboard.SetData(DataFormats.FileDrop, new string[] { record.Path });

Since "copy path to clipboard" is still a useful feature (but maybe not as default), an additional ContextMenuResult would be required.

Describe alternatives you've considered Use the context menu item "open containing folder" and copy/drag&drop the file would solve the problem, too. But that is too many unnecessary steps.

lin-ycv commented 1 year ago

So I think implementing it as a toggle and keeping both functions is the best way forward Ctrl+C and Ctrl+Alt+C (Default will be copy path to be consistent with PowerToys defaults) image image

@daniel-richter since you recommended the feature, you can choose the new icon for copy path, folderSelect (Left) OR link (Right) image or do you think the copy icon should be kept for copy path, and copy file/folder needs a new icon (to be consistent with PowerToys default)?

daniel-richter commented 1 year ago

In my opinion the link icon is better for copy path. In my mental model a file item in the result list is somewhat like an item in the Windows Explorer file list - copying there puts the whole file to the clipboard; so the copy icon should copy the file/folder. Btw.: The Explorer's icon for "copy path" is \\...

The settings text could be more specific - like "Copy file/folder instead of path | Change Ctrl+C behaviour".