I expect the application 'gedit' to launch when I double click a text file on the Ubuntu desktop. Actual result is that nothing happens. Manually typing 'gedit file.txt' does open the file in gedit. Double-clicking on other files types (pdf, ods, etc) opens the expected application.
$ grep DESC /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"
$ uname -io
x86_64 GNU/Linux
$ update-alternatives --config editor | grep \*
* 0 /bin/nano 40 auto mode
It looks like your File Manager is Files/Nautilus. The ability to open files by double clicking the file on the "Desktop" was removed from Files/Nautilus a few years ago. See THIS Gnome developers post explaining the change. You can still open files from within the "Desktop" FOLDER in Files just not on the Desktop itself.
I am trying to make a distintion between clicking on a Desktop icon ON the Desktop and clicking on a file in the Desktop folder IN the Files file manager. In fact, in Gnome 3.36 you won't see Desktop icons at all "out of the box". You must install a Gnome Extension in order to enable Desktop icon's on the Gnome Desktop.
Nautilus understands that text files may or may not be executable (as in, they might be shell scripts). But it does not parse the content of a text file to determine whether or not it is a shell script. It merely looks at two facts about the file: 1) is it a text file? 2) is granted the "executable" permission?
Based on those two facts about the file, AND the preferences you have specified about Nautilus behavior, it decides whether to run it in a text editor, execute it as if it were a shell script, or prompt you.
So if your ordinary (not a shell script) text file happens to have the execute permission, Nautilus might be trying to execute it as if it were a shell script (which then does nothing).
You can change whether or not any text file is executable by right-clicking on it, selecting "Properties," going to the "Permissions" tab, and checking or un-checking the box that says "Allow executing file as program." For regular text files, you will want to un-check that, but for shell scripts, you will want to check that. Note: you can also change this via command line using "chmod".
You can change the double-click behavior of Nautilus, for EXECUTABLE text files (shell scripts), by accessing any folder (so you have Nautilus up) and going to the "Edit" menu, then "Preferences," then "Behavior." The setting is under "Executable Text Files."
Lastly, you can change which text editor to use for normal text files by right-clicking on them, selecting "Properties" and clicking the "open with" tab.