Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-10-13 14:00:13

FrankBKK
Member
From: far away
Registered: 2024-03-05
Posts: 14
LinuxFirefox 131.0

[SOLVED] Thunar Custom Actions - how to run a bash script ?

I try to run a bash script via custom actions.

The script runs fine in terminal but in Thunar nothing happens.
Already checked in Settings Editor  thunar/misc-exec-shell-scripts-by-default  is set to true.

Linux Mint 22 XFCE

What else can I do to persuade Thunar to run a script ?

Last edited by FrankBKK (2024-10-14 16:01:07)

Offline

#2 2024-10-13 18:34:36

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,481
LinuxFirefox 131.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

Thunar Custom actions needs to be able to find the script to run it - look at ~/.xsession-errors in case an error message is being posted.

Can you post back the contents of this script plus its location and your $PATH? Also the Custom Action properties as you have set them.


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 2024-10-14 04:16:12

FrankBKK
Member
From: far away
Registered: 2024-03-05
Posts: 14
LinuxFirefox 131.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

after I played around some more I found a hint when monitoring active processes and finally got it to work.

I had to change the Thunar Custom Action Property Command to

/usr/bin/xfce4-terminal -x /home/user/scripts/copyTBData.sh

Previously I just added the script path+file (e.g. /home/user/scripts/copyTBData.sh)
which did not work.

Works fine now, but I have no clue to why I have to call the terminal explicitly.
Maybe someone can help explain ?

Offline

#4 2024-10-14 10:59:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,481
LinuxFirefox 131.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

What does the script do? Can you post a copy of it?


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

#5 2024-10-14 13:06:20

FrankBKK
Member
From: far away
Registered: 2024-03-05
Posts: 14
Windows 10Firefox 130.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

ToZ wrote:

What does the script do? Can you post a copy of it?

Sure thing, it's a simple script to copy a Thunderbird profile from a NTFS partition to the local drive

#!/bin/bash
#
# copy Thunderbird email data from share to local Linux home folder 
# last edited: 2024-10-11 FW
#

# Source directory
source_dir="/media/user/server/Thunderbird/"

# Destination directory
dest_dir="/home/user/Thunderbird"

# Exclude the specified folder and all subfolders and files
exclude_folder="Archive"

# Create the destination directory if it doesn't exist
mkdir -p "$dest_dir"

# Use rsync to copy only newer files, excluding the specified folder and its contents
rsync -av --exclude="prefs.js" --exclude="$exclude_folder/" --update "$source_dir" "$dest_dir"

# keep the terminal window open, dont close it
bash

Offline

#6 2024-10-14 13:55:32

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,481
LinuxFirefox 131.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

I see. It's because you want to keep the window open. Those prior commands should run in the background and complete, but if you want to see the output, then yes - you will need to open a terminal window.


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

#7 2024-10-14 16:00:39

FrankBKK
Member
From: far away
Registered: 2024-03-05
Posts: 14
Windows 10Firefox 130.0

Re: [SOLVED] Thunar Custom Actions - how to run a bash script ?

ToZ wrote:

I see. It's because you want to keep the window open. Those prior commands should run in the background and complete, but if you want to see the output, then yes - you will need to open a terminal window.


I C - then we can close that - thanks for the info.

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, 7 queries executed - Memory usage: 547.89 KiB (Peak: 548.73 KiB) ]