Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-01-04 19:52:26

Tabespe
Member
Registered: 2019-12-04
Posts: 103

chng name of desktop starter showed in thunar and terminal in one step

1. I create a starter on my desktop via right click -> create Starter -> Name: "MyStarter1" .
2. I have now a file with the name MyStarter1 on the desktop.
3. Also in thunar it shows me the name "MyStarter1".
4. Also when I copy this "MyStarter1"-file to another folder with thunar, I get again a file with the name "MyStarter1".

But this name showed in thunar and on the desktop is not the filename of this Starter. You can see this when you open the file "MyStarter1" with Featherpad. And change the line ...
Name=MyStarter1
... into ...
Name=MyStarter2

And save it.


You will now see a starter-file with the name "MyStarter2" in thunar. But this is not the name of the file, it is just the name of the "Starter". You can see this, when you go in a terminal and list the files with the command "ls".
The real file name of "MyStarter2" is still "MyStarter1.desktop" (Not MyStarter2.desktop).

Question: Is there a possibility to change the name of my desktop Starter from "MyStarter1" into "MyStarter2", so that not only the starter name showed on my desktop is changed, but also at the same time the name of the file showed in terminal (with command "ls") is changed from "MyStarter1" into "MyStarter2"?

Thank you.

Offline

#2 2021-01-04 22:44:02

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

Re: chng name of desktop starter showed in thunar and terminal in one step

What version of Thunar and xfdesktop are you running?

This report might be of some interest related to recent changes to this functionality.

Given that you want to change both the Name= of the file and the filename, perhaps a thunar custom action is the way to go. Something like:

#!/bin/bash

# $1 is the filename
# $ANS is the new name

ANS="$(zenity --entry --title="Full Rename" --text="New name...")"
DIR="$(dirname $1)/"
EXT="${1##*.}"

# change the Name= field
sed -i "s/Name=.*/Name=$ANS/" "$1"

# change the filename
mv "$1" "$DIR$ANS.$EXT"

exit 0

Set up the custom action to point to this executable with the "%f" parameter, and in the Appearance Conditions tab, select "Other" and set the filter to "*.desktop"


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 2021-01-05 13:41:07

Tabespe
Member
Registered: 2019-12-04
Posts: 103

Re: chng name of desktop starter showed in thunar and terminal in one step

Thank you for this great answer.

(I use Xfce 4.14.2)

Offline

Board footer

Powered by FluxBB