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

Allow the user to create a shortcut on the desktop and/or application folder #2966

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

sshcrack
Copy link

@sshcrack sshcrack commented Oct 22, 2024

This pull requests adds the option for the user to select in which folder they want to create their shortcut.
grafik

(See issue #639 )

I've tested on windows but couldn't test it for linux / flatpak / AppImage / macos. But it should also work there

Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
@sshcrack sshcrack force-pushed the add-startmenu-shortcut branch from 1727f56 to 59efca7 Compare October 22, 2024 19:20
launcher/Application.cpp Outdated Show resolved Hide resolved
launcher/ui/MainWindow.cpp Outdated Show resolved Hide resolved
@Trial97
Copy link
Member

Trial97 commented Oct 24, 2024

Also for systems like Flatpak where we can't get the desktop or applications path I think this option/action should be just one(ask the user where he wants the shortcut to be created).

Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
@sshcrack
Copy link
Author

Alright, I've just pushed the suggested changes. It works on windows, but I haven't tested for linux and can't test for macOS.

launcher/ui/MainWindow.cpp Outdated Show resolved Hide resolved
launcher/ui/MainWindow.cpp Show resolved Hide resolved
launcher/ui/MainWindow.cpp Outdated Show resolved Hide resolved
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
@Trial97 Trial97 added enhancement New feature or request changelog:changed A PR that appears under "Changed" in the changelog labels Oct 25, 2024
@Trial97 Trial97 added this to the 10.0 milestone Oct 29, 2024
@Mick235711
Copy link

Mick235711 commented Nov 29, 2024

I don't think this currently works with macOS; AFAIK, in macOS, createShortcut() currently ignores the first parameter and just creates an app file in the user Applications folder. Therefore, with the current code, it creates an application shortcut in macOS regardless of which option you choose.
I think we should either

  • Still only show one button for macOS (i.e., don't add the menu) and retain current behavior or
  • Properly implement desktop shortcut support for macOS.

Personally, I think this should be simple enough to implement correctly; maybe just making createShortcut() 's applicationDirectory variable respect the first argument is all that's needed for this to work. Though it's debatable if we also need a PrismLauncher Instances folder for desktop shortcuts like we have for Launchpad (application) shortcuts...

If you can't test for macOS, I can offer some assistance as I have a macOS system (aarch64) on hand.

Comment on lines +1670 to +1673
if (DesktopServices::isFlatpak())
on_actionCreateInstanceShortcutOther_triggered();
else
on_actionCreateInstanceShortcutDesktop_triggered();
Copy link

@Mick235711 Mick235711 Nov 29, 2024

Choose a reason for hiding this comment

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

Also, maybe it is more intuitive to add a settings item to determine the default shortcut creation location instead of pre-determining it like this?
(Just my 2c, feel free to ignore)

Copy link
Member

Choose a reason for hiding this comment

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

Trial97 requested for the setting to removed, and I agree that it's not needed

Copy link
Member

@TheKodeToad TheKodeToad left a comment

Choose a reason for hiding this comment

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

Looks pretty good and worked on my Windows install!

However the macos implementation should be updated to support the desktop too... also maybe make the windows implementation put it in a start menu folder named LAUNCHER_NAME Instances too :P. I don't think you can do the same on Linux and have it work for all desktop environments though

Also it crashed for me the first time on windows but I'm not sure if you introduced this bug since I could not reproduce it again

@TheKodeToad
Copy link
Member

TheKodeToad commented Dec 1, 2024

Also mockups of ideas I had (obviously out of scope for this PR, just putting these ideas out there) (sorry they are a bit rushed and messy)

I think it'd be better as a dialog, then there's room for more options

image
image

Would be super cool if it's viable (i'll probably open a dedicated issue)
image

I don't think it's that easy to delete things out of the application menu/start menu/launchpad, so maybe there should also be a button to delete all shortcuts for an instance or something like this which might be overkill now I think about it

image

We should probably at the very least clear all shortcuts for an instance when it is deleted

@sshcrack
Copy link
Author

sshcrack commented Dec 1, 2024

Alright thanks for the feedback! Unfortunately I'm busy right now but will try to implement the changes in the next two weeks

@TheKodeToad
Copy link
Member

I was just posting the other ideas for the sake of it, no need to implement them in this pr

@sshcrack
Copy link
Author

sshcrack commented Dec 1, 2024

Didn't express myself correctly 😅 meant the suggestions / fixes for mac.
Also are there any specific instructions on what exactly to change, I've got no idea of the whole mac thing (like application /desktop folders). I could look it up, but it will take some time then

@Mick235711
Copy link

Mick235711 commented Dec 1, 2024

I'm pretty sure macOS is very similar to Linux in these regards:

  • For application shortcut, create a .app directory in ~/Applications/${LauncherName} Launcher/ (this is already implemented)
  • For a desktop shortcut, create the same .app directory in ~/Desktop
  • For shortcuts in other places, create the same .app directory in the directory chosen by the user

So, basically, the only difference between the three is the target directory, which actually follows the same convention as Linux afaik.

@TheKodeToad
Copy link
Member

That should work, yes

@sshcrack
Copy link
Author

sshcrack commented Dec 7, 2024

I think creating shortcuts for MacOS should work now but couldn't test

@Mick235711
Copy link

Seems to working pretty well for macOS!
Just one small nitpick: The modification to launcher/ui/pages/global files seems to be only removing a newline. Is this intended?
Otherwise LGTM.

@sshcrack
Copy link
Author

sshcrack commented Dec 7, 2024

Seems to working pretty well for macOS! Just one small nitpick: The modification to launcher/ui/pages/global files seems to be only removing a newline. Is this intended? Otherwise LGTM.

Nope, missed that think my editor removed the newline, will undo

@sshcrack
Copy link
Author

sshcrack commented Dec 7, 2024

I'm adding info for the ideas here because I couldn't find a dedicated issue yet.
To add a non-Steam game, the shortcuts.vdf file must be modified. I can't find a way to refresh the steam library to reflect changes though, I've tried steam://AddNonSteamGame or steam://flushconfig but it doesn't seem to work

Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
@sshcrack sshcrack force-pushed the add-startmenu-shortcut branch from 145ac6c to c4ba7fc Compare December 7, 2024 19:25
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
@Mick235711
Copy link

To add a non-Steam game, the shortcuts.vdf file must be modified. I can't find a way to refresh the steam library to reflect changes though, I've tried steam://AddNonSteamGame or steam://flushconfig but it doesn't seem to work

It seems that shortcuts.vdf should be modified while the Steam client is not opened? This way there should be no refresh issues...

@sshcrack
Copy link
Author

sshcrack commented Dec 7, 2024

I guess so, but that would get annoying for the user. What I observed is that the shortcuts file gets refreshed when adding the shortcut

@TheKodeToad
Copy link
Member

TheKodeToad commented Dec 8, 2024

Oops, I forgot.
Opened #3176 so this pr isn't cluttered with discussion

@@ -779,8 +738,7 @@
</action>
<action name="actionViewCatPackFolder">
<property name="icon">
<iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
Copy link
Author

Choose a reason for hiding this comment

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

The QT-Editor removed the <normaloff> tag for every icon. Is that okay or should I try to undo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:changed A PR that appears under "Changed" in the changelog enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants