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

Ubuntu/Linux version? #8

Open
txhammer68 opened this issue Jan 15, 2025 · 5 comments
Open

Ubuntu/Linux version? #8

txhammer68 opened this issue Jan 15, 2025 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@txhammer68
Copy link

Any chance you can make a version for Ubuntu/Linux ?
thanks
I am looking into the session activity but cannot figure out how to access http://192.168.1.101:8920/Sessions
when i type in url i get nothing

@jonschz
Copy link
Owner

jonschz commented Jan 15, 2025

I could look into it, but can't make any promises - I don't have a desktop or laptop with Linux set up at the moment. If you have some basic programming experience, you're also welcome to contribute! The part that is most different to Windows would be the API calls that tell the system not to go to sleep, so any knowledge on that would also help.

@qwerty12
Copy link
Collaborator

I'm going off a small program I wrote seven years ago and I haven't ran Linux on the desktop in a very long time so take this with a grain of salt:

You ask something called logind (which, IIRC, replaced UPower as the program to ask) over D-Bus, an IPC mechanism, to inhibit sleep. If granted permission, you get transferred a file descriptor over D-Bus, which you close when you want the lock to be released. (Apparently, the currently-supported .NET library for D-Bus communication is https://github.com/tmds/Tmds.DBus)

As that systemd page notes, "Taking inhibitor locks is a privileged operation." If you were to ask for an inhibition, you would probably (again, I don't run Linux) get the PolicyKit agent asking you to enter the password of a privileged user. You would need to write a PolKit rule to allow inhibition requests originating from Jellyfin to go through without prompting the active user. Of course, that's not needed if someone's running Jellyfin as root, but I sincerely hope nobody is doing that.

(Desktop applications will usually ask a session manager daemon provided by their desktop environment of choice [e.g. GNOME] to inhibit sleep - this avoids the need for a password and writing Polkit rules for every application - but I don't think that's a feasible approach, most people are running Jellyfin as a daemon, not connected to a particular user's desktop session.)

@jonschz jonschz added enhancement New feature or request help wanted Extra attention is needed labels Jan 16, 2025
@txhammer68
Copy link
Author

I created a python script that does the job for Linux systems
You need a jellyfin api token, create in the Dashboard
Create a systemd timer to run the script once an hour will prevent the system from entering sleep/suspend mode

@jonschz
Copy link
Owner

jonschz commented Jan 23, 2025

This looks like one approach to at least partially tackle the problem, and looks like @qwerty12 's afterthought. Thanks!

  • I assume that this only works for some desktop environments, so gnome or kde must be running for this script to work?
  • Can you comment on @qwerty12 's objection that the script must be connected to a user session? I don't have enough Linux Desktop expertise to judge that.

@txhammer68
Copy link
Author

Definitely a hack. but works for me, thought some others could use as well. This is for ppl who use their computer/laptop for other things and run a jellyfin server...
Yes the script only works for user logged into PC/Laptop. I found this googling last year to prevent screen saver when running wine games.
One more thing the systemd timers/service units must be setup as --user configs
There are numerous ways to to disable power-management even with no DE, but this seems the simplest way.
A bit beyond my skill set learning the dbus comms at a system level.
Just wanted to share for some future googler...
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants