Reply to topic

Adding my own templates to 'Create New' menu

kde-deshmukh
Registered Member
Posts
172
Karma
0
I am running KDE 4.11.3 on Kubuntu 13.10.

In Dolphin, on right click, there is a 'Create New' menu with pre-defined options like a directory/ folder, text file, etc.

How can I add my own templates to this? Say, a personal letter, etc.?

Elsewhere on the forum, there was a mention of /usr/share/kde/templates. But there is no such directory on my computer.

I created a ~/.kde/share/templates and added a file there. It does show in the 'Create New' menu now. But selecting it does nothing.

So, how do I add my own templates to 'Create New' menu?

By the way, Gnome has a simple solution --- all files in ~/Templates show up in the right click menu.


--
Manjaro Gnome. Kernel 4.19.24-1. 64-bit. 4GB RAM and more than 100GB free on the hard disk.
wolfi323
Registered Member
Posts
1128
Karma
11
OS
kde-deshmukh wrote:Elsewhere on the forum, there was a mention of /usr/share/kde/templates. But there is no such directory on my computer.

Well, I guess it would be /usr/share/kde4/templates/. At least it is on my system.

You can find out which directories are searched for templates by running:
Code: Select all
kde4-config --path templates


I created a ~/.kde/share/templates and added a file there. It does show in the 'Create New' menu now. But selecting it does nothing.

This should work.

But what kind of file did you add there?

The templates should be *.desktop files of type "Link". The easiest way to create one would be to copy an already existing one from /usr/share/kde4/templates/ and modify it accordingly. But don't forget to change its filename, otherwise it will override the global one.

A minimal example would look like this:
Code: Select all
[Desktop Entry]
Name=my_file
Comment=My own template
Type=Link
URL=path_to_a_file_with_the_default_file_content
Icon=text-plain
kde-deshmukh
Registered Member
Posts
172
Karma
0
That did the trick. Thanks. I am accepting your answer and marking this as solved.

But again, IMHO, adding files to a specific directory is MUCH simpler.


--
Manjaro Gnome. Kernel 4.19.24-1. 64-bit. 4GB RAM and more than 100GB free on the hard disk.
wolfi323
Registered Member
Posts
1128
Karma
11
OS
kde-deshmukh wrote:That did the trick. Thanks. I am accepting your answer and marking this as solved.

But again, IMHO, adding files to a specific directory is MUCH simpler.

A maybe easier way to create such a template would be this:
- navigate dolphin to the ~/.kde/share/templates/ folder
- right-click and choose "Create New"->"Link to Location (URL)..."
- enter something.desktop as name and select a file as location.

You should then have a new template that creates the file you selected.
kde-deshmukh
Registered Member
Posts
172
Karma
0
wolfi323 wrote:A maybe easier way to create such a template would be this:
- navigate dolphin to the ~/.kde/share/templates/ folder
- right-click and choose "Create New"->"Link to Location (URL)..."
- enter something.desktop as name and select a file as location.

You should then have a new template that creates the file you selected.


This does not work. I did exactly as suggested by you. The file I selected was a file in ~/Templates.

In ~/.kde/share/templates, now I see a folder icon with the test1.desktop as name.

On right clicking in ~, there is no test1 in the 'Create New' menu.

Something missing?


--
Manjaro Gnome. Kernel 4.19.24-1. 64-bit. 4GB RAM and more than 100GB free on the hard disk.
User avatar bcooksley
Administrator
Posts
19763
Karma
87
OS
Please open "test1.desktop" in a text editor and post it's contents here so we can examine it.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
kde-deshmukh
Registered Member
Posts
172
Karma
0
My apologies.

I think I did not restart the file manager.

It works just as expected. The file contens are:

[Desktop Entry]
Icon=folder
Type=Link
URL[$e]=file://$HOME/Templates/empty.txt

I am marking this as answered.


--
Manjaro Gnome. Kernel 4.19.24-1. 64-bit. 4GB RAM and more than 100GB free on the hard disk.

 
Reply to topic

Bookmarks



Who is online

Registered users: allanmills, Baidu [Spider], Bing [Bot], boudewijn, ccarlo, Google [Bot], ipwizard, Sogou [Bot], tymond