SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-04-19 17:20:52

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Thunar - Create New File

No shortcut for this in Thunar, but using xdotool you can have one:

1. Make a script, paste in the following save and make executable:

#!/bin/bash

## creates new file when thunar is active window
sleep 1
xdotool getactivewindow key alt+f d e

Create a new application shortcut, pointing to your new script file and with the key combination you prefer ( I used CTRL+SHFT+F)

Now when thunar is your active window and you need to create a new empty file, just hit the shortcut.

I found I had to put a 1 second delay in otherwise the script didn't seem to catch.

Last edited by Joe90 (2015-04-19 17:21:28)

Offline

Help fund CrunchBang, donate to the project!

#2 2015-04-19 18:31:22

woodape
#! CrunchBanger
From: Cape Town, South Africa
Registered: 2014-03-27
Posts: 113

Re: Thunar - Create New File

Isn't there specifically an option in Thunar to create an empty file? Right click in Thunar -> Create Document -> Empty File

Offline

#3 2015-04-19 19:54:38

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

^ There is. smile  I'd expect the code for it is something simple, like `read n; touch .\"$n"` wrapped in a dialog.  To paraphrase William of Ockham, "Don't make things any more complicated than they have to be."

Offline

#4 2015-04-20 20:32:11

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Thunar - Create New File

Aim was to use keyboard only, not mouse.

@pvsage please produce evidence, not just hypothesis, I did research this wink

If there is a better way, I am all ears smile but this is the simplest I could come up with, without using the mouse.

Offline

#5 2015-04-20 23:55:16

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 674

Re: Thunar - Create New File

Joe90 wrote:

If there is a better way, I am all ears smile

sudo apt-get install pcmanfm

Then:

Crtl+Alt+N

Really... I don't understand, why (a great percentage of) everybody insists on using thunar, when pcmanfm has tabs, dual pane view, custom actions, no probs mounting external drives, etc.. pp.
I just don't understand. Maybe i'm dumb  8.(

Offline

#6 2015-04-21 00:14:40

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Thunar - Create New File

@Kuno

When did it get custom actions? That was always one of the good things about thunar compared to others.


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

#7 2015-04-21 00:27:04

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 674

Re: Thunar - Create New File

damo wrote:

@Kuno

When did it get custom actions? That was always one of the good things about thunar compared to others.

Right-click/Open with

Offline

#8 2015-04-21 00:39:10

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Thunar - Create New File

damo wrote:

@Kuno

When did it get custom actions? That was always one of the good things about thunar compared to others.

libfm-modules - file management support (loadable modules for library)

enables a bunch of extra stuff for pcmanfm as far as I can tell. For instance, right click --> Create New gives me folder, script and text files as options. Also, right click will give you your default handler for media files. Very useful for mpv as it makes the command line optional for it.

The only minor annoyance that I know of is when I open as root, it still defaults to user-level home instead of /root. However, it just occurred to me that I can fix that in Openbox's menu by passing it /root, so not really a biggy.

Of course, it goes without saying the auto-mounting magic is entirely dependent on properly configured policykit configs.

Offline

#9 2015-04-21 07:35:33

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

Joe90 wrote:

Aim was to use keyboard only, not mouse.

@pvsage please produce evidence, not just hypothesis, I did research this wink

If there is a better way, I am all ears smile but this is the simplest I could come up with, without using the mouse.

Don't know enough about the source code to know what method Thunar uses to create the empty file.  (Apparently there was once a problem in Thunar with the option to create an empty document not being available; I've found a thread about that on these forums dated January 2012.)

Using keyboard only:  In open Thunar window, press and release the Menu key to bring up Thunar's right-click context menu.  Select Create Document -- Empty File.  Type in name.  Thunar automatically selects the newly created file and reports a size of 0 bytes.  Total of four keystrokes (menu, down, down, right), not including the name of the file.

Anyway, all of this is beside the point.  Your method works for you, and after you get it set up, it takes a couple fewer keystrokes, so that makes it more convenient if creating empty documents in the file manager is a frequent and natural part of your workflow.

Offline

#10 2015-04-21 07:38:36

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

@Kuno:  Is there a way to open PCManFM's context menu without using the mouse?  In many applications, a press-and-release of the menu key does this, but it doesn't seem to work in PCManFM, and I can't find an equivalent.

Offline

#11 2015-04-21 09:15:29

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 674

Re: Thunar - Create New File

pvsage wrote:

@Kuno:  Is there a way to open PCManFM's context menu without using the mouse?  In many applications, a press-and-release of the menu key does this, but it doesn't seem to work in PCManFM, and I can't find an equivalent.

That's strange, because for me the menu key works fine that way. hmm 
BTW:  a sample file for custom actions can be found here: https://madebits.github.io/#r/linux-pcmanfm-actions.md

Offline

#12 2015-04-21 09:51:48

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

^ If a file or directory within the PCManFM window is selected, then the context menu pops up with the menu key.  If nothing is selected, the menu key does nothing.  (This is with PCManFM in Jessie.  Can't remember if you mentioned you're sticking with Waldorf for now?  Older PCManFM may be better behaved.)

Offline

#13 2015-04-21 12:47:08

Kuno
#! Die Hard
From: Osnabrück - DE
Registered: 2009-01-09
Posts: 674

Re: Thunar - Create New File

pvsage wrote:

^ If a file or directory within the PCManFM window is selected, then the context menu pops up with the menu key.  If nothing is selected, the menu key does nothing.  (This is with PCManFM in Jessie.  Can't remember if you mentioned you're sticking with Waldorf for now?  Older PCManFM may be better behaved.)

Confirmed - nothing selected, nothing happening. PCManFM in Sid, which is where i switched to 6 months ago.

Offline

#14 2015-04-21 17:06:33

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

^ Good - sidebar resolved.

Back to my backpedal:  Linux is about choice.  If the default options don't work for you, there are always other ways.  Basically, what Joe90 did is make an xdotool macro to simulate the keystrokes that activate Thunar's File menu and `touch` a new document from there.  I never would have thought of anything like that!  (Well, I would have back when I was using Mac System 7, but that was literally half a lifetime ago.)

Offline

#15 2015-04-21 17:19:11

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Thunar - Create New File

Thanks pvsage for the background smile

I posted the tip as thunar is the default file manager in #! (or whatever!)

Yes, it only saves me a single key, but fits with the new folder shortcut.

Didn't know pcmanfm had come on so much, but have just got so used to my thunar setup and custom actions, and especially rename (for which I have not found anything better either- here we go again wink )

Offline

#16 2015-04-21 18:40:45

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Thunar - Create New File

tknomanzr wrote:

Of course, it goes without saying the auto-mounting magic is entirely dependent on properly configured policykit configs.

PCManFM automounts OOTB in Debian Jessie LXDE.
wink

Offline

#17 2015-04-21 18:43:54

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Thunar - Create New File

pvsage wrote:

Linux is about choice.

Is it?

(With sincere apologies to Joe90 for 2 off-topic posts in a row)

Offline

#18 2015-04-22 05:37:19

CBizgreat!
#! Die Hard
Registered: 2011-07-27
Posts: 1,865

Re: Thunar - Create New File

AHHHHHH a giant NO, ma eyes, ma po eyes !

Sorry for 3 off topic's in a row Joe. smile


Some common cbiz abbreviations. This will save me time and yet @ same time tell folks what the babble is supposed to mean.

Vll ! = ( Viva la gnu/Linux !)    Vl#!! = ( Viva la #! !)    Last but not least, UD ... OD ! = ( Use Debian ... or die !) tongue

Offline

#19 2015-04-22 08:18:50

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Thunar - Create New File

Poor, poor Adam Jackson.  Seven years later and we're still saying "Linux is about choice"...with the tacit understanding on practically every side of the conversation that by "Linux" we mean "GNU/Linux distros", though it also allows people like Adam to choose to ignore such obvious implications.

...and with that, I think I should really say:
/sidebar (read the "/" as "end of")

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo