Score:2

How to use ctrl+L shortcut of nautilus while opening or saving a file from a third party software say libreoffice or sublime using ctrl+o and ctrl+s?

ph flag

Many of you might not have understood what I'm asking (sorry for being so poor with my questioning skills), so let me explain with help of an example.

Suppose I'm in my ~/desktop/assignments/practicals/words/ directory and I want to save a word (.odt) file here. As you can see in below screenshot, I'm able to access my ctrl + L shortcut in nautilus file manager to access text location of my directory so I copied it in my clipboard using ctrl + c.

working dir

Next, I opened Libreoffice and typed a document and tried to save the file at my desired location (i.e ~/desktop/assignments/practicals/words/) using ctrl + L shortcut.

office

When I press save button, below window pops up (I call this 'Nautilus open and save navigator'. I don't know what's its official name is, so if anyone could tell me, I would be grateful).

save navigator

By default, it is telling me save file in ~/Documents/, but as I mentioned above, I want to save my file in ~/desktop/assignments/practicals/words/ so I tried to use ctrl + L shortcut to get text based location so that I could paste my directory path from my clipboard, but the shortcut key doesn't work here. Not only that, none of other keys like del, Alt + Enter etc. work in this save navigator window. So I manually have to navigate to my desired location, as shown below. It is really frustrating, and it wastes a lot of my time while opening and saving files.

manually navigating

I even tried to enable text based location permanently but nothing changes in the save navigator window. I even tried to install Nemo file manager (of linux mint) but save window still looks the same. On the other hand, in Windows File Explorer, I was able to do anything from open/save window (i.e every shortcut command used to work) and it even had text based location as default.

If you're trying to give me an answer specific to Libreoffice, then please don't do so, because it won't help me. Similar behavior could be replicated for a number of application which allow for ctrl + o/ctrl + S based shortcuts like firefox/sublime/gedit/vscode/android studio etc. So I'm looking for a general solution.

Thanks for being so patient and listening to my query, if you could help me it would be highly appreciated.

N0rbert avatar
zw flag
Good essay. What is your Ubuntu version and current desktop environment?
shadyWeeb18 avatar
ph flag
ubuntu 20.04 LTS focal
Score:0
zw flag

The file open and save dialogs are produced by GTK's component named GtkFileChooserDialog.

You are right about Ctrl+L, it was available in such dialogs in previous versions like Ubuntu 18.04 LTS with Gtk2.

The proposed workflow for modern Gtk3-based versions is the following:

  1. Navigate to some path using Nautilus, Nemo or Caja
  2. Press Ctrl+L to change location bar from breadcrumbs to text entry view
  3. Press Ctrl+C to copy the path from location bar to clipboard
  4. Open some application like Firefox, Chromium, LibreOffice, whatever
  5. Paste Ctrl+V path to Name field of GtkFileChooserDialog
  6. Hit Enter to go to the needed path
  7. Specify needed file name if you are saving file; or choose file to open if you are opening it.

Note: I'm doing with similar way on Windows for years. This method increases productivity.

shadyWeeb18 avatar
ph flag
Yup that seems the best way.
Score:0
cn flag

Once you copied the path in nautilus using the Ctrl+LCtrl+c shortcut, you can directly paste it in the save dialog (Ctrl+v). Then append the name of the file to the path you just pasted, and hit Enter to save the file in that location.

shadyWeeb18 avatar
ph flag
Yup I'm doing this way since last few days. I do think windows file explorer was more convenient, but I would get used to this : )
vanadium avatar
cn flag
What was more convenient in windows? I may not understand the actual issue then. In the Save As box, there is no "Ctrl+l": you just paste directly
Score:0
it flag

The reason that you cannot use the Nautilus shortcuts in those windows is because they are not Nautilus windows. They just look sort of similar because they use the same theme. In fact, most of the programs that come with Ubuntu use a unified theme. They do so the user can change to the desired 'look and feel' without much fuss. For example, inside the settings gui, you have the option to change between light and dark themes with a single mouse click. Without the unified themes, this would not be possible.

The save window in a program is implemented by the developer as a part of the GTK package. For more info on the subject, you can google GTK themes, or better yet, type the same term into the site search at the top of your screen. It is a pretty large topic which reaches well beyond the scope of this post.

As for a solution to your problem, youll find it in the settings menu I mentioned earlier. To access, click the dropdown arrow at the top right corner of your screen.

Once the menu is shown, you will need to navigate to the bottom of the nav menu on the left side of the window. Somewhere between the middle and bottom of the menu, you should see the option keyboard shortcuts. Clicking this will give you access to all of the system shortcuts, but in my opinion, this is not the best part of the feature.

If you scroll to the bottom of the list of shortcuts, you will find an area entitled Custom Shortcuts. This feature, if used correctly, will provide a shortcut to just about anything in the system.

For example, you could write and assign a short script (to a shortcut) which copies any document to ~/desktop/assignments/practicals/words/, thereby skipping nautilus and the save windows altogether.

However, assuming that you are new to Ubuntu (but also assuming that you are a programmer, just from the programs you've mentioned) I wouldn't expect you to be able to write a bash script off the cuff. For now, I would recommend writing a command that movess the files with paths matching ~/Documents/*\.odt to your target directory to ~/desktop/assignments/practicals/words/. This moves any file in documents with the filetype .odt automatically to your target directory.

To do this, in the Custom Commands area from before, add a command with a name like move files to my dir, or something like that. For the actual command, try this:

mv ~/Documents/*\.odt ~/desktop/assignments/practicals/words/

make sure to include the backslash before the period. Also, most of the time, when specifying commands to programs in this way, they won't be interpreted by bash. This has a lot of implications. For one thing, most commands (like mv for example) cannot be called without their full names.

To get around this, you can start by calling bash:

/usr/bin/bash -c mv ~/Documents/*\.odt ~/desktop/assignments/practicals/words/

This will be especially useful when you start trying to fit multiple program calls into a single command (It will happen, I promise. ( : )

Anyway, to sum up: For now, copying and pasting the last command above into the window above into a custom shortcut which you define will let you do the following.

  • when the save menu comes up, just click save and let it close.

  • once the window closes, hit your hotkeys.

  • That's it your done. Your file (and any other .odt files, in case you forgot to use the hotkeys last time) is now saved in your target directory.

NOTE: I say 'for now' because this is meant to suffice until such time that you are comfortable enough with the Linux interface that you aren't concerned with what is happening with the gtk windows. Again, It will happen. I am sure you are skeptical, as was I, but after a while, I realized what I was trading in that 'drag n' drop' functionality for: control. Complete control of your machine. You just need to know how, and the info is all in front of you. You just need to know how to look for it.

Anyway, I am starting to veer off topic, so I will end by saying that this took a while to type, so I'm sure I have forgotten something. If you have any questions, comment below this answer, and I'll get a notification.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.