improve system76-scheduler-dbus-proxy (#756)

This commit is contained in:
lleyton
2023-10-28 23:07:36 -07:00
committed by GitHub
parent 182ebe16e5
commit e5f66a2f83
2 changed files with 11 additions and 6 deletions
@@ -1,5 +1,7 @@
[Unit]
Description=Forward com.system76.Scheduler session DBus messages to the system bus
StartLimitIntervalSec=60
StartLimitBurst=5
[Service]
ExecStart=/usr/local/bin/system76-scheduler-dbus-proxy.sh
@@ -1,11 +1,14 @@
#!/bin/bash
set -euo pipefail
DBUS_SERVICE="com.system76.Scheduler"
DBUS_PATH="/com/system76/Scheduler"
DBUS_INTERFACE="com.system76.Scheduler"
DBUS_METHOD="SetForegroundProcess"
dbus-monitor "destination=$DBUS_SERVICE,path=$DBUS_PATH,interface=$DBUS_INTERFACE,member=$DBUS_METHOD" |
while true; do
read method call time sender _ dest serial path interface member
read type pid
[ "$member" = "member=$DBUS_METHOD" ] && qdbus --system $DBUS_SERVICE $DBUS_PATH $DBUS_INTERFACE.$DBUS_METHOD $pid
done
while true; do
read method call time sender _ dest serial path interface member
read type pid
[ "$member" = "member=$DBUS_METHOD" ] && qdbus --system $DBUS_SERVICE $DBUS_PATH $DBUS_INTERFACE.$DBUS_METHOD $pid
done < <(dbus-monitor "destination=$DBUS_SERVICE,path=$DBUS_PATH,interface=$DBUS_INTERFACE,member=$DBUS_METHOD")