🔧 Tweak kwin build process

This commit is contained in:
Simon Schneegans
2022-06-10 13:57:21 +02:00
parent 192719739c
commit d08c318b7d
9 changed files with 77 additions and 60 deletions
+30 -8
View File
@@ -41,15 +41,34 @@ generate() {
mkdir -p "$BUILD_DIR/$DIR_NAME/contents/config"
mkdir -p "$BUILD_DIR/$DIR_NAME/contents/ui"
# Copy the config and ui files.
cp "$DIR_NAME/main.xml" "$BUILD_DIR/$DIR_NAME/contents/config"
cp "$DIR_NAME/config.ui" "$BUILD_DIR/$DIR_NAME/contents/ui"
# Copy the config file if it exists.
if [ -f "$DIR_NAME/main.xml" ]; then
cp "$DIR_NAME/main.xml" "$BUILD_DIR/$DIR_NAME/contents/config"
fi
perl -pe "s/%LOAD_CONFIG%/$(tr '/' '\f' < "$DIR_NAME/loadConfig.js")/g;" \
main.js.in | tr '\f' '/' > "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
# Copy the ui file if it exists.
if [ -f "$DIR_NAME/config.ui" ]; then
cp "$DIR_NAME/config.ui" "$BUILD_DIR/$DIR_NAME/contents/ui"
fi
perl -pi -e "s/%EFFECT_CLASS%/$EFFECT_CLASS/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/%SHADER_NAME%/$1/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
ON_SETTINGS_CHANGE=""
ON_ANIMATION_BEGIN=""
if [ -f "$DIR_NAME/onSettingsChanged.js" ]; then
ON_SETTINGS_CHANGE=$(tr '/' '\f' < "$DIR_NAME/onSettingsChanged.js")
fi
if [ -f "$DIR_NAME/onAnimationBegin.js" ]; then
ON_ANIMATION_BEGIN=$(tr '/' '\f' < "$DIR_NAME/onAnimationBegin.js")
fi
cp main.js.in "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/%ON_SETTINGS_CHANGE%/$ON_SETTINGS_CHANGE/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/%ON_ANIMATION_BEGIN%/$ON_ANIMATION_BEGIN/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/%EFFECT_CLASS%/$EFFECT_CLASS/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/%SHADER_NAME%/$1/g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
perl -pi -e "s/\f/\//g;" "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
cp metadata.desktop.in "$BUILD_DIR/$DIR_NAME/metadata.desktop"
perl -pi -e "s/%ICON%/$1/g;" "$BUILD_DIR/$DIR_NAME/metadata.desktop"
@@ -75,9 +94,12 @@ generate() {
cat "../resources/shaders/common.glsl"
cat "../resources/shaders/$1.frag"
} > "$BUILD_DIR/$DIR_NAME/contents/shaders/$1.frag"
# If clang-format is installed, try to beauty the code a bit.
}
generate "tv" "TV Effect" "Make windows close like turning off a TV"
generate "energize-a" "Energize A" "Beam your windows away"
generate "energize-b" "Energize B" "Using different transporter technology results in an alternative visual effect"
generate "hexagon" "Hexagon" "With glowing lines and hexagon-shaped tiles, this effect looks very sci-fi"
generate "tv" "TV Effect" "Make windows close like turning off a TV"
# generate "fire" "Fire" "Make windows burn"
@@ -1,5 +0,0 @@
loadConfig() {
this.duration = animationTime(effect.readConfig('Duration', 1000));
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
}
@@ -0,0 +1,6 @@
// This part is automatically included in the effect's source during the build process.
// The code below is called whenever the user changes something in the configuration of
// the effect.
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
@@ -1,5 +0,0 @@
loadConfig() {
this.duration = animationTime(effect.readConfig('Duration', 1000));
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
}
@@ -0,0 +1,6 @@
// This part is automatically included in the effect's source during the build process.
// The code below is called whenever the user changes something in the configuration of
// the effect.
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
-4
View File
@@ -1,4 +0,0 @@
loadConfig() {
this.duration = animationTime(effect.readConfig('Duration', 1000));
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
}
@@ -0,0 +1,5 @@
// This part is automatically included in the effect's source during the build process.
// The code below is called whenever the user changes something in the configuration of
// the effect.
effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white'));
+20 -19
View File
@@ -30,7 +30,12 @@ class %EFFECT_CLASS% {
this.loadConfig();
}
%LOAD_CONFIG%
loadConfig() {
this.duration = animationTime(effect.readConfig('Duration', 1000));
effect.setUniform(this.shader, 'uDuration', this.duration * 0.001);
%ON_SETTINGS_CHANGE%
}
static isScaleWindow(window) {
// We don't want to animate most of plasmashell's windows, yet, some
@@ -95,6 +100,11 @@ class %EFFECT_CLASS% {
return;
}
this.setupForcedRoles(window);
effect.setUniform(this.shader, 'uForOpening', 1.0);
%ON_ANIMATION_BEGIN%
window.scaleInAnimation = animate({
window: window,
curve: QEasingCurve.Linear,
@@ -103,16 +113,9 @@ class %EFFECT_CLASS% {
{
type: Effect.ShaderUniform,
fragmentShader: this.shader,
uniform: "forOpening",
from: 1.0,
uniform: "uProgress",
from: 0.0,
to: 1.0
},
{
type: Effect.ShaderUniform,
fragmentShader: this.shader,
uniform: "uDuration",
from: this.duration * 0.001,
to: this.duration * 0.001
}
]
});
@@ -136,6 +139,11 @@ class %EFFECT_CLASS% {
delete window.scaleInAnimation;
}
this.setupForcedRoles(window);
effect.setUniform(this.shader, 'uForOpening', 0.0);
%ON_ANIMATION_BEGIN%
window.scaleOutAnimation = animate({
window: window,
curve: QEasingCurve.Linear,
@@ -144,16 +152,9 @@ class %EFFECT_CLASS% {
{
type: Effect.ShaderUniform,
fragmentShader: this.shader,
uniform: "forOpening",
uniform: "uProgress",
from: 0.0,
to: 0.0
},
{
type: Effect.ShaderUniform,
fragmentShader: this.shader,
uniform: "uDuration",
from: this.duration * 0.001,
to: this.duration * 0.001
to: 1.0
}
]
});