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

Detect and prompt user if local Fightcade install detected #126

Open
Pobega opened this issue May 9, 2023 · 6 comments
Open

Detect and prompt user if local Fightcade install detected #126

Pobega opened this issue May 9, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Pobega
Copy link
Collaborator

Pobega commented May 9, 2023

Fightcade can't properly launch URLs when both the desktop version and Flatpak version are installed simultaneously. We should check for the existence of these .desktop files and open a zenity popup to let the user know this is going to not work correctly with the Flatpak.

~/.local/share/applications/Fightcade.desktop
~/.local/share/applications/fcade-quark.desktop
@JosephPobega
Copy link

if which fightcade >/dev/null 2>&1; then

zenity --question --text="A local installation of Fightcade has been detected. Do you want to continue with the Flatpak version?"
if [ $? -eq 1 ]; then

exit 1

fi
fi

flatpak run net.fightcade.Fightcade

@Pobega
Copy link
Collaborator Author

Pobega commented May 13, 2023

There's a few other decisions to be made here. I think the Zenity popup will have to have a few options, firstly the text would be something like non-Flatpak Fightcade installation detected. Do you want to remove the fightcade:// URL handlers? (the Flatpak will not be able to launch emulators until these files are removed). There will be a yes and no, and if yes we remove the files automatically for the user. If yes we probably need another popup that says A desktop restart may be required to launch emulators.

There also needs to be a checkbox that says Don't show this warning again and if that is checked we write to some file, and also a check at the beginning that if this file exists we skip the entire Zenity flow.

Alternatively the popup is just a one time warning that lets the user know to delete the files themselves or the emulators won't work. This will probably be the MVP before I make decisions on whether to handle it myself (I'm trying to get in contact with the Fightcade devs to ask if they can integrate this functionality in the client itself rather than some cruddy Zenity wrapper)

@Pobega Pobega self-assigned this May 13, 2023
@Pobega Pobega added enhancement New feature or request good first issue Good for newcomers labels May 13, 2023
@JosephPobega
Copy link

Alright I gotcha, I'll see if I can have it done by tonight.

@JosephPobega
Copy link

if [ -f ~/.disable_fightcade_warning ]; then
exit 0
fi

if which fightcade >/dev/null 2>&1; then
if zenity --question --text="Non-Flatpak Fightcade installation detected. Do you want to remove the fightcade:// URL handlers? (The Flatpak will not be able to launch emulators until these files are removed.)"; then

    xdg-mime default flatpak-run.desktop x-scheme-handler/fightcade
    xdg-mime default flatpak-run.desktop x-scheme-handler/fightcadelobby

    zenity --info --text="The fightcade:// URL handlers have been removed. A desktop restart may be required to launch emulators."
fi

if zenity --question --text="Do you want to disable this warning in the future?"; then
    # Create a file to disable the warning
    touch ~/.disable_fightcade_warning
fi

fi

flatpak run net.fightcade.Fightcade

@JosephPobega
Copy link

what the code does is check if the local installation of fightcade is present. if so, the script will then ask the user if they want to keep the installation of fightcade. If yes, script then prompts the user that their system may need to restart (to launch the emulator). antother if statement is followed asking the user if they want to disable the warning. finally, the FlatPak version of fightcade is launched.

@JosephPobega
Copy link

your probably better off going with your other option of just getting in contact with the devs to make it more official but just let me know if you go this route and want me to make any other changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants