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

KeyFile: Make show and active Follow the Autostart Spec #184

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

Marukesu
Copy link
Contributor

this make the plug work correctly with files created by the background portal.

the autostart spec defines the Hidden key as the way to disable
a file from autostarting. Update the active property to use it if
X-GNOME-Autostart-enabled key is not defined.
update the show property to use the XDG_CURRENT_DESKTOP environment
instead of DESKTOP_SESSION, if none of the current desktop have a
match, we default to show if the OnlyShowIn key is not present.

this is the proper behaviour defined in the desktop entry spec, and
the autostart doesn't differ here.
@tintou
Copy link
Member

tintou commented May 23, 2023

I would recommend using DesktopAppInfo as the get_show_in (null) method would do all the work for you 🙂

@Marukesu
Copy link
Contributor Author

I would recommend using DesktopAppInfo as the get_show_in (null) method would do all the work for you 🙂

That is what i done first, but it ended up causing segfaults.

Copy link
Contributor

@zeebok zeebok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. Not sure if there is an ideal way to test but it doesn't appear to break anything that I can see. In fact on my main machine I see Music as an option for File Browser but in my test that seems to be gone which feels more appropriate?

@Marukesu
Copy link
Contributor Author

Marukesu commented Jun 6, 2023

Code looks good to me. Not sure if there is an ideal way to test but it doesn't appear to break anything that I can see.

Thanks for the code review, you can test the active part with 3 files in the ~/.config/autostart directory:

  • one without a Hidden or X-GNOME-Autostart-enabled key, that should show as enabled in the plug, disabling it should add a Hidden=false key to it.
  • one with Hidden=false, that should show as disabled and activating should change the key value.
  • one with X-GNOME-Autostart-enabled=false, also disabled from the start, but enabling this should change the X-GNOME-Autostart key instead of adding a Hidden key.

to test the show part you need to have others 3 files, and modify the XDG_CURRENT_DESKTOP environment value:

  • one with NoDisplay=true, that shouldn't be shown in the plug independent of the XDG_CURRENT_DESKTOP environment.
  • one with OnlyShowIn=GNOME:Pantheon, this one should be shown when any of GNOME, Pantheon, or both are specified in XDG_CURRENT_DESKTOP, but not otherwise.
  • one with NotShowIn=Pantheon, this one shouldn't be show when XDG_CURRENT_DESKTOP have Pantheon specified, but should otherwise.

In fact on my main machine I see Music as an option for File Browser but in my test that seems to be gone which feels more appropriate?

Well, this doesn't change anything outside of the startup page so i doubt this happened because of the changes here. Maybe you have a old version of music in you test machine, i see that it include inode/directory in they MimeType key. In my machine, i got music there with and without this PR.

@danirabbit danirabbit merged commit a23f68c into master Jun 7, 2023
@danirabbit danirabbit deleted the maru/keyfile-updates branch June 7, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants