Workcat: cute desktop cat, no window closing
Reworks the example into a pure desktop-pet: the cat wanders, sits, grooms, stretches, dashes and naps, reacts to petting and dragging, and follows the cursor with its eyes. The window-scanning and Accessibility code is gone. The cat is drawn from rounded primitives plus Shape paths in a fixed 100x90 design space, so it scales cleanly to any size. Linux/X11 is the primary target: the tray is optional, Wayland gets a warning, and WORKCAT_X11_BYPASS / WORKCAT_OPAQUE cover uncooperative window managers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
acef398f49
17 files changed
+1584
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QString>
|
||||
|
||||
// Small facts about the host that QML needs in order to pick window flags.
|
||||
class PlatformInfo : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_NAMED_ELEMENT(Platform)
|
||||
QML_SINGLETON
|
||||
|
||||
Q_PROPERTY(QString name READ name CONSTANT)
|
||||
Q_PROPERTY(bool isX11 READ isX11 CONSTANT)
|
||||
Q_PROPERTY(bool isWayland READ isWayland CONSTANT)
|
||||
Q_PROPERTY(bool bypassWindowManager READ bypassWindowManager CONSTANT)
|
||||
Q_PROPERTY(bool opaqueBackground READ opaqueBackground CONSTANT)
|
||||
|
||||
public:
|
||||
explicit PlatformInfo(QObject *parent = nullptr);
|
||||
|
||||
QString name() const { return m_name; }
|
||||
bool isX11() const { return m_name == QLatin1String("xcb"); }
|
||||
bool isWayland() const { return m_name.startsWith(QLatin1String("wayland")); }
|
||||
|
||||
// WORKCAT_X11_BYPASS=1 turns the cat into an override-redirect window.
|
||||
// Useful on window managers that refuse to keep a Qt::Tool window on top.
|
||||
bool bypassWindowManager() const { return m_bypass; }
|
||||
|
||||
// WORKCAT_OPAQUE=1 paints a solid background instead of relying on a
|
||||
// compositor. Without compositing X11 renders transparency as black.
|
||||
bool opaqueBackground() const { return m_opaque; }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
bool m_bypass = false;
|
||||
bool m_opaque = false;
|
||||
};
|
||||
Reference in new issue
Block a user