Commit 16f74986 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Expose effect ID to scripting via `effect.pluginId`

This can be used to avoid code duplication by installing an effect multiple
times and tweaking behavior slightly based on the returned ID.

Internally it is called `scriptName` but for consistency with other similar
APIs the name `pluginId` is chosen, and returns e.g. `kwin4_effect_maximize`
parent 6f176660
......@@ -694,6 +694,11 @@ void ScriptedEffect::animationEnded(KWin::EffectWindow *w, Attribute a, uint met
emit animationEnded(w, 0);
}
QString ScriptedEffect::pluginId() const
{
return m_effectName;
}
bool ScriptedEffect::isActiveFullScreenEffect() const
{
return effects->activeFullScreenEffect() == this;
......
......@@ -28,6 +28,10 @@ class KWIN_EXPORT ScriptedEffect : public KWin::AnimationEffect
Q_ENUMS(MetaType)
Q_ENUMS(EasingCurve)
Q_ENUMS(SessionState)
/**
* The plugin ID of the effect
*/
Q_PROPERTY(QString pluginId READ pluginId CONSTANT)
/**
* True if we are the active fullscreen effect
*/
......@@ -108,6 +112,8 @@ public:
return m_screenEdgeCallbacks;
}
QString pluginId() const;
bool isActiveFullScreenEffect() const;
bool registerTouchScreenCallback(int edge, QScriptValue callback);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment