-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wayland support #10
Comments
I am using it in a Wayland session with no problem (at least none related to Wayland). xdotool works well for me (only used for ctrl+v). EmojiRunner/src/runner/emojirunner.cpp Line 139 in 5aaa24c
If needed, it could be changed to something like |
That seems like good idea, I will play around with it! |
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 492f0cf..d662a69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ include(ECMDeprecationSettings)
# Find the required Libaries
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Core)
-find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS I18n Runner ConfigWidgets KCMUtils)
+find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS I18n Runner KCMUtils WindowSystem)
ecm_set_disabled_deprecation_versions(
KF ${KF_MIN_VERSION}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1950175..9c7ead7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,13 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_runner_org.kde.emojirunner\")
set(CMAKE_AUTOUIC ON)
kcoreaddons_add_plugin(emojirunner SOURCES runner/emojirunner.cpp core/Emoji.cpp core/FileReader.cpp INSTALL_NAMESPACE "kf${QT_MAJOR_VERSION}/krunner")
-target_link_libraries(emojirunner KF${QT_MAJOR_VERSION}::Runner KF${QT_MAJOR_VERSION}::I18n KF${QT_MAJOR_VERSION}::ConfigCore Qt::Widgets) # Widgets for QAction, this will change to Qt::Gui in Qt6
+target_link_libraries(emojirunner
+ KF${QT_MAJOR_VERSION}::Runner
+ KF${QT_MAJOR_VERSION}::WindowSystem
+ KF${QT_MAJOR_VERSION}::I18n
+ KF${QT_MAJOR_VERSION}::ConfigCore
+ Qt::Widgets # Widgets for QAction, this will change to Qt::Gui in Qt6
+)
find_path(XDO_HEADER xdo.h)
find_library(XDO_LIB "xdo")
@@ -28,7 +34,6 @@ target_link_libraries(kcm_krunner_emojirunner
KF${QT_MAJOR_VERSION}::CoreAddons
KF${QT_MAJOR_VERSION}::KCMUtils
KF${QT_MAJOR_VERSION}::ConfigCore
- KF${QT_MAJOR_VERSION}::ConfigWidgets
)
install(TARGETS kcm_krunner_emojirunner DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/)
install(FILES core/emojis.json DESTINATION ${KDE_INSTALL_DATADIR}/emojirunner/)
diff --git a/src/runner/emojirunner.cpp b/src/runner/emojirunner.cpp
index f5f8259..4e2caaa 100644
--- a/src/runner/emojirunner.cpp
+++ b/src/runner/emojirunner.cpp
@@ -6,6 +6,7 @@
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
+#include <KWindowSystem>
#include <krunner_version.h>
#include <QApplication>
@@ -157,6 +158,13 @@ KRunner::QueryMatch EmojiRunner::createQueryMatch(const Emoji &emoji, const qrea
void EmojiRunner::emitCTRLV()
{
+ const static QString wlPaste = QStandardPaths::findExecutable("wl-paste");
+ if (KWindowSystem::isPlatformWayland() && !wlPaste.isEmpty()) {
+ QTimer::singleShot(50, []() {
+ QProcess::startDetached(wlPaste);
+ });
+ return;
+ }
#ifdef XDO_LIB
// Emit Ctrl+V to paste clipboard content
xdo_send_keysequence_window(xdo, CURRENTWINDOW, "ctrl+v", 0); Hmm, but wl-paste sends it not to the focussed window :( |
Giving a closer look at wl-clipboard, it seems that pasting to another window is not a use case, despite what I though, sorry about that. Rofimoji uses wtype. Unfortunatly, wtype requires https://wayland.app/protocols/virtual-keyboard-unstable-v1 which is not yet available in KDE (KWin 6.0.4 currently). Using ydotool:
QProcess::startDetached("sh", QStringList{"-c", "sleep 0.2; ydotool key 135:1 135:0"});
Side note: So, lots of possibilities... with a downside to each. wtype may be the way to go if supported. |
I think that is due to the xwayland stuff ;)
Yeah ... not really sure what to do |
I am using Wayland as well, and the AUR package I build uses xdotool (library) and it works fine. Maybe xdotool gained Wayland support? |
Hi!
Does it work on Wayland, or any plans to add support? I noticed it uses xdotool, which doesn't support Wayland.
The text was updated successfully, but these errors were encountered: