Skip to content

Notify the System76 Scheduler which app has focus so it can be prioritized

License

Notifications You must be signed in to change notification settings

maxiberta/kwin-system76-scheduler-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KWin Script for system76-scheduler Integration

System76 Scheduler is a service which optimizes Linux's CPU scheduler and automatically assigns process priorities for improved desktop responsiveness.

This KWin Script interactively notifies System76 Scheduler which app has focus via D-Bus, so it is prioritized.

Limitations

The system76-scheduler service is published on the systemwide D-Bus bus; but KWin Scripts can only call D-Bus methods on the user session bus (as far as I can tell). This can be worked around by forwarding these specific messages from the session bus to the system bus. See the installation instructions below.

Installation

This KWin Script is published at the KDE Store and can be downloaded and installed via "Get New Scripts" at the Window Management → KWin Scripts settings.

Manual Installation

git clone https://github.com/maxiberta/kwin-system76-scheduler-integration.git
cd kwin-system76-scheduler-integration
kpackagetool6 --type KWin/Script -i .

or if updating:

kpackagetool5 --type=KWin/Script -u .

D-Bus Workaround (forward messages from session bus to the system bus)

Save this script as ~/.local/bin/system76-scheduler-dbus-proxy.sh (or anywhere else), and make it executable:

chmod +x /usr/local/bin/system76-scheduler-dbus-proxy.sh

This script can be run manually; or can be installed as a systemd user service so that it runs automatically on login. For example, save the following service definition as ~/.config/systemd/user/com.system76.Scheduler.dbusproxy.service:

[Unit]
Description=Forward com.system76.Scheduler session DBus messages to the system bus

[Service]
ExecStart=/usr/local/bin/system76-scheduler-dbus-proxy.sh

[Install]
WantedBy=default.target

And enable it:

systemctl --user enable --now com.system76.Scheduler.dbusproxy.service

Usage

  1. Install and configure System76 Scheduler.
  2. Install this KWin script.
  3. Activate the script at System Settings → Window Management → KWin Scripts (or run kcmshell5 kwinscripts).
  4. Run the dedicated D-Bus proxy as described above.
  5. Process priority (niceness) of focused apps should interactively update (e.g. check the NICE column in System Activity, htop, or any other process manager).