Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-11-07 19:31:13

ramack
Member
Registered: 2009-05-15
Posts: 20

Thunar Create Document >

I can't figure out what I'm not doing or what I'm doing wrong in order to Create Document from a template while using Thunar.  Right clicking in the open space doesn't list a Writer template that I've place in ~/Templates or in ~/Templates/Writer.

I've followed the instructions here: http://docs.xfce.org/xfce/thunar/workin … nd-folders

Create Document
Allows you to create a new document either as a blank file or from a template. If you choose the Empty File option and type in a file name with no extension, by default it will create an empty, plain text document. If you assign a file extension of a recognized MIME type, it will create a file of that type. For example, typing MyDocument.odt will create a blank OpenDocument Text file.

You can also create files from a pre-configured templates. To do that, you first create a file with all of your desired settings in the application of your choice and then save it in the ~/Templates folder. That file name will then appear as a choice in the Create Document list. Give it a new name and you now have a new file based on your custom settings.


I've tried saving the file several different ways, but I'm unable to get anything other than the default Empty File to show.  What am I missing?
Thanks,

Offline

#2 2017-11-08 16:27:13

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

Re: Thunar Create Document >

Try these steps:

  1. Open mousepad, type in the word "template" and save the document as "Mousepad.txt" in ~/Templates

  2. Open Thunar and navigate to your "Documents" folder.

  3. Right-click and select "Create Document > Mousepad"

  4. You will be prompted for a name for the file. Enter something else or keep the same. Your call.

  5. Open the new file you created, you will see the word "template" in the document.

So basically, this allows you to make a copy of an existing document from your Templates folder. Now imagine if you created a libreoffice document to document meeting minutes, where you created the outline/format (plus any specific formatting) for minute-taking but there was no data in it. You can quickly create copies of this "template" document for your minute-taking needs.


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 ---

Online

#3 2017-11-09 18:11:23

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

ToZ,
Following your instructions still only shows the default Empty Text file.
Thanks,

Offline

#4 2017-11-09 18:53:56

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

Re: Thunar Create Document >

What versions of Xfce and thunar are you using?


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 ---

Online

#5 2017-11-09 22:31:08

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

ToZ,

I'm running Debian 9 (stable)

$ dpkg -s thunar
Package: thunar
Status: install ok installed
Priority: optional
Section: xfce
Installed-Size: 886
Maintainer: Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>
Architecture: amd64
Version: 1.6.11-1
Replaces: thunar-data (<< 1.2.3-3)
Depends: libatk1.0-0 (>= 1.12.4), libc6 (>= 2.4), libcairo2 (>= 1.6.0), libdbus-1-3 (>= 1.9.14), libdbus-glib-1-2 (>= 0.88), libexo-1-0 (>= 0.10.0), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.37.3), libgtk2.0-0 (>= 2.24.0), libgudev-1.0-0 (>= 146), libice6 (>= 1:1.0.0), libnotify4 (>= 0.7.0), libpango-1.0-0 (>= 1.14.0), libsm6, libthunarx-2-0 (>= 1.1.0), libxfce4ui-1-0 (>= 4.9.1), libxfce4util7 (>= 4.9.0), libxfconf-0-2 (>= 4.6.0), thunar-data (= 1.6.11-1), desktop-file-utils, shared-mime-info, exo-utils
Recommends: default-dbus-session-bus | dbus-session-bus, libfontconfig1 (>= 2.11), libfreetype6 (>= 2.2.1), libpangocairo-1.0-0 (>= 1.14.0), libpangoft2-1.0-0 (>= 1.14.0), xfce4-panel (>= 4.11), xfce4-panel (<< 4.13), thunar-volman, tumbler, xdg-user-dirs, gvfs
Suggests: thunar-archive-plugin, thunar-media-tags-plugin
Breaks: thunar-data (<< 1.2.3-3)
Description: File Manager for Xfce
 Thunar is the file manager designed to be the default file manager for the
 Xfce desktop environment. It has been designed to be fast and easy to use.
 .
 Also included is an Xfce panel plugin which can manage the desktop trash.
Homepage: http://thunar.xfce.org
$ dpkg -s xfce4
Package: xfce4
Status: install ok installed
Priority: optional
Section: xfce
Installed-Size: 16
Maintainer: Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>
Architecture: all
Version: 4.12.3
Depends: xfwm4 (>= 4.12.0), xfconf (>= 4.12.0), xfce4-settings (>= 4.12.0), xfce4-panel (>= 4.12.0), xfdesktop4 (>= 4.12.0), thunar (>= 1.6.6), gtk2-engines-xfce (>= 3.2.0), xfce4-session (>= 4.12.0), xfce4-appfinder (>= 4.12.0), xfce4-pulseaudio-plugin, orage (>= 4.12.0), libxfce4ui-utils (>= 4.12)
Recommends: xorg, desktop-base (>= 5.0.4), thunar-volman (>= 0.8.1), tango-icon-theme (>= 0.8.90), xfce4-notifyd
Suggests: xfce4-goodies, xfce4-power-manager (>= 1.4.0), gtk3-engines-xfce (>= 3.2.0)
Description: Meta-package for the Xfce Lightweight Desktop Environment
 Xfce is a lightweight desktop environment for unix-like operating systems.
 It aims to be fast and lightweight, while still being visually appealing and
 easy to use.  Designed for productivity, it loads and executes applications
 fast, while conserving system resources.
 .
 This package is a metapackage;  it depends on the core packages of the
 Xfce4 desktop environment and recommends some extra Xfce4 packages.  If you
 intend to use Xfce4 and want the full experience then installing this
 package and the packages it Recommends is a great place to start.
 If you just want to pick and choose the core components then feel free to
 remove this package.
Homepage: http://www.xfce.org/

Thanks,

Offline

#6 2017-11-10 02:45:47

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

Re: Thunar Create Document >

Hmmm. I've tried this on a number of computers now and it works on all of them - including my server which runs debian 8.9.

Can you post back:

cat ~/Templates/Mousepad.txt

and do the same for the new file you created.


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 ---

Online

#7 2017-11-10 16:58:03

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

ToZ,

~/Templates$ ls
gedit.txt   Mousepad.txt  Templates.png  writer2.odt  writer.odt
MLA2.2.ott  template.ott  Writer         writer3.odt  writer.ott
ramack@RDesktopDeb:~/Templates$ cat ~/Templates/Mousepad.txt
template 

Templates.png

The screenshot is from a couple days ago, but show ' No templates installed ' and that the only option available is the Empty file.  I didn't cat the output of anything else since I haven't been able to create a file using a template yet.
Thanks,

Offline

#8 2017-11-10 18:48:19

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

Re: Thunar Create Document >

Strange.

What is the output of:

cat ~/.config/user-dirs.dirs

Perhaps you have run into a bug of some sort.


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 ---

Online

#9 2017-11-10 21:48:52

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

$ cat ~/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

Hmmmm.  Shouldn't

XDG_TEMPLATES_DIR="$HOME/"

be

XDG_TEMPLATES_DIR="$HOME/Templates" ???

Offline

#10 2017-11-10 22:32:45

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

So...I edited ~/.config/user-dirs.dirs and changed the TEMP line so that it is

XDG_TEMPLATES_DIR="$HOME/Templates".

Logged out, logged back in and it still didn't show any templates.  Not until I rebooted, logged back in did the templates now show.

Templates02.png

Thanks ToZ!!!

Offline

#11 2017-11-11 00:07:57

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

Re: Thunar Create Document >

Glad to hear that was it. For future reference, you could run:

xdg-user-dirs-update --set TEMPLATES ~/Templates

...to change the xdg directory assignments.


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 ---

Online

#12 2017-11-11 00:46:21

ramack
Member
Registered: 2009-05-15
Posts: 20

Re: Thunar Create Document >

Thanks again ToZ, I appreciate it!

Offline

#13 2017-11-13 01:16:41

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Thunar Create Document >

Cool, thanks to both of you!

ToZ is really an Awesome Individual, best kind of AI wink

Offline

#14 2020-06-23 08:04:31

jack_the_pirate
Member
Registered: 2016-09-10
Posts: 59

Re: Thunar Create Document >

Just my two cents:

- thank you ToZ for the solution

- tested this today in Debian 10 XFCE, and it keeps working (without the need to reboot, just logout and login again)

- also, you can customize your templates directory using the path above
- for example, I've set mine to /home/"my-user"/.templates

Last edited by jack_the_pirate (2020-06-23 08:05:46)


Queen - Megadeth - Metallica - 80's

Offline

#15 2020-06-23 13:26:50

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: Thunar Create Document >

There is a little trick, if thunar is running as daemon
it can receive dbus calls and create a file from a template from any directory.
Usefull for scripting.
The command is:

gdbus call --session  --dest org.xfce.Thunar --object-path /org/xfce/FileManager --method org.xfce.FileManager.CreateFileFromTemplate "$target_dir"  "$path_to_template_file" ":0.0" ""

eg.

gdbus call --session  --dest org.xfce.Thunar --object-path /org/xfce/FileManager --method org.xfce.FileManager.CreateFileFromTemplate "/home/user/Documents"  "/home/user/Desktop/apple.jpg" ":0.0" ""

But more can be done

gdbus introspect --session --dest org.xfce.Thunar --object-path /org/xfce/FileManager

Gdbus arguments are:
   s - string "String1"
   as - array of strings in format "['String1', 'String2']"
   b - boolean "true"  "false"
   a{sv} - arguments  "{'String': <'variant_value'>, 'String2': <'variant_value'>}"


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

Board footer

Powered by FluxBB