[kwinrules] Add kconf_update script to fix placement rule

Since the port to KConfigXT, the placement setting in `kwinrulesrc` now stores the enum value instead of a string equivalent.
The strings and enum values are taken from `placement.h/.cpp`

This was suggested by @zzag in https://phabricator.kde.org/D29790
master
Ismael Asensio 2020-05-22 22:05:55 +02:00
parent 00b285623a
commit 61c6d58172
3 changed files with 34 additions and 0 deletions

View File

@ -4,3 +4,8 @@ install(PROGRAMS kwin-5.16-auto-bordersize.sh
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(PROGRAMS kwin-5.18-move-animspeed.py
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(FILES kwinrules.upd
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(PROGRAMS kwinrules-5.19-placement.pl
DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})

View File

@ -0,0 +1,22 @@
#! /usr/bin/perl
# Convert strings as in `Placement::policyToString()` from `placement.cpp`
# to correponding values of enum `Placement::Policy` defined in `placement.h`
use strict;
while (<>)
{
chomp;
s/placement=NoPlacement/placement=0/;
s/placement=Default/placement=1/;
s/placement=Random/placement=3/;
s/placement=Smart/placement=4/;
s/placement=Cascade/placement=5/;
s/placement=Centered/placement=6/;
s/placement=ZeroCornered/placement=7/;
s/placement=UnderMouse/placement=8/;
s/placement=OnMainWindow/placement=9/;
s/placement=Maximizing/placement=10/;
print "$_\n";
}

View File

@ -0,0 +1,7 @@
Version=5
# Replace `placement` string policy to its enum value equivalent
Id=replace-placement-string-to-enum
File=kwinrulesrc
Script=kwinrules-5.19-placement.pl,perl