From 78a66fcfc93e7b2b60cc36232237c49d2507ad4d Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 25 Sep 2019 14:31:52 +0100 Subject: [PATCH] Migrate kwin animation speed to kdeglobals Test Plan: Tested output piping test lines into the script with different settings Removed from my kdeglobals Invoked script. New value appeared (note that if you manually test multiple times locally you have to cleanup the $version info from both kdeglobals and kwinrc or the migration will be skipped) Reviewers: zzag Reviewed By: zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D24084 --- kconf_update/CMakeLists.txt | 2 ++ kconf_update/kwin-5.18-move-animspeed.py | 14 ++++++++++++++ kconf_update/kwin.upd | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 kconf_update/kwin-5.18-move-animspeed.py diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index f30a6f6073..8d1756ec25 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -2,3 +2,5 @@ install(FILES kwin.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(PROGRAMS kwin-5.16-auto-bordersize.sh DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) +install(PROGRAMS kwin-5.18-move-animspeed.py + DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) diff --git a/kconf_update/kwin-5.18-move-animspeed.py b/kconf_update/kwin-5.18-move-animspeed.py new file mode 100644 index 0000000000..7f8df99678 --- /dev/null +++ b/kconf_update/kwin-5.18-move-animspeed.py @@ -0,0 +1,14 @@ +#!/bin/env python + +import fileinput + +speed_map = [0, 0.25, 0.5, 1, 2, 4, 20] + +for line in fileinput.input(): + if not line.startswith("AnimationSpeed="): + continue + speed = int(line[len("AnimationSpeed="):]) + if speed < 0 or speed >= len(speed_map): + continue + print("AnimationDurationFactor=%f" % speed_map[speed]) + print("# DELETE AnimationSpeed") #special kconf syntax to remove the old key diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index 6220918966..7072156c43 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -31,3 +31,9 @@ Id=auto-bordersize File=kwinrc Group=org.kde.kdecoration2 Script=kwin-5.16-auto-bordersize.sh,sh + +# Move AnimationSpeed to kdeglobals as AnimationDurationFactor converting to a useful value +Id=animation-speed +File=kwinrc,kdeglobals +Group=Compositing,KDE +Script=kwin-5.18-move-animspeed.py,python