🔧 Generate JS code for kwin
This commit is contained in:
+13
-6
@@ -26,19 +26,26 @@ mkdir -p "${BUILD_DIR}"
|
|||||||
|
|
||||||
# $1: The nick of the effect (e.g. "tv")
|
# $1: The nick of the effect (e.g. "tv")
|
||||||
# $2: The name of the effect (e.g. "TV Effect")
|
# $2: The name of the effect (e.g. "TV Effect")
|
||||||
# $3: A short description of the effect
|
# $3: A short description of the effect (e.g. "Make windows close like turning off a TV")
|
||||||
generate() {
|
generate() {
|
||||||
cp -r "kwin4_effect_$1" "${BUILD_DIR}"
|
|
||||||
|
|
||||||
# Create resource directories.
|
# Create resource directories.
|
||||||
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/shaders"
|
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/shaders"
|
||||||
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/code"
|
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/code"
|
||||||
|
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/config"
|
||||||
|
mkdir -p "${BUILD_DIR}/kwin4_effect_$1/contents/ui"
|
||||||
|
|
||||||
sed -e "s;%NICK%;$1;g" -e "s;%NAME%;$2;g" -e "s;%DESCRIPTION%;$3;g" \
|
cp "kwin4_effect_$1/main.xml" "${BUILD_DIR}/kwin4_effect_$1/contents/config"
|
||||||
metadata.desktop.in > "${BUILD_DIR}/kwin4_effect_$1/metadata.desktop"
|
cp "kwin4_effect_$1/config.ui" "${BUILD_DIR}/kwin4_effect_$1/contents/ui"
|
||||||
|
|
||||||
sed -e "s;%NICK%;$1;g" -e "s;%NAME%;$2;g" -e "s;%DESCRIPTION%;$3;g" \
|
perl -pe "s/%LOAD_CONFIG%/`cat kwin4_effect_$1/loadConfig.js | tr '/' '\f' `/g;" \
|
||||||
main.js.in > "${BUILD_DIR}/kwin4_effect_$1/contents/code/main.js"
|
main.js.in | tr '\f' '/' > "${BUILD_DIR}/kwin4_effect_$1/contents/code/main.js"
|
||||||
|
|
||||||
|
perl -pi -e "s/%NICK%/$1/g;" "${BUILD_DIR}/kwin4_effect_$1/contents/code/main.js"
|
||||||
|
|
||||||
|
perl -pe "s/%NICK%/$1/g;" metadata.desktop.in > "${BUILD_DIR}/kwin4_effect_$1/metadata.desktop"
|
||||||
|
perl -pi -e "s/%NAME%/$2/g;" "${BUILD_DIR}/kwin4_effect_$1/metadata.desktop"
|
||||||
|
perl -pi -e "s/%DESCRIPTION%/$3/g;" "${BUILD_DIR}/kwin4_effect_$1/metadata.desktop"
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "#version 140"
|
echo "#version 140"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
loadConfig() {
|
||||||
|
const defaultDuration = 400;
|
||||||
|
const duration = effect.readConfig('Duration', defaultDuration) || defaultDuration;
|
||||||
|
this.duration = animationTime(duration);
|
||||||
|
|
||||||
|
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<default>0</default>
|
<default>0</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="Color" type="Color">
|
<entry name="Color" type="Color">
|
||||||
<default>128,128,128</default>
|
<default>255,255,255</default>
|
||||||
</entry>
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
</kcfg>
|
</kcfg>
|
||||||
+1
-7
@@ -30,13 +30,7 @@ class BMW%NICK%Effect {
|
|||||||
this.loadConfig();
|
this.loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadConfig() {
|
%LOAD_CONFIG%
|
||||||
const defaultDuration = 1000;
|
|
||||||
const duration = effect.readConfig("Duration", defaultDuration) || defaultDuration;
|
|
||||||
this.duration = animationTime(duration);
|
|
||||||
|
|
||||||
effect.setUniform(this.shader, "uColor", effect.readConfig("Color", "white"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static isScaleWindow(window) {
|
static isScaleWindow(window) {
|
||||||
// We don't want to animate most of plasmashell's windows, yet, some
|
// We don't want to animate most of plasmashell's windows, yet, some
|
||||||
|
|||||||
Reference in New Issue
Block a user