From 2e7c1c51db18e83e627efbc0087daba586f768a9 Mon Sep 17 00:00:00 2001 From: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:59:26 +0600 Subject: [PATCH] Fix kwin-system76-scheduler-integration for KWin 6 (#1090) * Update kwin-system76-scheduler-integration.spec Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> * Delete anda/misc/kwin-system76-scheduler-integration/system76-scheduler-dbus-proxy.sh Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> * Update kwin-system76-scheduler-integration.spec Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> * Update update.rhai Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> * Update kwin-system76-scheduler-integration.spec Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> --------- Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> (cherry picked from commit 0bf2e96d9cf05a25b3fcbaed92af13ef1bc062f7) --- .../kwin-system76-scheduler-integration.spec | 47 +++++++++++-------- .../system76-scheduler-dbus-proxy.sh | 14 ------ .../update.rhai | 6 ++- 3 files changed, 33 insertions(+), 34 deletions(-) delete mode 100644 anda/misc/kwin-system76-scheduler-integration/system76-scheduler-dbus-proxy.sh diff --git a/anda/misc/kwin-system76-scheduler-integration/kwin-system76-scheduler-integration.spec b/anda/misc/kwin-system76-scheduler-integration/kwin-system76-scheduler-integration.spec index c88f435a20..5e6aef9949 100644 --- a/anda/misc/kwin-system76-scheduler-integration/kwin-system76-scheduler-integration.spec +++ b/anda/misc/kwin-system76-scheduler-integration/kwin-system76-scheduler-integration.spec @@ -1,15 +1,20 @@ %global debug_package %nil -Name: kwin-system76-scheduler-integration -Version: 0.1 -Release: 4%?dist -Summary: Notify the System76 Scheduler which app has focus so it can be prioritized -License: MIT -URL: https://github.com/maxiberta/kwin-system76-scheduler-integration -Source0: %url/archive/refs/tags/%version.tar.gz -Source1: system76-scheduler-dbus-proxy.sh -Source2: com.system76.Scheduler.dbusproxy.service -Requires: bash dbus-tools system76-scheduler kde-cli-tools systemd kf5-kconfig-core qt +Name: kwin-system76-scheduler-integration + +%global forgeurl https://github.com/maxiberta/%{name} +%global commit 093a269670275feaa240d02c712f1ec8b812fd80 +%global date 20240320 +%forgemeta + +Version: 0.1 +Release: 5%?dist +Summary: Notify the System76 Scheduler which app has focus so it can be prioritized +License: MIT +URL: %forgeurl +Source0: %forgesource +Source1: com.system76.Scheduler.dbusproxy.service +Requires: bash dbus-tools system76-scheduler kde-cli-tools systemd kf6-kconfig-core BuildRequires: systemd-rpm-macros %description @@ -20,21 +25,24 @@ This KWin Script interactively notifies System76 Scheduler which app has focus via D-Bus, so it is prioritized. %prep -%autosetup +%forgeautosetup %build %install -mkdir -p %buildroot%_datadir/kwin/scripts/kwin-system76-scheduler-integration/ -cp -r * %buildroot%_datadir/kwin/scripts/kwin-system76-scheduler-integration/ -install -Dm755 %SOURCE1 %buildroot%_libexecdir/system76-scheduler-dbus-proxy.sh -install -Dm644 %SOURCE2 %buildroot%_userunitdir/com.system76.Scheduler.dbusproxy.service -install -Dm644 metadata.desktop %buildroot%_datadir/kservices5/kwin-system76-scheduler-integration.desktop +mkdir -p %buildroot%_datadir/kwin/scripts/%{name}/ +mkdir -p %buildroot%_libexecdir/ +mkdir -p %buildroot%_userunitdir/ + +cp -r contents %buildroot%_datadir/kwin/scripts/%{name}/ +cp -r metadata.json %buildroot%_datadir/kwin/scripts/%{name}/ +cp -r system76-scheduler-dbus-proxy.sh %buildroot%_libexecdir/ + +install -Dm644 %SOURCE1 %buildroot%_userunitdir/com.system76.Scheduler.dbusproxy.service %post %systemd_user_post com.system76.Scheduler.dbusproxy.service - %preun %systemd_user_preun com.system76.Scheduler.dbusproxy.service @@ -42,10 +50,11 @@ install -Dm644 metadata.desktop %buildroot%_datadir/kservices5/kwin-system76-sch %systemd_user_postun_with_restart com.system76.Scheduler.dbusproxy.service %files +%license LICENSE +%doc README.md %config %_userunitdir/com.system76.Scheduler.dbusproxy.service %_libexecdir/system76-scheduler-dbus-proxy.sh -%_datadir/kwin/scripts/kwin-system76-scheduler-integration/ -%_datadir/kservices5/kwin-system76-scheduler-integration.desktop +%_datadir/kwin/scripts/%{name}/ %changelog %autochangelog diff --git a/anda/misc/kwin-system76-scheduler-integration/system76-scheduler-dbus-proxy.sh b/anda/misc/kwin-system76-scheduler-integration/system76-scheduler-dbus-proxy.sh deleted file mode 100644 index 850f5612e8..0000000000 --- a/anda/misc/kwin-system76-scheduler-integration/system76-scheduler-dbus-proxy.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -DBUS_SERVICE="com.system76.Scheduler" -DBUS_PATH="/com/system76/Scheduler" -DBUS_INTERFACE="com.system76.Scheduler" -DBUS_METHOD="SetForegroundProcess" - -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") diff --git a/anda/misc/kwin-system76-scheduler-integration/update.rhai b/anda/misc/kwin-system76-scheduler-integration/update.rhai index c9403e0162..8ea5068d9d 100644 --- a/anda/misc/kwin-system76-scheduler-integration/update.rhai +++ b/anda/misc/kwin-system76-scheduler-integration/update.rhai @@ -1 +1,5 @@ -rpm.version(gh("maxiberta/kwin-system76-scheduler-integration")); +rpm.global("commit", gh("maxiberta/kwin-system76-scheduler-integration")); +if rpm.changed() { + rpm.global("date", date()); // remove if we don't need the `date` macro + rpm.release(); +}