Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-07-08 22:07:06

Tuxy
Member
From: /home/tux
Registered: 2015-04-26
Posts: 3
Website

[WORKAROUND] Thunar - Create New File

If you ever used Thunar file manager, you know that there is no "Create File" shortcut,
there is only one to create "New Folder" using SHIFT+CTRL+N 

Make sure to install "zenity" package if you don't have it.

Create a script in /home/USER/newfile.sh

#!/bin/sh

file=$(zenity --entry \
        --title "Create New File" \
	--text "Enter the new name:" \
	--entry-text ""); touch "$file"

Set file permission: chmod +x newfile.sh

Then in Thunar create custom action:
"Edit" => "Configure custom actions..."

Name: Create New File
Description: Create new file using zenity
Command: ~/newfile.sh
(under Appearance Conditons tab)
File Pattern: *
(then select all of the "Appears if selection contains")

Then open your ~/.config/Thunar/uca.xml and find where you have name "<name>Create New File</name>" under it you should see <unique-id> remember the id.

Then open your ~/.config/Thunar/accels.scm file and uncomment your (gtk_accel_path "<Actions>/ThunarActions/uca-action-YOUR-UNIQUE-ID" "") after that apply shortcut key, I used "<Primary><Shift>f"

So in the end it should look simular to this; (gtk_accel_path "<Actions>/ThunarActions/uca-action-1234567890-2" "<Primary><Shift>f")

Log-Off, and Log back in and open your Thunar to try this new shortcut :-)

Now when I press SHIFT+CTRL+F or CTRL+SHIFT+F I get dialog like this;

FECvpJV.png

Its a bit ugly but works for me!

Last edited by Tuxy (2015-07-08 22:30:01)


--{ Using Arch Linux Since 2011-10-25 }--
Keybase @ https://keybase.io/tuxy
GitHub @ https://github.com/tuxy

Offline

#2 2015-07-09 17:48:26

Mark7
Member
Registered: 2007-10-05
Posts: 79

Re: [WORKAROUND] Thunar - Create New File

But there is a create new file shortcut.  It's just not called that (Create New Document is what you're looking for)

BopwT0Ll.png

Offline

#3 2015-07-09 18:03:04

Tuxy
Member
From: /home/tux
Registered: 2015-04-26
Posts: 3
Website

Re: [WORKAROUND] Thunar - Create New File

@ Mark7, you've obviously haven't read the whole post. I know there is a menu link, but the whole point to this workaround is to use "shortcut" > "SHIFT+CTRL+F" to create new file and not having to use a mouse.


--{ Using Arch Linux Since 2011-10-25 }--
Keybase @ https://keybase.io/tuxy
GitHub @ https://github.com/tuxy

Offline

#4 2015-07-11 09:28:29

Mark7
Member
Registered: 2007-10-05
Posts: 79

Re: [WORKAROUND] Thunar - Create New File

Ah right.

Thunar doesn't do keyboard bindings?

Offline

#5 2015-07-11 09:50:19

Tuxy
Member
From: /home/tux
Registered: 2015-04-26
Posts: 3
Website

Re: [WORKAROUND] Thunar - Create New File

@ Mark7, Not for "File" => "Create Document" => "Empty File"

But you can do for some other menu items in ~/.config/Thunar/accels.scm file.


--{ Using Arch Linux Since 2011-10-25 }--
Keybase @ https://keybase.io/tuxy
GitHub @ https://github.com/tuxy

Offline

#6 2016-05-18 11:40:41

mDfRg
Member
From: @mindefrag
Registered: 2016-05-18
Posts: 1
Website

Re: [WORKAROUND] Thunar - Create New File

Great work @Tuxy! I can confirm it works! Do you have any idea how to make it work in attached directories (like SAMBA share)? It appears that no custom action work in such folders...

Edit: at least it works with MOUNTED samba shares (via mount -t cifs //192.168.1.*/foo /mnt/bar).

Last edited by mDfRg (2016-05-18 12:21:00)

Offline

#7 2016-05-19 12:35:49

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

Re: [WORKAROUND] Thunar - Create New File

mDfRg
Another way to do it is with the 'file selection' dialog

#!/bin/sh

file=$(zenity --title 'Select Filename & Destination' \
--width=400 --height=500 --file-selection \
--save --confirm-overwrite)
if [ "$?" = "0" ]; then
   touch "$file"
fi

It asks for confirmation to overwrite if the file exists and lets you choose the path and create folders.
Just add the keyboard combo to run the script, no custom action needed.

Offline

Board footer

Powered by FluxBB