20
850
Fork
You've already forked fuzzel
83

Entries in ~/.local/share/application should shadow those in /usr/share/applications/ #116

Closed
opened 2022年04月05日 21:26:40 +02:00 by WhyNotHugo · 9 comments

A common mechanism to override package-owned desktop files is to copy them into ~/.local/share/applications, and modify that copy (since the one is /usr/share/desktop will get overwritten on the next package update).

This mechanism is similar to putting a wrapper script in ~/.local/bin/ that shadows the real binary in /usr/bin.

Firejail, for example, relies on this. For desktop files that exist in /usr, it copies them into ~/.local/share/applications, and changes Exec= by prepending its sandboxing commands.

fuzzel, however, seems to show both entries, and it's confusing which one is which. Moreover, running the unsandboxed one is a security liability.

Feature request: Can fuzzel actually "shadow" one with the other in cases where the filename / Name= match?

A common mechanism to override package-owned desktop files is to copy them into ~/.local/share/applications, and modify that copy (since the one is /usr/share/desktop will get overwritten on the next package update). This mechanism is similar to putting a wrapper script in ~/.local/bin/ that shadows the real binary in /usr/bin. Firejail, for example, relies on this. For desktop files that exist in /usr, it copies them into ~/.local/share/applications, and changes Exec= by prepending its sandboxing commands. `fuzzel`, however, seems to show both entries, and it's confusing which one is which. Moreover, running the unsandboxed one is a security liability. Feature request: Can `fuzzel` actually "shadow" one with the other in cases where the filename / Name= match?
Owner
Copy link

This should already be happening. Which version of fuzzel are you running? And have you double-checked that the filenames of the .desktop files match?

This should already be happening. Which version of fuzzel are you running? And have you double-checked that the **filenames** of the `.desktop` files match?
Owner
Copy link

Note that fuzzel is currently affected by this bug, which is related: #114

Note that fuzzel _is_ currently affected by this bug, which is related: https://codeberg.org/dnkl/fuzzel/issues/114
$ ls -1 $HOME/.local/share/applications/ /usr/share/applications/ | grep firefox
firefox.desktop
firefox.desktop
$ ag Firefox $HOME/.local/share/applications/ /usr/share/applications/
/home/hugo/.local/share/applications/firefox.desktop
4:Name=Firefox
94:Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ
114:Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站;
/usr/share/applications/firefox.desktop
3:Name=Firefox
93:Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ
113:Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站;
```console $ ls -1 $HOME/.local/share/applications/ /usr/share/applications/ | grep firefox firefox.desktop firefox.desktop $ ag Firefox $HOME/.local/share/applications/ /usr/share/applications/ /home/hugo/.local/share/applications/firefox.desktop 4:Name=Firefox 94:Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ 114:Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站; /usr/share/applications/firefox.desktop 3:Name=Firefox 93:Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ 113:Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站; ```
Owner
Copy link

Not sure what to say; it works for me with fuzzel-1.7.0. Are you sure it's loading both .desktop files, and not multiple actions from one of the .desktop files (it's disabled by default, but perhaps you have --show-actions enabled)?

If you are on the latest fuzzel release, and if it's not multiple actions, can you please attach both '.desktop` files here?

Not sure what to say; it works for me with fuzzel-1.7.0. Are you sure it's loading both `.desktop` files, and not multiple **actions** from one of the `.desktop` files (it's disabled by default, but perhaps you have `--show-actions` enabled)? If you are on the latest fuzzel release, and if it's **not** multiple actions, can you please attach both '.desktop` files here?

Oh, one of them is the flatpak desktop file 🤦

I installed that long ago and forgot about it, sorry for the noise.

Do you think showing that it's a flatpak version could be possible? Maybe between parenthesis at the end of the desktop file?

It can be infered based on the desktop file's path (e.g.: contains "flatpak").

Oh, one of them is the flatpak desktop file 🤦 I installed that long ago and forgot about it, sorry for the noise. Do you think showing that it's a flatpak version could be possible? Maybe between parenthesis at the end of the desktop file? It can be infered based on the desktop file's path (e.g.: contains `"flatpak"`).
Owner
Copy link

Not really interrested in special casing things like this.

Curious though - is the flatpak's .desktop file named differently from the "normal" one? Because if they have the same name, one should simply override the other one.

Not really interrested in special casing things like this. Curious though - is the flatpak's `.desktop` file named differently from the "normal" one? Because if they have the same name, one should simply override the other one.

The file exposed by flatpak is called org.mozilla.firefox.desktop (all flatpaks follow this pattern), whereas the one exposed by native packages is just firefox.desktop.

The on supplied by flatpak also contains the X-Flatpak=org.mozilla.firefox line.

The file exposed by flatpak is called `org.mozilla.firefox.desktop` (all flatpaks follow this pattern), whereas the one exposed by native packages is just `firefox.desktop`. The on supplied by flatpak also contains the `X-Flatpak=org.mozilla.firefox` line.

The file exposed by flatpak is called org.mozilla.firefox.desktop (all flatpaks follow this pattern), whereas the one exposed by native packages is just firefox.desktop.

There's the problem, that's a packaging issue.

From the desktop entry spec @ https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id

Each desktop entry representing an application is identified by its desktop file ID, which is based on its filename.

> The file exposed by flatpak is called `org.mozilla.firefox.desktop` (all flatpaks follow this pattern), whereas the one exposed by native packages is just `firefox.desktop`. There's the problem, that's a packaging issue. From the desktop entry spec @ https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id > Each desktop entry representing an application is identified by its desktop file ID, which is based on its filename.
Owner
Copy link

I would very much like to stay away from any X-* attributes. And, as @tinywrkb says, if the desktop files have different IDs, then they're supposed to be treated like two separate applications.

If you want to have the flatpak version installed, but not showing up in fuzzel, you could shadow it in your ~/.local/share/applications, and set NoDisplay=true. Or, change the name to something like Firefox (flatpak) to distinguish it from the system application.

I would very much like to stay away from any `X-*` attributes. And, as @tinywrkb says, if the desktop files have different IDs, then they're **supposed** to be treated like two separate applications. If you want to have the flatpak version installed, but not showing up in fuzzel, you could shadow it in your `~/.local/share/applications`, and set `NoDisplay=true`. Or, change the name to something like `Firefox (flatpak)` to distinguish it from the system application.
Sign in to join this conversation.
No Branch/Tag specified
master
gnome-support
releases/1.14
issue-319-window-switching
issue-561-nord-theme-only
resvg-filtering-take-2
resvg-filtering
releases/1.13
rehanzo-dont-ignore-execute-648
keybinds-overwrite
issue-561-refresh-theme
ci-automated-testing
reenable-legacy-icons
releases/1.12
test-coverage-for-fzf-caching
releases/1.11
releases/1.10
releases/1.9
releases/1.8
releases/1.7
releases/1.6
releases/1.5
releases/1.4
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.14.1
1.14.0
1.13.1
1.13.0
1.12.0
1.11.1
1.11.0
1.10.2
1.10.1
1.10.0
1.9.2
1.9.1
1.9.0
1.8.2
1.8.1
1.8.0
1.7.0
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.2
1.4.1
1.4.0
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0
0.9.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fuzzel#116
Reference in a new issue
dnkl/fuzzel
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?