javascript - How to emit signal in KWin scripting API
问题描述
With the KWin scripting API, I know I can connect a signal with
client.signal.connect(myFunction);
to trigger some action when the script receives a signal.
But how can I emit a signal from my KWin script for other components to pick up?
I want something like
client.emit(signal);
but couldn't find anything in the API documentation and unsuccessfully tried various possible syntaxes.
My use case is that I want to emit a clientStartUserMovedResized
signal before doing a geometry change, so that another script can detect that a window is about to be changed with the window with the old geometry passed over, before the clientGeometryChanged
signal is automatically emitted after the change in geometry has already happened and the old geometry is lost.
解决方案
正如reddit上的回答https://old.reddit.com/r/kde/comments/qndb0k/how_to_emit_signal_in_kwin_scripting_api/
很确定您只是将其称为正常功能。
- https://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#signal-handler-attributes
- https://develop.kde.org/docs/plasma/kwin/api/#signals-3
client.clientStartUserMovedResized(client)
(不知道为什么它需要引用自身作为参数)- https://invent.kde.org/plasma/kwin/-/blob/master/src/abstract_client.cpp#L970
推荐阅读
- c++ - 我的向量打印所有元素,但最后一个 c++
- xamarin - Xamarin 表单日期选择器 android
- python - 可以在一行中使用多拆分功能吗?
- php - 无法在 PHP 8.0 中加载 xdebug
- c# - 在 ItemClick() 事件上获取 ListView 项目的详细信息
- json - SpringBoot 中的 Rest 服务需要来自 GET 请求的 JSON 中的嵌套对象
- express - 如果未提供凭据,如何使用 express-basic-auth 以便我的应用程序返回 401?
- docker - Docker容器通信和安全
- reactjs - 我希望某个问题的答案出现在屏幕上以供确认
- javascript - 一次抓取多个结果