Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ set(libinputactions_SRCS
libinputactions/interfaces/PointerPositionSetter.h
libinputactions/interfaces/ProcessRunner.cpp
libinputactions/interfaces/SessionLock.h
libinputactions/interfaces/TextInput.h
libinputactions/interfaces/Window.h
libinputactions/interfaces/WindowProvider.cpp
libinputactions/triggers/core/DirectionalMotionTriggerCore.cpp
Expand Down
3 changes: 3 additions & 0 deletions src/libinputactions/InputActionsMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "interfaces/PointerPositionSetter.h"
#include "interfaces/ProcessRunner.h"
#include "interfaces/SessionLock.h"
#include "interfaces/TextInput.h"
#include "interfaces/Window.h"
#include "interfaces/WindowProvider.h"
#include "interfaces/implementations/DBusNotificationManager.h"
Expand Down Expand Up @@ -40,6 +41,7 @@ InputActionsMain::~InputActionsMain()
g_pointerPositionGetter.reset();
g_pointerPositionSetter.reset();
g_processRunner.reset();
g_textInput.reset();
g_sessionLock.reset();
g_windowProvider.reset();

Expand Down Expand Up @@ -85,6 +87,7 @@ void InputActionsMain::setMissingImplementations()
setMissingImplementation(g_pointerPositionSetter);
setMissingImplementation<PlasmaGlobalShortcutInvoker, DBusPlasmaGlobalShortcutInvoker>(g_plasmaGlobalShortcutInvoker);
setMissingImplementation<ProcessRunner, ProcessRunnerImpl>(g_processRunner);
setMissingImplementation(g_textInput);
setMissingImplementation(g_sessionLock);
setMissingImplementation(g_windowProvider);

Expand Down
3 changes: 2 additions & 1 deletion src/libinputactions/actions/InputAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <libinputactions/input/devices/VirtualKeyboard.h>
#include <libinputactions/input/devices/VirtualMouse.h>
#include <libinputactions/interfaces/PointerPositionSetter.h>
#include <libinputactions/interfaces/TextInput.h>

namespace InputActions
{
Expand Down Expand Up @@ -50,7 +51,7 @@ void InputAction::executeImpl(const ActionExecutionArguments &args)
} else if (item.keyboardRelease.isValid()) {
g_inputBackend->virtualKeyboard()->keyboardKey(item.keyboardRelease, false);
} else if (keyboardText) {
g_inputBackend->virtualKeyboard()->keyboardText(keyboardText.value());
g_textInput->writeText(keyboardText.value());
} else if (item.mousePress.isValid()) {
g_inputBackend->virtualMouse()->mouseButton(item.mousePress, true);
} else if (item.mouseRelease.isValid()) {
Expand Down
1 change: 0 additions & 1 deletion src/libinputactions/input/devices/VirtualKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class VirtualKeyboard
* Must be called by the overriding method in order to track pressed keys.
*/
virtual void keyboardKey(KeyboardKey key, bool state);
virtual void keyboardText(const QString &text) {}

protected:
/**
Expand Down
37 changes: 37 additions & 0 deletions src/libinputactions/interfaces/TextInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
Input Actions - Input handler that executes user-defined actions
Copyright (C) 2024-2026 Marcin Woźniak

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <QString>

namespace InputActions
{

class TextInput
{
public:
TextInput() = default;
virtual ~TextInput() = default;

virtual void writeText(const QString &text) {}
};

inline std::shared_ptr<TextInput> g_textInput;

}