Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-04-24 22:49:10

TCx
Member
Registered: 2019-04-24
Posts: 7

Difficulty getting .desktop entry to open file with spaces

Hello,

I created a desktop entry in folder /home/user/.local/share/applications/clamscan.desktop with the following text:

[Desktop Entry]
Name=Clamscan Terminal
GenericName=virus scanner
Comment=scan in terminal
Exec=xfce4-terminal -e 'bash -c "clamscan %F;read -rsn1;echo"'
Terminal=false
Type=Application
Keywords=virus;scanner;
Icon=clamtk
Categories=Utility;
StartupNotify=false
Path=

I am using the "bash -c" line to keep the terminal window open after clamscan completes.  However, "bash -c" cannot read directory and filenames with spaces.  For example, if %F points to "\home\user\Desktop\directory 1\file", when I right click "file" and open with "Clamscan Terminal" in Thunar, nothing happens.  Is there as was to pass the selected file to Exec with escaped spaces?  Alternatively, is there a way to Exec xfce4-terminal and keep it open after the scan so that I can read the output?

Last edited by TCx (2019-04-24 22:53:28)

Offline

#2 2019-04-25 00:19:53

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,990

Re: Difficulty getting .desktop entry to open file with spaces

Hello and welcome.

I don't understand why you are using a desktop file and the Open in functionality for this. It sounds like a Thunar Custom Action may be a better option (assuming you only use this in Thunar).

Create a thunar custom action like this:
- Name = Virus scan
- Description = Scan for viruses
- Command = xfce4-terminal -T "Scanning for viruses, please wait..." -H -e "clamscan %F"
- Appearance tab = select all file types

Alternatively, is there a way to Exec xfce4-terminal and keep it open after the scan so that I can read the output?

Use the -H parameter. See above.


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 2019-04-25 00:51:53

TCx
Member
Registered: 2019-04-24
Posts: 7

Re: Difficulty getting .desktop entry to open file with spaces

Thanks. -H works!

Offline

Board footer

Powered by FluxBB