Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-05-16 18:50:30

dreimal
Member
Registered: 2022-05-04
Posts: 7

Custom action to move files

I would like to add a custom action to the Thunar send-to list, to right-click and move a selection of files to a specific directory. I've tried to follow so many examples found online, but I'm just not clever enough to understand.

Is it as simple as I hope?

Offline

#2 2022-05-17 00:15:28

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Custom action to move files

You mention both custom actions and the send-to menu - these are different things.

send-to
Assuming you want to move files to only one existing directory, you can follow the instructions from the official Thunar send-to documentation. Specifically:

  1. If it doesn't exist, create the directory ~/.local/share/Thunar/sendto/

  2. create a file in that directory with the name "move.desktop" with the following content:

    # move.desktop - move files to specified dir via send-to
    [Desktop Entry]
    Type=Application
    Version=1.0
    Encoding=UTF-8
    Exec=mv %F /home/toz/Documents
    Icon=folder-documents
    Name=Documents 

    ...change the destination folder location on the Exec= line to match where you want it to go. Save the file.

  3. Now if you right-click on a selection in thunar, you will notice a "Documents" entry in the send-to menu, if selected, will move the selection to the Documents folder.

If you need the destination folder to be selectable (meaning a different folder every time), use this "move.desktop" contents instead:

# move.desktop - move files to user-selectable  dir via send-to
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Exec=bash -c "mv %F $(zenity --file-selection --directory --title 'Select the directory to move to...')"
Icon=stock_folder-move
Name=Another directory

Note, this option requires that you have zenity installed.

Custom Actions
Following the documentation here, you can create a new custom action via Edit > Configure custom actions.  Let me know if the above isn't what you want to do and we can throw together a custom action for you. The main difference is that custom actions don't appear in the send-to submenu, the appear below.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-05-17 09:56:48

dreimal
Member
Registered: 2022-05-04
Posts: 7

Re: Custom action to move files

Something I've wanted to work out for an age, now working beautifully!

I simply had no idea about the 'Send-to' menu being configurable. As my need is indeed for a static, non-selectable folder (to which to send files for a Syncthing sync), this option is perfect. It even looks pretty - so satisfying that Thunar can just pick up 'Icon=syncthing'.

Thanks so much for your help again, Toz. I'm already thinking of similar uses, for custom actions, too. Links bookmarked for future reference!

Offline

#4 2022-05-17 15:49:52

CwF
Member
Registered: 2018-01-28
Posts: 305

Re: Custom action to move files

dreimal wrote:

I simply had no idea about the 'Send-to' menu being configurable.

I've mostly ignored send-to my self. This is helpful, thanks for bringing it up.

I have many CA's that fit the send-to idea, so it seems another option to simplify the menu.
I see it can respond  to mime types, so now we need a 'configure send-to' in Thunars menu!

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 546.64 KiB (Peak: 547.48 KiB) ]