0

I'm still a complete noob as regards Unix/Linux/Ubuntu. Per that earlier question, I tried installing Ubuntu 4 years ago, but gave up when I couldn't even manage to configure my screen resolution.

I now have a new PC that came with Ubuntu 16.4 LTS pre-installed, and which I successfully updated to 17.10 by following instructions I found online. I'm sure I'll have lots of really basic questions over the coming months as I try to get to grips with it, but I have one particular problem already where I can't find any help online for what looks like a trivial issue.


I have a Dropbox file /home/mini/Dropbox/Public/notes.txt that I also view/edit from other (Windows-based) machines. Currently I can only access this file by navigating to it using the Ubuntu "file explorer" (Nautilus?).

The only file/icon on my desktop at the moment is something that I think is called Chromium Web Browser.Desktop, which appeared after I followed online instructions to install that as my default browser. What I want is another file/icon that will invoke Gedit on my notes.txt file.

I can invoke Gedit on the Chromium...desktop file, but I don't understand any of the contents, so I've no idea if it's even meaningful to treat that as a starting point for creating my own "shortcut".

On my Windows machines, I can just right-click on a "target" file and select Send to -> Desktop (create shortcut) to create an *.lnk file, or I can create an *.bat file containing the command line notepad \Users\Fumblefingers\Dropbox\Public\notes.txt, but I just can't figure out how to do something similar in Ubuntu.


To repeat - all I want is a desktop file/icon to invoke Gedit on my notes.txt file. I still find it hard to believe I can't figure this out for myself, but I'm sure someone here can explain things (in really simple terms please! :)

FumbleFingers
  • 226
  • 2
  • 13

1 Answers1

6

Create a new file and name it for example gedit-note.desktop in your desktop folder, then write the following inside

[Desktop Entry]
Name=gedit-notes
GenericName=Text Editor
Comment=Edit text files
Exec=gedit %U /home/mini/Dropbox/Public/notes.txt
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;

This should open gedit with your specific file

  • Thank you so much! I had to *Trust and launch* the first time I clicked on the file I copied your text into, but now it just does exactly what I'd expect when I double-click on it. – FumbleFingers Jan 10 '18 at 16:05
  • @FumbleFingers As you are a relativelly new askubuntu user. Please do not forget to accept the answer. – Bruni Jan 10 '18 at 16:09
  • @Bruni: Ooops! I've been around on SO English Language for years, so I should know better! Answer "accepted" now, and thanks for the reminder (I don't suppose there's any point in waiting for a "better" one! :) – FumbleFingers Jan 10 '18 at 16:18
  • ;-) Maybe I should have bothered to look at the profile. – Bruni Jan 10 '18 at 16:21
  • @Adel (or anyone else): I don't suppose you could point me to documentation for what all those lines mean. And are they all necessary? it seems like a lot of detail for such a simple job. – FumbleFingers Jan 10 '18 at 16:29
  • 1
    @FumbleFingers you can read the article from gnome developer, you'll find what's required for a desktop file to actually work. There is also a description of each line... [https://developer.gnome.org/integration-guide/stable/desktop-files.html.en#ex-sample-desktop-file] – Adel Kihal Jan 10 '18 at 20:29
  • @Adel - very useful link, thanks. I'm starting to realise that many of the "standards" I need to get to grips with aren't necessarily part of Linux (or even Ubuntu). In this case it hadn't even occurred to me that I should approach my problem by reading up on the Gnome "desktop environment". Apparently, in this area, Gnome uses / is based on freedesktop standards, which I'd never heard of until now. But in future I'll know where to look (I'll just come here and follow my own link in this comment! :) – FumbleFingers Jan 11 '18 at 17:26