Floating polish: visibility, resize, saved geometry, D-Bus, desktop entry
- VisibilityController: show on field focus, dismiss until next focus, manual show/hide/toggle overrides - FloatingWindow: resize from the corner grip, clamp to screen - WindowSettings: geometry per screen, debounced saves - DBusControl: org.sloposk.Keyboard Show/Hide/Toggle for global shortcuts - org.sloposk.keyboard.desktop so System Settings lists it as a virtual keyboard - README with build/run/layout docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#include "DevHooks.h"
|
||||
|
||||
#include "backend/TextBackend.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QQuickWindow>
|
||||
#include <QTimer>
|
||||
|
||||
namespace {
|
||||
|
||||
void installAutotype(TextBackend &backend, const QString &text)
|
||||
{
|
||||
QObject::connect(&backend, &TextBackend::activeChanged, &backend, [&backend, text] {
|
||||
if (backend.isActive())
|
||||
backend.commitText(text);
|
||||
});
|
||||
}
|
||||
|
||||
void installScreenshot(QQuickWindow &window, const QString &path)
|
||||
{
|
||||
constexpr int SettleMs = 500;
|
||||
QTimer::singleShot(SettleMs, &window, [&window, path] {
|
||||
const bool saved = window.grabWindow().save(path);
|
||||
if (!saved)
|
||||
qWarning("Failed to save screenshot to %s", qPrintable(path));
|
||||
QCoreApplication::exit(saved ? 0 : 1);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void installDevHooks(TextBackend &backend, QQuickWindow &window)
|
||||
{
|
||||
if (const QString text = qEnvironmentVariable("SLOPOSK_AUTOTYPE"); !text.isEmpty())
|
||||
installAutotype(backend, text);
|
||||
if (const QString path = qEnvironmentVariable("SLOPOSK_SCREENSHOT"); !path.isEmpty())
|
||||
installScreenshot(window, path);
|
||||
}
|
||||
Reference in New Issue
Block a user