Skip to content

Commit

Permalink
improve system76-scheduler-dbus-proxy (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton authored Oct 29, 2023
1 parent 182ebe1 commit e5f66a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit e5f66a2

Please sign in to comment.