33#include < qobject.h>
44
55#include " ../../../core/doc.hpp"
6+ #include " ../../../core/qmlscreen.hpp"
67#include " connection.hpp"
78
89namespace qs ::i3::ipc {
910
11+ // /! I3/Sway IPC integration
1012class I3IpcQml : public QObject {
1113 Q_OBJECT;
1214 // clang-format off
1315 // / Path to the I3 socket
1416 Q_PROPERTY (QString socketPath READ socketPath CONSTANT);
1517
1618 Q_PROPERTY (qs::i3::ipc::I3Workspace* focusedWorkspace READ focusedWorkspace NOTIFY focusedWorkspaceChanged);
19+ Q_PROPERTY (qs::i3::ipc::I3Monitor* focusedMonitor READ focusedMonitor NOTIFY focusedMonitorChanged);
1720 // / All I3 monitors.
1821 QSDOC_TYPE_OVERRIDE (ObjectModel<qs::i3::ipc::I3Monitor>*);
1922 Q_PROPERTY (UntypedObjectModel* monitors READ monitors CONSTANT);
@@ -27,7 +30,7 @@ class I3IpcQml: public QObject {
2730public:
2831 explicit I3IpcQml ();
2932
30- // / Execute a I3 command [man 5 I3]
33+ // / Execute an I3/Sway command [man 5 sway](https://man.archlinux.org/man/sway.5.en#COMMANDS)
3134 Q_INVOKABLE static void dispatch (const QString& request);
3235
3336 // / Refresh monitor information.
@@ -36,14 +39,35 @@ class I3IpcQml: public QObject {
3639 // / Refresh workspace information.
3740 Q_INVOKABLE static void refreshWorkspaces ();
3841
42+ // / Find an I3Workspace using its name, returns null if the workspace doesn't exist.
43+ Q_INVOKABLE static I3Workspace* findWorkspaceByName (const QString& name);
44+
45+ // / Find an I3Monitor using its name, returns null if the monitor doesn't exist.
46+ Q_INVOKABLE static I3Monitor* findMonitorByName (const QString& name);
47+
48+ // / Return the i3/Sway monitor associated with `screen`
49+ Q_INVOKABLE static I3Monitor* monitorFor (QuickshellScreenInfo* screen);
50+
51+ // / The path to the I3 or Sway socket currently being used
3952 [[nodiscard]] static QString socketPath ();
53+
54+ // / All I3Monitors
4055 [[nodiscard]] static ObjectModel<I3Monitor>* monitors ();
56+
57+ // / All I3Workspaces
4158 [[nodiscard]] static ObjectModel<I3Workspace>* workspaces ();
59+
60+ // / The currently focused Workspace
4261 [[nodiscard]] static I3Workspace* focusedWorkspace ();
62+
63+ // / The currently focused Monitor
64+ [[nodiscard]] static I3Monitor* focusedMonitor ();
65+
4366signals:
4467 void rawEvent (I3IpcEvent* event);
4568 void connected ();
4669 void focusedWorkspaceChanged ();
70+ void focusedMonitorChanged ();
4771};
4872
4973} // namespace qs::i3::ipc
0 commit comments