3
3
#include < qobject.h>
4
4
5
5
#include " ../../../core/doc.hpp"
6
+ #include " ../../../core/qmlscreen.hpp"
6
7
#include " connection.hpp"
7
8
8
9
namespace qs ::i3::ipc {
9
10
11
+ // /! I3/Sway IPC integration
10
12
class I3IpcQml : public QObject {
11
13
Q_OBJECT;
12
14
// clang-format off
13
15
// / Path to the I3 socket
14
16
Q_PROPERTY (QString socketPath READ socketPath CONSTANT);
15
17
16
18
Q_PROPERTY (qs::i3::ipc::I3Workspace* focusedWorkspace READ focusedWorkspace NOTIFY focusedWorkspaceChanged);
19
+ Q_PROPERTY (qs::i3::ipc::I3Monitor* focusedMonitor READ focusedMonitor NOTIFY focusedMonitorChanged);
17
20
// / All I3 monitors.
18
21
QSDOC_TYPE_OVERRIDE (ObjectModel<qs::i3::ipc::I3Monitor>*);
19
22
Q_PROPERTY (UntypedObjectModel* monitors READ monitors CONSTANT);
@@ -27,7 +30,7 @@ class I3IpcQml: public QObject {
27
30
public:
28
31
explicit I3IpcQml ();
29
32
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)
31
34
Q_INVOKABLE static void dispatch (const QString& request);
32
35
33
36
// / Refresh monitor information.
@@ -36,14 +39,35 @@ class I3IpcQml: public QObject {
36
39
// / Refresh workspace information.
37
40
Q_INVOKABLE static void refreshWorkspaces ();
38
41
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
39
52
[[nodiscard]] static QString socketPath ();
53
+
54
+ // / All I3Monitors
40
55
[[nodiscard]] static ObjectModel<I3Monitor>* monitors ();
56
+
57
+ // / All I3Workspaces
41
58
[[nodiscard]] static ObjectModel<I3Workspace>* workspaces ();
59
+
60
+ // / The currently focused Workspace
42
61
[[nodiscard]] static I3Workspace* focusedWorkspace ();
62
+
63
+ // / The currently focused Monitor
64
+ [[nodiscard]] static I3Monitor* focusedMonitor ();
65
+
43
66
signals:
44
67
void rawEvent (I3IpcEvent* event);
45
68
void connected ();
46
69
void focusedWorkspaceChanged ();
70
+ void focusedMonitorChanged ();
47
71
};
48
72
49
73
} // namespace qs::i3::ipc
0 commit comments