Open rayshan opened 6 years ago
Cmd+C/Cmd+V are already supported. Are you about the "cut" operation (Cmd+X)?
You're right, Cmd+C/Cmd+V works. Yes cut operation defaulting to Cmd+X would make it complete.
In Finder it's CMD+C and then CMD+ALT+V so you do not have to decide if you want to copy or cut at the first step, it's only different at the second step, while pasting.
@monouser7dig you're right, although I find this strange considering how cut / paste typically work. I'll remove "finder-like" from this issue.
I would love to have this as well!
I'm also miss this simple routine feature
Hello, I really miss this feature! Do you plan to implement it?
Either Cmd+C > Cmd+Opt+V (like in Finder) or Cmd+X > Cmd+V.
+1 vote for "Cmd+C and Cmd+Opt+V (like in Finder)".
Seems like a basic feature, and the current solution is somewhat cumbersome. I would like to suggest / be grateful if this would get a high priority :-)
I fully agree with the others. I am amazed that Marta can do a lot of pretty advanced stuff already out of the box, but moving a single file without the other pane seems a bit cumbersome.
Hi, is there any update on this?
@yanex Would like to get any update on this. This is still one of the most pain point I have when using Marta as my daily file manager.
@sleepymalc @Poitubaren @chrisgrieser @notDavid @matusd2 @ww7 @janvr-at-q16 @rayshan
Hi guys, if you still look for a solution to this.
I wasted my day to find a solution for this.
Here's how you can make pasting with Command+Option+V
work:
Create AppleScript Store the following AppleScript somewhere as .scpt file, i stored it at ~/Documents/AppleScripts with the name "move_to_folder.scpt" move_to_folder.txt Note: The file looks really strange when opening it in Text Editor as .txt file. After renaming in to .scpt it should open in Script Editor without any problems.
Adapt Marta Preferences Create a gadget in the Marta preferences where you reference the created script. Adapt the first parameter of args as needed to reference the script from above.
gadgets [
{
id "gadget.copy.move_files"
name "My Executable Runner"
type "executable"
executable "/usr/bin/osascript"
args ["/Users/**<USER>**/Documents/AppleScripts/**move_to_folder.scpt**" "${active.folder.path}"]
workingDirectory "${user.home}"
}
]
Assign a keyBindings in preferences:
keyBindings {
"Cmd+Opt+V" "gadget.copy.move_files"
}
How it works
mv -n
command. The -n
argument is used to only move files which don't exist at the target. You can remove the -n
if you want it to replace automatically.Further Adaptions The script could also be adapted to ask if the files should be replaced and to show a status how many files were replaced and question dialogs can be implemented with display dialog in the Apple Script. I didn't need this functionality. And it was already a pain to get this working.
Issues I had I wanted to create a more advanced Plugin for Marta, but calling this Apple Script from a Marta Lua Plugin did result in taking forever to execute because querying the Clipboard to get the files / check if files are copied in the Apple Script takes almost half a Minute. I guess that this is some protection mechanism of Mac? Made some tests but could not find a working solution for that.
I used Lua Rocks for that, and I didn't find a way to directly interact with the Clipboard with Lua. That's why I went the AppleScript route. It's probably possible to implement the functionality with Objective C / Swift / whatever, but did not want to waste more time to implement this feature as I already did.
Topics for future
If I would have gotten the Marta Plugin to work with this behavior I would have implemented the functionality to Cut files with Command+X
and move the files with Command+V
. But I think I won't put any more resources into this functionality. Unfortunately the things possible with the API currently did not support what I needed for this functionality. It's sad to see that there are not that much updates for Marta anymore. It's the best File Manager out there and only lacking some basic functionality.
It's November 2024, and the feature is still highly anticipated.
Hi, I found a way for cutting operation, it is a gadget added to conf.json, though I am sure there is a better solution than this 😃. The idea is to move the file to tmp folder and with the copy from cut shortcut move it to the active folder in Marta. There is not Cmd+Z to this, but the file is not lost, it is in /tmp (or wherever you choose to add your cut location)
gadgets [ { "id" "gadget.action.cut_files" "name" "Cut Files" "type" "executable" "executable" "/bin/mv" "args" ["${active.selection.paths}" "/tmp/marta_cut/"] "workingDirectory" "${user.home}" } { "id" "gadget.action.paste_files" "name" "Paste Files" "type" "executable" "executable" "/bin/sh" "args" ["-c" "mv /tmp/marta_cut/* '${active.folder.path}'"] "workingDirectory" "${user.home}" } ]
I use it with the following keybindings but you can change it: "Cmd+X" "gadget.action.cut_files" "Shift+Cmd+V" "gadget.action.paste_files"
I made a better alternative than my previous using python. You have to create 2 .py files cut_files.py and paste_cut_files.py. Still no cmd-Z but it should be possible with python.
gadgets [
{
"id" "gadget.action.cut_files"
"name" "Cut Files"
"type" "executable"
"executable" "/usr/local/bin/python"
"args" ["/Users/
you can edit the location of your 2 .py scripts and the also the temp folder.
import sys import shutil import os
def copy_rdp_files(selection_paths):
destination_dir = "/tmp/marta_cut"
os.makedirs(destination_dir, exist_ok=True)
# Loop over each selected path
for path in selection_paths:
if os.path.isfile(path):
# Move file to the destination directory
destination = os.path.join(destination_dir, os.path.basename(path))
shutil.move(path, destination)
print(f"Moved file {path} to {destination}")
elif os.path.isdir(path):
# Move entire directory to the destination directory
destination = os.path.join(destination_dir, os.path.basename(path))
shutil.move(path, destination)
print(f"Moved directory {path} to {destination}")
else:
print(f"{path} is not a valid file or directory")
if name == "main":
if len(sys.argv) > 1:
# Process all the selected paths
copy_rdp_files(sys.argv[1:])
else:
print("No file or directory paths provided.")
import os import shutil import sys
def paste_files(destination_folder):
cut_dir = "/tmp/marta_cut"
# Check if the destination is a directory
if os.path.exists(destination_folder) and not os.path.isdir(destination_folder):
print(f"Error: {destination_folder} is a file, not a directory.")
return
# Ensure the destination folder exists
os.makedirs(destination_folder, exist_ok=True)
# Move all files and directories from /tmp/marta_cut to the destination folder
for item_name in os.listdir(cut_dir):
item_path = os.path.join(cut_dir, item_name)
destination_path = os.path.join(destination_folder, item_name)
if os.path.isfile(item_path):
shutil.move(item_path, destination_path)
print(f"Pasted file {item_path} to {destination_folder}")
elif os.path.isdir(item_path):
shutil.move(item_path, destination_path)
print(f"Pasted directory {item_path} to {destination_folder}")
else:
print(f"{item_path} is not a valid file or directory and will be skipped.")
if name == "main": if len(sys.argv) > 1:
paste_files(sys.argv[1])
else:
print("No destination folder provided.")
Hello, thanks for your work on Marta. So far so good.
A lot of users coming from the Windows world are used to the pattern of copy / cut files, move to destination, then paste to copy and move files. May we have keyboard bindings for these actions, similar to what's in Finder?