-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: implement full desktop spec #120
Conversation
Under the hhod we're using the https://crates.io/crates/freedesktop-desktop-entry crate here. This provides all of the parsing for .desktop entries and is actually kindly provided by pop ;). However, this library only contains the parsing of .desktop files and no utility functions for launchers like centerpiece. I've actually tested this with the .desktop files you provided above. For me, centerpiece only shows the "Firefox Nightly Default" entry. Can you check if you have other .desktop entries for Firefox in your system? |
Some context here: centerpiece looks for .desktop files in all directories specified in $XDG_DATA_DIRS and $XDG_DATA_HOME. It will only search for desktop entries in the subfolder (Library code related to searching .desktop files: https://github.com/pop-os/freedesktop-desktop-entry/blob/main/src/lib.rs#L329-L333.) |
Yes, that's where other launchers like Sirula load from as well. And indeed, that's where they are:
So, as you can see, the extra entries are being loaded, it just seems that there still isn't complete support for the spec - the |
Just for my sanity, can you please check whether you have other .desktop files for firefox in one of the directories under $XDG_DATA_DIRS. Also: What is wrong with the Name overrides? To me, the names seem to be correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, everything except the log comment is a nit.
Quite annoying the spec refers to |
I also find it quite annoying, but it is in a different spec: https://specifications.freedesktop.org/menu-spec/latest/ar01s02.html It would be nice, if they could cross reference. |
I guess since all other launchers just use XDG_DATA_HOME as a sole source for .desktop files if it is defined, we should do the same then? Also: Can you please post your .desktop files for firefox again? I can't seem to find the line of code where the Name is overridden with "DetSys". |
From the link for the menu spec it seems that
|
Oh, I'm so sorry, there's indeed a 4th desktop file for that profile:
|
After some offline discussion with @a-kenji, I think I got it right this time :D. Would you kindly test again @colemickens? |
No worries at all :)! I assume we are now running into your $XDG_DATA_DIRS having the wrong order of entries. To confirm this, please run the following:
This should give us a list of firefox .desktop entries in any of the directories specified in $XDG_DATA_DIRS and $XDG_DATA_HOME. This list is actually already in the correct order. Meaning, that if there are two .desktop files in this list with the same My guess is, that in this list there are firefox .desktop entries with have no |
Hm, you're right. I didn't check the spec, but XDG_DATA_DIRS normally contains system dirs, and XDG_DATA_HOME more containing user dirs, so I'm a bit surprised that XDG_DATA_HOME ones aren't considered to override or at a higher precedence. |
Nice :), now that we have the root cause of this problem identified, this should be fixable. This morning I actually found the section that specifies the hirarchy of these environment variables in the XDG specification. It can be found in the XDG Base Directory Specification. TLDR:
This means that the order in which directories are read in the freedesktop-desktop-entry crate (https://github.com/pop-os/freedesktop-desktop-entry/blob/main/src/lib.rs#L329-L333) is wrong since it specifies $XDG_DATA_DIRS before $XDG_DATA_HOME. I'll go and fix this in the freedesktop-desktop-entry crate and I'll hotfix this by overriding this function in centerpiece for now. Will ping you here once this is ready :). |
…ding desktop entries
Hey @colemickens, I've just pushed the hotfix prioritizing XDG_DATA_HOME over XDG_DATA_DIRS. Wanna test one more time :)? |
I've also created a PR to the freedesktop-desktop-entry crate to upstream this fix: pop-os/freedesktop-desktop-entry#10. |
I'm quite sad to report that my laptop decided to drink some coffee. I'm limping along from a non-Linux device, and giving it some time to air out. Hopefully, I can test next week, but it could be a month if it's kaput. |
OH NO! I'm rooting for you that it turns on again! I'll revert my hotfix here and update the https://github.com/pop-os/freedesktop-desktop-entry crate, since the upstream fix was already merged :). After that I'll merge this PR. Feel free to test this and open a new issue whenever you're back to normal mode @colemickens :). |
…when reading desktop entries" This reverts commit 15dfa5d.
Actually, I noticed some negative performance impact in the plugin with the new functionality while doing my last tests. I guess I'll have to revise the implementation. |
The laptop, somehow, lives to fight more Nix and Rust (and Halo!). This latest version seems to behave as I was expecting. Thank you!! |
Performance is improved, the plugin does not read desktop enties repeatedly anymore, time to merge this :>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
## Release Notes ### ✨ New Features * 💄 display bars to visualize cpu core usage by @friedow in #121 * ✨ `git_repositories`: add `zoxide` integration by @a-kenji in #111 * ✨ enable font-fallack for all entries by @friedow in #131 * 🌈 Allow setting colors via configuration by @pinpox in #141 * 😜 Gitmoji plugin by @friedow in #144 * 📑 Firefox bookmarks plugin by @friedow in #133 * 📜 Firefox History by @friedow in #152 ### 🐛 Fixed Bugs * 🐛 return false when file_name cannot convert to str by @prmadev in #123 * 🐛 filter empty plugins for calculating scroll offset by @friedow in #125 * 🐛 Add sort function to plugin trait by @a-kenji in #124 * 🐛 implement full desktop spec by @friedow in #120 * 🐛 fix initial sorting in a bunch of plugins by @friedow in #129 * 🐛: fix suspend command invocation by @a-kenji in #134 ### Maintenance * 📝 clarify wayland support by @a-kenji in #105 * 👷 remove magic-nix-cache action by @a-kenji in #106 * ✏️ Fix a small typo in the Readme by @a-kenji in #112 * 🚨 Implement various clippy suggestions by @a-kenji in #113 ### New Contributors * @prmadev made their first contribution in #123 * @pinpox made their first contribution in #141 **Full Changelog**: v1.0.0...v1.1.0
This PR implements a bunch of fixes around the applications plugin. This aligns the applications plugin closer with the freedesktop desktop entry specification. Furhtermore it fixes #110.
This PR includes: