Skip to content

systemd: have gamemode not running all the time (use DBus activation, remove WantedBy) #560

@aktau

Description

@aktau

Is your feature request related to a problem? Please describe.: It appears that gamemoded is always started (I'm running NixOS with programs.gamemode.enable = true) when I "log in" with a program, for every user. Some programs don't ever use/call it though (for example: Kodi).

It seems like Bus-activatable services are a thing

This is properly set in the bus file

SystemdService=gamemoded.service

Quoting the docs:

Example 7. DBus services

For services that acquire a name on the DBus system bus, use Type=dbus and set BusName= accordingly. The service should not fork (daemonize). systemd will consider the service to be initialized once the name has been acquired on the system bus. The following example shows a typical DBus service:

[Unit]
Description=Simple DBus Service

[Service]
Type=dbus
BusName=org.example.simple-dbus-service
ExecStart=/usr/sbin/simple-dbus-service

[Install]
WantedBy=multi-user.target

For bus-activatable services, do not include a [Install] section in the systemd service file, but use the SystemdService= option in the corresponding DBus service file, for example (/usr/share/dbus-1/system-services/org.example.simple-dbus-service.service):

[D-BUS Service]
Name=org.example.simple-dbus-service
Exec=/usr/sbin/simple-dbus-service
User=root
SystemdService=simple-dbus-service.service

Please see systemd.kill(5) for details on how you can influence the way systemd terminates the service.

Describe the solution you'd like: Either removing the WantedBy=default.target or an explanation of why gamemoded doesn't work (well) as a bus service. I've tried to search for descriptions on historical commits and issues, but couldn't find it.

References:

Describe alternatives you've considered: Just let it be. It's OK. But I'm trying to minimize running processes that I don't (currently) require. I do use (and like) gamemode. It's just usally not necessary on my system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions