zocker-160 / SyncThingy

SyncThingy = Syncthing + simple tray indicator
GNU General Public License v3.0
116 stars 1 forks source link

[Steam Deck] Is it possible to make it autorun while in gaming mode? #11

Closed lyndonguitar closed 1 year ago

lyndonguitar commented 1 year ago

so no need to go to desktop mode

lyndonguitar commented 1 year ago

maybe natively implement this ? https://www.reddit.com/r/SteamDeck/comments/vocyi5/start_syncthing_automatically_on_steamdeck_even/?sort=new

zocker-160 commented 1 year ago

Yes I was thinking about this as well, I will definitely take a look.

The downside of this will be, that there won't we an easy way to stop it from game mode and / or check if it is still running.

zLeqitEclipse commented 1 year ago

Yes I was thinking about this as well, I will definitely take a look.

The downside of this will be, that there won't we an easy way to stop it from game mode and / or check if it is still running.

Well, at least you have the option to fire up chrome in Gaming Mode and access the web interface.

zocker-160 commented 1 year ago

Well, at least you have the option to fire up chrome in Gaming Mode and access the web interface.

That is true and probably the best solution. I did think about this problem a fair bit and sadly it looks like that there is no easy / convenient solution to make this work without the user having to run at least one console command.

zLeqitEclipse commented 1 year ago

Maybe a function in the system tray called 'Install Service' (or something like that) that runs something like systemctl --user enable --now syncthingy.service Obviously the Program needs to create the service file beforehand.

zocker-160 commented 1 year ago

That is sadly not possible, the Flatpak sandbox does not allow me to run commands on the host. That will always have to be done by the user manually.

There is a way to allow execute permissions, but that will not get approved on FlatHub if my only reason to request it is "user convenience".

xamindar commented 1 year ago

You can create your own systemd service file and launch the flatpak syncthing like so. First create the service file: (deck@xamdeck user)$ cat /home/deck/.config/systemd/user/syncthing.service

[Unit] Description=Syncthing

[Service] Type=simple ExecStart=flatpak run --branch=stable --arch=x86_64 --command=syncthing com.github.zocker_160.SyncThingy Restart=on-failure RestartSec=1 SuccessExitStatus=3 4

[Install] WantedBy=default.target (deck@xamdeck user)$

Then enable and start the service with "systemctl --user enable --now syncthing". Syncthing will now run in both gaming and desktop modes.

However, it appears the dev has not accounted for syncthing already running. As a result, the SyncThingy tray program (in desktop mode) will open for a few seconds, then close without any indication of why. Best to probably use the syncthing-gtk flatpak for now as that one is designed to manage an already running syncthing service.

jmqm commented 1 year ago

@xamindar , @lyndonguitar wants a convenient way to do it in gaming mode, different from creating a systemd file in desktop mode

xamindar commented 1 year ago

@xamindar , @lyndonguitar wants a convenient way to do it in gaming mode, different from creating a systemd file in desktop mode

@jmqm , then please provide info on where the systray is located in gaming mode or how to autostart background services through steam. Until then, running it as a systemd service is the only way to make it autorun in gaming mode. Also, maybe try posting something actually useful next time.

jmqm commented 1 year ago

@xamindar yikes, you get offended for no reason? There is no convenient way of doing it so original poster is asking if it can be added. What's your problem?

The systemd instruction is in the Reddit post mentioned previously so you didn't provide anything useful, just minor change.

And don't tell me what to do :) I won't follow anyway

mrexodia commented 1 year ago

Maybe you could have a menu option 'Install service' that just shows a dialog with the steps to follow:

This should be doable with just the touch screen of the Steam Deck, provided the buttons are big enough.

zocker-160 commented 1 year ago

here a quick summary of the problem:

  1. I am currently not supporting the use case of having syncthing running in the background
  2. SyncThingy closes on start silently in that case, because the port is already blocked
  3. I cannot register and run a systemd service from inside flatpak (user action will always be required)
  4. There is no simple way to manage (aka start / stop / check status etc) Syncthing from game mode as there is no such thing as a tray and getting an entry into the global Steam Deck overlay menu is not trivial.

solutions I can offer:

  1. I can look into a way to check if SyncThingy flatpak is already running (including as service) and make the systray show up as it should

  2. I am not interested in supporting the use case of having any syncthing process running somewhere in the system and attach to that as it will cause a lot of problems mainly because:

    • the "other" syncthing instance will have different settings than the "internal" one shipped with the flatpak
    • I cannot control the version of the "other" syncthing instance
  3. Similar to (1) and I can implement an error message in case the port is blocked by non SyncThingy process

  4. I can create the systemd service file when the user requests it and then show a command the user then has to run manually in the terminal

  5. I cannot think of any solution for problem (4) apart from opening a browser in game mode and navigating to the syncthing webui

thoughts?

xamindar commented 1 year ago

I think definitely implementing 1 and possibly 4 would be a good idea. That would cover the "want to run syncthing all the time" crowd.

zocker-160 commented 1 year ago

Yes I know it has been over 2 month, but I finally found the time to implement this.

I have implemented from the numbers above:

I will be pushing this new version to flathub-beta first for further testing.

zocker-160 commented 1 year ago

New version 0.6 is now available on Flathub-beta, let me know what you think.

From my testing it is looking good so far.

zocker-160 commented 1 year ago

pushed to stable, should be rolled out to everybody within the next hour or so