Closed Zukureneno closed 1 year ago
Here's the combined commits: https://github.com/aclist/dztui/compare/main...Zukureneno:dzgui-flatpak-fix:main?diff=unified
This is nice to see, someone adding onto the code. You have the distinction of being the first person to do that. (Would be preferable if you make a pull request next time, though)
$steam_cmd steam://etc
, with $steam_cmd
interpolated to steam or xdg-open.But the question here is, does one usually have both steam and flatpak steam installed? If both are available, how do we know which to prefer? Should flatpak always be preferred over steam if both are present, or vice versa? Should the user have to specify upfront which they want to use going forward? Does this even matter?
If steam present but no flatpak => use steam If flatpak present but no steam => use flatpak If both present => prefer which?
steam
dependency check and not alerting you that the other command was broken. The other thing to note is that each of the dependencies was being passed through command
as a single argument to check for its presence, so verbatim commands with word splitting like flatpak run ... --version
would not trigger correctly. Anyway, we can't fit a verbatim command like that in the current implementation of the array, so I think it'd be better to have a separate, standalone function (not unlike the watcher_deps
function) that checks for steam/flatpak, since flatpak necessitates a complex version check command (i.e., we can't just check if "flatpak" or "steam" is itself installed).Both of these are easy fixes, just need additional clarification on point 1 above. Thank you!
Why not adding some kind of check-mark/toggle that the user can select that when selected it will prefer flatpak or steam (this can be added on the Options > advanced options).
Edit: and maybe if both are detected at first boot up you can have a pop up that asks what does the user prefer?
as for the rest honestly my programming is super limited and I butcher my way to get it working. I found part of the solution here: https://github.com/flathub/com.valvesoftware.Steam/issues/641
I actually was trying to add a true/false variable that changed on the deps checkup to then be called on the launch section but yeah did I say I suck at programming? XD
Also I noticed that xdg-open works on both regular steam and Flatpak so maybe it could be perm changed for those areas unless you prefer 2 different depending if its a flatpak or regular .
as for the pull request..... well is my first time ever using github + did not want to request or modify something without testing it
opps sorry about that ; miss-clicked
That's OK, I misclick that button all the time.
This seems like something that should be handled for the most part internally (seamless fallback logic), with a prompt during first-time install to choose a preference. Good find on the flatpak URIs. It could go in the options menu as well; I'm just leery of having too many menus to navigate. Then again, if someone is particular about using flatpak, it seems reasonable that they'd be willing to tweak this config option. If we find both and the config option has not been set, we could just keep using steam
until the user toggles it otherwise.
It's not my intention at all to critize the way you wrote it or the way you requested it, just providing additional information as we evaluate the best approach.
The thing about xdg-open
is that it depends on xdg-utils
, which, while being included with most distros and desktop environments, is by no means guaranteed to be present. (For example, not installed by default on Arch Linux, but installed OOTB on Steam Deck). So I wouldn't replace the steam
call with that entirely. I think a conditional switch here is good. Either steam or xdg-open.
Flatpak is not my area of expertise, but I know some people swear by it, so by all means I do think it should be supported, and this looks like it is trivial to add.
A PR will just send the code upstream for review and I can reply/edit/approve/veto it, nothing more. Can be worth figuring out, as if I like the changes, I can just approve them and they will get integrated instantly.
I think I have enough info to proceed, will take a crack at this tomorrow and show you what I came up with, probably add it to Testing branch first.
This is live on the Testing branch. (3.2.0-rc.2)
Parameterize at startup:
steam_deps(){
local flatpak steam
flatpak=$(flatpak run com.valvesoftware.Steam --version 2>/dev/null)
steam=$(command -v steam)
if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then
warn "Requires Steam or Flatpak Steam"
exit
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
toggle_steam=1
steam_cmd="steam"
elif [[ -n "$steam" ]]; then
steam_cmd="steam"
else
steam_cmd="xdg-open"
fi
}
If $toggle_steam == 1
, add a toggle option in the advanced options menu. Default to steam
as the handler, but can be manually overridden to Flatpak (xdg-open
) by the user.
[[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]")
Please test and verify that the advanced options menu shows this toggle and that you can select it and launch the commands correctly.
damn you worked quite fast on that fix. I'll test it and let you know how it goes on both normal steam and flatpak steam.
As for why I started trying out the flatpak was cause of VanillaOS. Been testing that distro out to hopefully distro hop to it when I got all my stuff setup and verified. (is basically a debian/ubuntu Fedora silverblue)
Also no worries I did not even take it as a critique ; I just legit have very limited base programming knowledge. I can copy paste mainly hahaha.
Thanks for all the explanation I've learned a lot thanks to them.
cheers, I'll let you know how it goes.
This is live on the Testing branch. (3.2.0-rc.2)
Parameterize at startup:
steam_deps(){ local flatpak steam flatpak=$(flatpak run com.valvesoftware.Steam --version 2>/dev/null) steam=$(command -v steam) if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then warn "Requires Steam or Flatpak Steam" exit elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then toggle_steam=1 steam_cmd="steam" elif [[ -n "$steam" ]]; then steam_cmd="steam" else steam_cmd="xdg-open" fi }
If
$toggle_steam == 1
, add a toggle option in the advanced options menu. Default tosteam
as the handler, but can be manually overridden to Flatpak (xdg-open
) by the user.[[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]")
Please test and verify that the advanced options menu shows this toggle and that you can select it and launch the commands correctly.
I'm checking on my PikaOS install (deb steam) there's no option to toggle to flatpak on it:
The option will only show if BOTH native Steam and Flatpak steam are installed on the system. Does that system have both? If it only has native Steam, there is no option.
The option will only show if BOTH native Steam and Flatpak steam are installed on the system. Does that system have both? If it only has native Steam, there is no option.
ah no; They both have only 1 version of steam.
My PikaOS install has Steam Deb; my vanillaOS install has Flatpak.
I just rebooted from vanillaOS and the app did not go forward after the first launch; steam flickered (tried on terminal and it did not spit out any error)
Flatpak only installed:
What's the output of flatpak run com.valvesoftware.Steam --version 2>/dev/null
?
I just used that command you originally suggested, but it looks like this actually tries to launch the application before grabbing the version number. It'd probably be better to just parse the list of installed applications using flatpak list | grep valvesoftware.Steam
Pushed a hotfix to attempt to address this
What's the output of
flatpak run com.valvesoftware.Steam --version 2>/dev/null
?I just used that command you originally suggested, but it looks like this actually tries to launch the application before grabbing the version number. It'd probably be better to just parse the list of installed applications using
flatpak list | grep valvesoftware.Steam
zuku@vanilla:~$ flatpak run com.valvesoftware.Steam --version 2>/dev/null
zuku@vanilla:~$ flatpak list | grep valvesoftware.Steam
Steam com.valvesoftware.Steam 1.0.0.75 stable user
Pushed a hotfix to attempt to address this
yup w.e you did fixed it ; will test to join servers and subscribe to mods
zuku@vanilla:~/.local/share/dzgui$ ./dzgui.sh [DZGUI] Attempting connection to Official MAG MiddleAgedGamers PVE Deerisle |Crafting+ [DZGUI] All OK. Launching DayZ ./dzgui.sh: line 848: steam: command not found
It errors out on the Launch section
I can confirm its on the section I edited that it errors out cause flatpak doesn't accept steam --applaunch. that's why I commented it out and added the flatpak run to it there
Yes, I see the lines you are talking about. I thought I replaced them all, but missed those two in the launch() function. Pushed another hotfix
Yes, I see the lines you are talking about. I thought I replaced them all, but missed those two in the launch() function. Pushed another hotfix
zuku@vanilla:~/.local/share/dzgui$ ./dzgui.sh [DZGUI] Attempting connection to Official MAG MiddleAgedGamers PVE Deerisle |Crafting+ [DZGUI] All OK. Launching DayZ xdg-open: unexpected option '-applaunch'
OK, OK, I see now. Sorry. It was taking awhile to sink in. So if I understand correctly:
xdg-open
will inherit flatpak
for regular Steam browser protocol commands like steam://open/console
flatpak run com.valvesoftware.Steam -applaunch
Is this correct?
Ok found the issue :
So it can only be 2 ways for launching part ( i imagine you would have to create another steam command just for the launch)
xdg-open steam://rungameid/221100
or
flatpak run com.valvesoftware.Steam -applaunch 221100
Yeah, we can't use xdg-open here, because the browser protocol does not accept those additional launch parameters correctly. So we have to use the long form
Yeah, we can't use xdg-open here, because the browser protocol does not accept those additional launch parameters correctly. So we have to use the long form
Game opens up if you use this thou: xdg-open steam://rungameid/221100
It might open, but it's likely to crash if it doesn't have the additional parameters like nolauncher, nosplash, etc. If you set those in your right click menu in the game, it could work, but the point is that DZGUI obviates the need to manually set any of that. Working on a fix
It might open, but it's likely to crash if it doesn't have the additional parameters like nolauncher, nosplash, etc. If you set those in your right click menu in the game, it could work, but the point is that DZGUI obviates the need to manually set any of that. Working on a fix
yeah I tried this and it crashed:
xdg-open steam://rungameid/$aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
zuku@vanilla:~/.local/share/dzgui$ ./dzgui.sh
[DZGUI] Attempting connection to Official MAG MiddleAgedGamers PVE Deerisle |Crafting+
[DZGUI] All OK. Launching DayZ
xdg-open: unexpected option '-connect=198.244.173.127:2402'
So yeah xdg:open doesn't accept extra launch options
yeah I tried this and it crashed:
That, too, but what I mean here is that launching the main menu is not the same as launching the game here. Without the parameters, the game itself will tend to crash when you finish loading into a server.
Anyway, I pushed what is hopefully the last fix, please test the options menu, launching the game, and opening mod download pages when connecting.
Flatpak:
Flatpak:
Joining a fresh modded server(adding the ID) worked without hiccups
Great!
I merged this into the Stable branch as well (minor version bump). Please reopen the ticket if you have problems. Thanks a lot for the help and suggestion.
Just to confirm that I tried the toggle on PikaOS.
1 error I found was that when user toggles to flatpak it reverts back to steam when dzgui closes. Besides that the toggle works and I was able to join my favorite server without issues on either version.
PS: Make sure to not have regular steam open or it will bug out when trying to download the mods XD (if you launch for flatpak)
I found another issue. When both regular steam and flatpak are install. It will always try to open the regular steam to download the mod in question (when joining a server)
@aclist Sorry I don't know how to reopen a closed issue.
But big issue is when having both installed and flatpak open it will always default to open regular steam to download mods(while having flatpak selected on the advance options).
It bugs out and never downloads said mods so I have to force kill dzgui and steam.
(replaced a bunch of stuff opening from steam: to xdg-open to make the workshop work)
https://github.com/Zukureneno/dzgui-flatpak-fix/commit/e51b13ecade11be8ea273e4c23e3bd96b4e54ee7
(this one fixed the launch() for flatpaks by commenting and adding the flatpak version of the run + fix the deps checkup to have no errors) https://github.com/Zukureneno/dzgui-flatpak-fix/commit/c16955aae740464b8504ee4e8d7c55d75ddff815
however I don't know enough to add an (if else , or) on the launch area. Maybe adding a section that if flatpak = true then it will use the launch options for the flatpak if not to use the normal steam one.
I tested modding, subscribing and launching and all worked on flatpak; if i uncomment the normal steam launch() both work but terminal says that the other version is not found.
cheers hope this helps