You are not logged in.
Pages: 1
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;
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
@ 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
Ah right.
Thunar doesn't do keyboard bindings?
Offline
@ 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
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
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.
Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c
Offline
Hi guys.
I made this script by try merge the minimalist entry interface of zenity with the --confirm-overwrite param in file selection.
#!/bin/sh
file=$(zenity --entry \
--title "Create New File" \
--text "Enter the file name:" \
--width=300 \
--entry-text "");
while
test -e "$file"
do
file=$(zenity --entry \
--title "Create New File" \
--text "File already exists. \nEnter a new file name:" \
--width=300 \
--entry-text "$file");
done
if [ "$file" != "" ]
then
touch "$file"
fi
Is my first script. Hope you like.
Last edited by gphilippi (2021-02-15 10:05:35)
Offline
I like Tuxy solution and made it simplier.
Thunar Edit>configure custom actions>new (plus sign)
Name: Create new file
Command: file=$(zenity --entry --title "Create New File" --text "Enter the new name:" --entry-text ""); touch "$file"
Shortcut: Shift+Ctrl+m (for example)
Tab Appearance: Pattern *, mark all boxes
That's it!
Offline
With GTK<3.10 you could change all accels, meaning, you could have set a keybinding on every menu entry, but the GTK developers removed this feature because they think keyboard shortcuts should not be user editable:
"It's not a regression, if it's planned." - https://gitlab.gnome.org/GNOME/gtk/-/issues/5242
Last edited by Sur3 (2023-09-21 09:09:02)
Offline
Pages: 1
[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 560.72 KiB (Peak: 577.56 KiB) ]