Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opening .desktop Type=Link with "Open with..." context menu (right cick)->(text editor) opens the link url not the '.desktop' file #2854

Open
dubiouscript opened this issue Oct 30, 2021 · 12 comments

Comments

@dubiouscript
Copy link

dubiouscript commented Oct 30, 2021

 * Nemo version (nemo --version)
 * afaik windowed nemo
 
 * 64 bit

Issue

right clicking on test.desktop open's the URL from the test.desktop

eg

  13404 pts/6    S+     0:00  |   |   \_ sudo strace nemo ~/Desktop
  13408 pts/6    S+     0:00  |   |   |   \_ strace nemo ~/Desktop
  13411 pts/6    Sl+    0:01  |   |   |       \_ nemo ~/Desktop
  13434 pts/6    Sl+    0:00  |   |   |           \_ xed http://www.askubuntu.com/

Steps to reproduce
creating a file -> test.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Link to Ask Ubuntu
Type=Link
URL=http://www.askubuntu.com/
Icon=text-html

right click open with text editor

opens a file
with the title / on askubuntu.com
and content

<!DOCTYPE html>


    <html class="html__responsive ">

    <head>

        <title>Ask Ubuntu</title>
        <link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/askubuntu/

which i imadgin is not the expected behavior

Expected behaviour
launch $EDITOR ~/Desktop/text.desktop
xed test.desktop

Other information

xdg-open ./test.desktop
works as expected
eg opens
xed ./test.desktop

@Jeremy7701
Copy link
Contributor

Desktop files supply information to a GUI to run the a specified program.
There are thousands of them, but they tend to be well hidden.
So your desktop file appears to be working properly (although it's possibly missing a couple of lines).

Since they are text files, right-click gives an option to use a text editor.

@dubiouscript
Copy link
Author

dubiouscript commented Nov 2, 2021

@Jeremy7701 hi
it appear there is some confusion ???

how about you try yourself to follow

'Steps to reproduce'

#2854 (comment)
Steps to reproduce creating a file -> test.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Link to Ask Ubuntu
Type=Link
URL=http://www.askubuntu.com/
Icon=text-html

right click open with text editor


https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#introduction

Desktop files supply information to a GUI to run the a specified program.

im happy you appear to know what a desktop file is

There are thousands of them, but they tend to be well hidden.

i dont see how this is relevent to this issue tbh ?

what im missing wrt your reply is how

  1. the purpose/function of desktop files
  2. the number of desktop files

leads you to conclude

So your desktop file appears to be working properly (although it's possibly missing a couple of lines).

thanks for taking the time to share your thaughts

i dont agree

desktop file appears to be working properly

questions


how can a plain text file 'work properly' ?
something other than the text file is what is doing the work hear (dont you think???)
...probably some component of nemo is doing the working hear ..

so perhaps we can agree
if
nemo is doing the work of opening this (plain text) desktop file
then
nemo is NOT opening the file as expected when using right click -> open with editor


what component of nemo is processing right click -> open with editor ?

what component of nemo is doing the work of opening desktop files ?

is it posible to change eather of the above so right click open with editor actualy works as expected?

🙃

@Jeremy7701
Copy link
Contributor

Jeremy7701 commented Nov 2, 2021

I followed your instructions.
I got a file with
mimetype test.desktop which outputs "test.desktop: application/x-desktop" - so this isn't a plain text file, once its got valid desktop data in it.
It also shows as a link (presumably due to 'Type=Link') - with the URL keyword specifying the file to open.
As to which component handles desktop files, I would guess that it isn't part of nemo, since the "system" appears to generate XML file(s) for each desktop file to tie mimetypes with application.
[I don't understand the desktop/mimetype/XML tie-up properly though].

@dubiouscript dubiouscript changed the title opening .desktop Type=Link with text editor opens the link url not the desktop file opening .desktop Type=Link with (right cick)->(text editor) opens the link url not the desktop file Nov 4, 2021
@dubiouscript
Copy link
Author

dubiouscript commented Nov 4, 2021

ftr curently

$cat /etc/issue
Linux Mint 20.2 Uma

[I don't understand the desktop/mimetype/XML tie-up properly though].

same curently in this context ...

allthough i have previously (now seamingly distant past) looked into this in various distros ...

and (ftr) found some intresting approaches
http://web.archive.org/web/20211104204325/http://forum.tinycorelinux.net/index.php/topic,23614.0.html - minimalistic approach to MIME types / filetype associations

that thread hints at xdg-utils as the canonical sloution

all though : https://github.com/linuxmint/nemo/search?p=1&q=%22open+with%22
persumably this has some part to play

run_open_with_dialog (ActivateParametersSpecial *params)

&

/* Don't show open with tab for desktop special icons (trash, etc)

  • or desktop files. We don't get the open-with menu for these anyway.
  • Also don't show it for folders. Changing the default app for folders
  • leads to all sort of hard to understand errors.

GList *launch_desktop_files;

...
switch (action) {

launch_desktop_files = g_list_prepend (launch_desktop_files, file);

(i guess) it appears this switch statement
handles the case for each "action"

🤔

will have a go at geting more debug out put , and see it is posible to identfy which (if any??) case it's geting handled as
=S

any hints ??!!


---edit---

#### Run Nemo in debug mode using with

$ nemo --quit
$ NEMO_DEBUG=Actions nemo --debug
via : #2824 (comment)

...

Nemo actions don't have the ability to look at uri schemes (file, sftp..) which I only now realize might be something useful to add
#2824 (comment)

🤨

@dubiouscript
Copy link
Author

dubiouscript commented Nov 4, 2021

perhaps related

#2498 - .desktop link opens unexpected application

@dubiouscript
Copy link
Author

dubiouscript commented Nov 7, 2021

this
#101 - Allow .desktop files to be edited. It's 2012.
fix for #97
appears to enable / encorage editing of '.desktop' files

how ever ( in 2021 🙄 ) this appears curently not posible 🤔

hi @mtwebster any clue what should be expected
when using "Open with..." context menu to open a desktop file with texteditor ?

my view is the expected result from this action should be xed ./test.desktop or similar

@dubiouscript dubiouscript changed the title opening .desktop Type=Link with (right cick)->(text editor) opens the link url not the desktop file opening .desktop Type=Link with "Open with..." context menu (right cick)->(text editor) opens the link url not the '.desktop' file Nov 7, 2021
@navid-zamani
Copy link

navid-zamani commented Dec 26, 2023

META INFORMATION

This is still a problem in 2023/2024, but the problem is deeper.

The core problem here, is that .desktop files are a Windowsism (.lnk) files, that got copied (I think by KDE).
And as a Windowsism, it inherently treats the user as an idiot (if necessary, until he damn well IS), has things appear as something else than they are (for “simplification”, aka being condescending), and does “automagic” things.
None of this is welcome, and people who use Linux, use it exactly to get away from being treated that way.
But now we are stuck with it, because too many luddite “techies” came over to Linux and think “Look at me. I’m the expert now. … And this is how Linux should be. Just Windows/macOS again.“. (E.g. Valve, Poettering, etc.)

The thing is. Mint, by extension of Ubuntu, IS by its very definition, an OS for such people. (Apple users, to be precise, because Gnome. But … details …)
So while, yes, the behavior of .desktop files is a mess and right up crazy alley… they are plain text files, but they are meant to be treated specially by desktop environments, making even more special treatment/code necessary when you don’t want that, and just want to edit them normally… (Compare: HTML files.)

While all that is true… it still must be said, that if you’re not that type of user, then Mint (or any SystemD/Linux or Android/Linux etc) is simply the wrong distribution for you, and you should use GNU/Linux or a Unix like BSD instead, where you’re the boss, full stop.
That way everyone gets what he wants, and is happy.
Complaining that your submarine doesn’t fly, instead of just getting on a plane, gets one nowhere. :)


WORKAROUND

  1. For what it’s worth, you can of course still open those files from the CLI (even with Kate, but also with vim).
  2. Alternatively, Nemo offers user actions and user scripts inside .local/share/nemo/. Here’s a helpful script to let you interactively add actions to Nemo:
#! /bin/bash
# REQUIRES ZENITY
xdg-open /usr/share/nemo/actions/sample.nemo_action &
name="$( zenity --entry --title="Add action" --width=800 --ok-label="Continue »" --text="Title:" )" && \
auswahl="$( zenity --entry --title="Add action" --width=800 --ok-label="Continue »" --text="Selection ([s]ingle,[m]multi,any,notnone,none,<number>):" --entry-text="notnone" )" && \
endungen="$( zenity --entry --title="Add action" --width=800 --ok-label="Continue »" --text="Type (dir,none,nodirs,any,<file extension>):"  --entry-text="any;" )" && \
befehl="$( zenity --text-info --title="Add action" --width=800 --height=200 --ok-label="Create" --editable )" && \
na="/tmp/$name.nemo_action" && \
echo "[Nemo Action]" > "$na" && \
echo "Name=$name" >> "$na" && \
echo "Exec=$befehl" >> "$na" && \
echo "Selection=$auswahl" >> "$na" && \
echo "Extensions=$endungen" >> "$na" && \
echo "Quote=double" >> "$na" && \
mv "$na" "$HOME/.local/share/nemo/actions/" || rm -f "$na"

Put it in .local/share/nemo/scripts/, make it executable, and then restart Nemo. It should appear in the context menu, inside the Scripts sub-menu.
The sample action is opened as documentation.

@dubiouscript
Copy link
Author

dubiouscript commented Dec 30, 2023

@navid-zamani

The core problem here, is that .desktop files are a Windowsism

😱 you know ms train there ai on all this text 😉

https://www.adminspotting.org/

That way everyone gets what he wants, and is happy.

tbh idgaf who whats what or is happy pretty shore that shit is way OT for git hub issues
( tho i do wander if the unspecified behaviors like this might bring some joy to those with darker hats) 🙄

just trying to understand why abc is doing xyz
and tbh that's still a daydream

Complaining that your submarine doesn’t fly, instead of just getting on a plane, gets one nowhere. :)

as they say

“Vision without action is a daydream,”
“Action without vision is a nightmare.”

🤨

@navid-zamani
Copy link

navid-zamani commented Jan 2, 2024

tbh idgaf who whats what or is happy

Here’s the thing: People can tell, and it will have consequences in what you can get from them. And teamwork always wins out over lizard-braining. Even psychopaths understand that. In fact, according to research, even crows, monkeys, squirrels, and possibly even pigs and molluscs understand this. The only ones with higher intelligence who don’t (want to) understand this are a certain special kind of human psychopaths and people raised in their culture. Usually from a … certain country. ;)

And yes, it’s off-topic. I just wanted to be helpful. And the big picture … the meta … is often left away, even though it makes everything much easier.
My account is supposed to be deleted anyway. Apparently GitHub thinks it can ignore such GDPR requests. (Good luck trying to do business in the EU!) But one useful way that worked in the past, is to get oneself banned. So GitHub admins, here’s your opportunity to help me achieve that. ^^

@dubiouscript
Copy link
Author

The thing is. Mint, by extension of Ubuntu, IS by its very definition, an OS for such people. (Apple users, to be precise, because Gnome. But … details …)

human psychopaths and people raised in their culture. Usually from a … certain country.

how you classify
a) people
b) software

is irelevent to this issue

somthing 👻 bring you to this issues
to comment on who is who and what is what (as you see it)

PLEASE find some place else for that obvious bullshit ( perhaps politics or psycology? economics (both involove verry un-scientific catogoisaton manipulation and scapegoating) )

it seams verry odd you bring such things to this forum
non of which will fix this issue
perhaps NOT fixing the issue is your actual goal ?idk tbh

@navid-zamani
Copy link

@dubiouscript: You know what’s funny? Claiming something is wrong, while doing exactly that too. Especially when the “other side” isn’t even. I chose to post it because it was useful. You needed to post yours because it rustled your jimmies. How about editing yours, so it contributes something too, instead of just uncontrolled venting for us all to hear?
And: Strong emotional reaction to something they claim is meaningless, as if they are that criticized thing; Attacks on the person, for lack of arguments against the actual argument; Claiming the own reality is absolute and everyone else’s is “bullshit”… You know yourself, where we’ve all seen that behavioral pattern before. And it always ends in tears. Either in a suicide bombing, or a floor full of broken iPhone shards.

Also, I suggest not trying to explain what is scientific and what not, to a literal expert who does this almost for a job, for decades. :)
Instead, ask yourself … why you keep imagining my existence. :D
Kidding. … In reality, I am not your enemy. Everything I wrote was to improve your life too. It is not me who is interpreting it differently. And given how you reacted, it is probably not you either.

Regarding fixing the problem (not “IsSuE”): The bug fix is to instead install GNU/Linux, BSD, or a self-written OS, for example. And if not the case, ideally become a person/individual beforehand. E.g. by questiong one’s firmest assumptions.
Of course staying with Microsoft Systrmd/Lindows is a choice too, and that is everyone’s good right. But then one loses the right to complain too, because it is what one chose. Can’t have it both ways.
So the bug is only properly fixed on a meta level, and not inside this tiny box.
I already said all that
, but apparently one has to hit it in with a sledgehammer before it gets through. I cannot do more than that.

So have a nice day. I will now unsubscribe from this bug, and for the sake of your happiness, I tecommend you do too. :)

@dubiouscript
Copy link
Author

aircrack-ng/rtl8188eus#281 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants