Discussion:
Modifying Desktop Icons
(too old to reply)
Pranjal Singh
2024-06-17 19:50:03 UTC
Permalink
Hi,

I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.

I've modified and created .desktop
files as per tutorials on the net and rebooted, but it doesn't work.

What I've done is changing /usr/share/applications/firefox.desktop:

- Exec=firefox %u
+ Exec=firefox -private-window %u

I also created a desktop file in ~/.local/share/applications, but
that too didn't work.

Can someone direct me to documentation or the actual implementation
of desktop icons?

Thanks,
Pranjal
e***@gmx.us
2024-06-17 20:10:01 UTC
Permalink
Post by Pranjal Singh
Hi,
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
Post by Pranjal Singh
- Exec=firefox %u
+ Exec=firefox -private-window %u
I also created a desktop file in ~/.local/share/applications, but
that too didn't work.
How didn't it work? Did it run regular Firefox, or not run at all?
Pranjal Singh
2024-06-20 17:50:01 UTC
Permalink
Hi Eben,

Sorry for the late reply.
I realise I could've added more details.
Post by Pranjal Singh
Hi,
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
Post by Pranjal Singh
- Exec=firefox %u
+ Exec=firefox -private-window %u
I also created a desktop file in ~/.local/share/applications, but
that too didn't work.
How didn't it work?  Did it run regular Firefox, or not run at all?
It runs regular Firefox after adding the -private-window flag.

To get a MWE, I made these changes later:
- Exec=firefox -private-window %u
- StartupWMClass=firefox
+Exec=gnome-calculator

This too doesn't change anything.
Meanwhile, I also found some seemingly unhelpful documentation at
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html
(Exec key - says what I expected)
https://specifications.freedesktop.org/desktop-entry-spec/latest/index.html
(The entire specification)

Any ideas, anyone?

Grateful,
Pranjal
Greg Wooledge
2024-06-20 18:00:01 UTC
Permalink
Post by Pranjal Singh
It runs regular Firefox after adding the -private-window flag.
- Exec=firefox -private-window %u
- StartupWMClass=firefox
+Exec=gnome-calculator
Did you see Gareth's reply at
<https://lists.debian.org/debian-user/2024/06/msg00432.html>?

It's supposed to be --private-window with two leading hyphens, not one,
he said.
d***@howorth.org.uk
2024-06-20 20:00:01 UTC
Permalink
Post by Greg Wooledge
Post by Pranjal Singh
It runs regular Firefox after adding the -private-window flag.
- Exec=firefox -private-window %u
- StartupWMClass=firefox
+Exec=gnome-calculator
Did you see Gareth's reply at
<https://lists.debian.org/debian-user/2024/06/msg00432.html>?
It's supposed to be --private-window with two leading hyphens, not
one, he said.
He was wrong according to Mozilla's documentation.
Gareth Evans
2024-06-22 10:20:01 UTC
Permalink
Post by d***@howorth.org.uk
Post by Greg Wooledge
Post by Pranjal Singh
It runs regular Firefox after adding the -private-window flag.
- Exec=firefox -private-window %u
- StartupWMClass=firefox
+Exec=gnome-calculator
Did you see Gareth's reply at
<https://lists.debian.org/debian-user/2024/06/msg00432.html>?
It's supposed to be --private-window with two leading hyphens, not
one, he said.
He was wrong according to Mozilla's documentation
My advice was based on

$ firefox -h | grep private
--private-window <url> Open <url> in a new private window.
$

I did try (with Mate Desktop) with both single and double hyphens, both on the command line and in

/usr/share/applications/firefox-esr.desktop

One hyphen failed to have the desired effect, but works when I try it now. Firefox hasn't been updated here since, so there seem to be other variables involved.

I would be inclined to take it from the firefox help grep results above that the double-hyphen form should always work.

I think the wiki is out of date - cf.

"-private
Opens Firefox in permanent private browsing mode ...

-private-window
Opens a new private browsing window in an existing instance of Firefox ..."

https://wiki.mozilla.org/Firefox/CommandLineOptions#Command_line_options

There is no "[-]-private" option according to the grep I performed, and [-]-private produces a non-private window when run here from the command line.

$ apt policy firefox-esr
firefox-esr:
Installed: 115.12.0esr-1~deb12u1
Candidate: 115.12.0esr-1~deb12u1
Version table:
*** 115.12.0esr-1~deb12u1 500
500 https://security.debian.org/debian-security bookworm-security/main amd64 Packages
[...]
Pranjal Singh
2024-06-22 20:20:01 UTC
Permalink
Hi Gareth,

I have solved it.
The solution: *drumroll* Switch from Ubuntu to Bookworm.
Post by Gareth Evans
[...]
There is no "[-]-private" option according to the grep I performed, and [-]-private produces a non-private window when run here from the command line.
Thanks Brad, Max, Greg, Jeffrey, Tomas and the unnamed Briton.
I have used Bookworm earlier, but the apt policy bit and Max's reply
drove me to return.

Some confusion may still be in order though:

Nikulin's suspicion that a copy of the file is used seems true: changing
non-pinned icons in Ubuntu's panel worked without a reboot, but not
Firefox. I tried looking into the GNOME source (grep-ing into that address)
but in vain.

The desktop-file-validate tool threw no error. Incidentally, the Ubuntu
desktop file had a single hyphen in the sub-entry for private windows
(Bookworm does not have sub-entries), but I've used both single and double
hyphens earlier. But I am using double hyphens now, as Brad warned.

I don't think *I* should raise a bug as Max suggested: unless a significant
number of users is interested, I wouldn't want to, although not having
your data out there is better IMHO. Perhaps some day I'll contribute the
feature myself.

Thanks again,
Pranjal
Max Nikulin
2024-06-23 02:20:01 UTC
Permalink
Post by Pranjal Singh
although not having
your data out there is better IMHO
Notice that firefox has "Always use private browsing mode" setting
exposed to UI.

Max Nikulin
2024-06-21 02:10:01 UTC
Permalink
Post by Pranjal Singh
- Exec=firefox %u
+ Exec=firefox -private-window %u
I also created a desktop file in ~/.local/share/applications, but
that too didn't work.
You may file a bug (if it does not exist yet) against the Debian package
to add alternative actions in the desktop file, see
<https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/docker/firefox-snap/firefox.desktop>

It would not open private widow by default though, it just would make it
available from GUI.

Have you checked your files using the desktop-file-validate tool?

Are you sure that your desktop environment uses namely files you have
edited, not a copy of the original file? Menus may use cache with data
extracted from desktop files instead of files directly. Try to set
unique Name and Comment.

Notice that the firefox-esr bookworm package contains
/usr/share/applications/firefox-esr.desktop, not
/usr/share/applications/firefox.desktop. I would avoid editing
/usr/share/applications/firefox-esr.desktop since every package update
means revert to original version with loosing changes.
Gareth Evans
2024-06-18 00:50:01 UTC
Permalink
Post by Pranjal Singh

Hi,
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
- Exec=firefox %u
+ Exec=firefox -private-window %u
Assuming that's not a typo, please try:

--private-window

(NB two hyphens at the beginning)

This works for me on Mate.
Jeffrey Walton
2024-06-20 18:20:01 UTC
Permalink
Post by Pranjal Singh
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
- Exec=firefox %u
+ Exec=firefox -private-window %u
--private-window
(NB two hyphens at the beginning)
This works for me on Mate.
According to Mozilla documentation at
<https://wiki.mozilla.org/Firefox/CommandLineOptions>, it is one
hyphen, not two.

Jeff
t***@tuxteam.de
2024-06-20 18:40:02 UTC
Permalink
Post by Jeffrey Walton
Post by Pranjal Singh
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
- Exec=firefox %u
+ Exec=firefox -private-window %u
--private-window
(NB two hyphens at the beginning)
This works for me on Mate.
According to Mozilla documentation at
<https://wiki.mozilla.org/Firefox/CommandLineOptions>, it is one
hyphen, not two.
And according to "firefox --help" it's two, not one. Never trust the
internet, I s'ppose :-)

Cheers
--
t
t***@tuxteam.de
2024-06-20 18:30:01 UTC
Permalink
Post by Gareth Evans
Post by Pranjal Singh

Hi,
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
- Exec=firefox %u
+ Exec=firefox -private-window %u
--private-window
Yep. Asking firefox itself (firefox --help) confirms that the
option wants two dashes.

Cheers
--
t
d***@howorth.org.uk
2024-06-20 20:00:01 UTC
Permalink
Post by t***@tuxteam.de
Post by Gareth Evans
On 17 Jun 2024, at 20:45, Pranjal Singh
Hi,
I am trying to modify the Firefox desktop icon so that it opens
an incognito window by default.
...
- Exec=firefox %u
+ Exec=firefox -private-window %u
--private-window
Yep. Asking firefox itself (firefox --help) confirms that the
option wants two dashes.
See https://wiki.mozilla.org/Firefox/CommandLineOptions#-private-window

or just try it! It works pefectly well with a single hyphen.
Greg Wooledge
2024-06-20 21:20:01 UTC
Permalink
Post by d***@howorth.org.uk
Post by t***@tuxteam.de
Post by Gareth Evans
--private-window
Yep. Asking firefox itself (firefox --help) confirms that the
option wants two dashes.
See https://wiki.mozilla.org/Firefox/CommandLineOptions#-private-window
or just try it! It works pefectly well with a single hyphen.
It seems to work either way, with firefox-esr 115.12.0esr-1~deb12u1 .
I tested with <firefox --private-window https://www.debian.org/>
and <firefox -private-window https://www.debian.org/>.

So... in that case, we don't know why the OP's thing isn't working.
Something something desktop blah blah. Try to find a log file where
you can see what's wrong. If it's not a DE, you might be able to
find logs in ~/.xsession-errors but with a Fancy Desktop Environment,
the logs could be *anywhere*. Or nowhere.
t***@tuxteam.de
2024-06-21 04:40:01 UTC
Permalink
On Thu, Jun 20, 2024 at 09:33:22PM +0100, Brad Rogers wrote:

[...]
This is (one) reason why using undocumented features is a Bad Thing™.
It doesn't seem to be "undocumented": on the contrary, it's rather
"overdocumented" (two different ways in two different places), but
thanks to some intrepid users in this thread we do know that both
ways work.

In Greg's words, it seems to be something something desktop.

Cheers
--
t
Loading...