Skip to content

Commit e899eb4

Browse files
committed
i3/sway: fix linting errors
1 parent 584655d commit e899eb4

File tree

6 files changed

+46
-13
lines changed

6 files changed

+46
-13
lines changed

src/x11/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ qt_add_qml_module(quickshell-x11
1111
DEPENDENCIES QtQuick
1212
)
1313

14+
if(I3)
15+
add_subdirectory(i3)
16+
endif()
17+
1418
install_qml_module(quickshell-x11)
1519

1620
add_library(quickshell-x11-init OBJECT init.cpp)

src/x11/i3/ipc/connection.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
#include <algorithm>
2+
#include <cstring>
3+
#include <tuple>
24

5+
#include <qbytearray.h>
36
#include <qbytearrayview.h>
7+
#include <qcontainerfwd.h>
8+
#include <qdatastream.h>
49
#include <qjsonarray.h>
510
#include <qjsondocument.h>
611
#include <qjsonobject.h>
712
#include <qjsonvalue.h>
13+
#include <qlocalsocket.h>
14+
#include <qlogging.h>
815
#include <qloggingcategory.h>
16+
#include <qobject.h>
917
#include <qsysinfo.h>
18+
#include <qtenvironmentvariables.h>
19+
#include <qtmetamacros.h>
20+
#include <qtypes.h>
1021

22+
#include "../../../core/model.hpp"
1123
#include "connection.hpp"
1224
#include "monitor.hpp"
1325
#include "workspace.hpp"
@@ -43,7 +55,7 @@ void I3Ipc::dispatch(const QString& payload) {
4355

4456
for (auto message: data.array()) {
4557
auto jsonMessage = message.toObject();
46-
bool success = jsonMessage["success"].toBool();
58+
const bool success = jsonMessage["success"].toBool();
4759

4860
if (!success) {
4961
qWarning() << "Error while executing dispatch of" << payload << ":\n\t"
@@ -126,16 +138,16 @@ void I3Ipc::eventSocketReady() {
126138

127139
QVector<Event> I3Ipc::parseResponse(QByteArray rawEvent) {
128140
QVector<std::tuple<EventCode, QJsonDocument>> events;
129-
int magicLen = 6;
130-
int header = 8 + magicLen;
141+
const int magicLen = 6;
142+
const int header = 8 + magicLen;
131143

132144
while (rawEvent.startsWith(MAGIC)) {
133145
QDataStream ds(QByteArray(rawEvent.data() + magicLen, 8)); // NOLINT
134146

135147
ds.setByteOrder(static_cast<QDataStream::ByteOrder>(QSysInfo::ByteOrder));
136148

137-
uint32_t size = 0;
138-
uint32_t type = 0;
149+
quint32 size = 0;
150+
quint32 type = 0;
139151

140152
ds >> size;
141153
ds >> type;
@@ -238,7 +250,7 @@ I3Ipc* I3Ipc::instance() {
238250

239251
void I3Ipc::refreshWorkspaces() {
240252
auto msg = I3Ipc::buildRequestMessage(EventCode::GET_WORKSPACES);
241-
auto res = I3Ipc::makeRequest(msg);
253+
auto res = this->makeRequest(msg);
242254

243255
if (res.isEmpty()) {
244256
qWarning(logi3Ipc) << "Failed updating workspaces";
@@ -299,7 +311,7 @@ void I3Ipc::refreshWorkspaces() {
299311

300312
void I3Ipc::refreshMonitors() {
301313
auto msg = I3Ipc::buildRequestMessage(EventCode::GET_OUTPUTS);
302-
auto res = I3Ipc::makeRequest(msg);
314+
auto res = this->makeRequest(msg);
303315

304316
if (res.isEmpty()) {
305317
qWarning(logi3Ipc) << "Failed to update monitors";
@@ -399,8 +411,8 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
399411

400412
qCInfo(logi3IpcEvents) << "Focus changed: " << oldName << "->" << newName;
401413

402-
auto* oldWorkspace = I3Ipc::findWorkspaceByName(oldName);
403-
auto* newWorkspace = I3Ipc::findWorkspaceByName(newName);
414+
auto* oldWorkspace = this->findWorkspaceByName(oldName);
415+
auto* newWorkspace = this->findWorkspaceByName(newName);
404416

405417
if (oldWorkspace != nullptr) {
406418
oldWorkspace->setFocus(false);
@@ -414,7 +426,7 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
414426
} else if (change == "empty") {
415427
auto name = event->mData["current"]["name"].toString();
416428

417-
auto* oldWorkspace = I3Ipc::findWorkspaceByName(name);
429+
auto* oldWorkspace = this->findWorkspaceByName(name);
418430

419431
if (oldWorkspace != nullptr) {
420432
qCInfo(logi3Ipc) << "Deleting" << oldWorkspace->id() << name;

src/x11/i3/ipc/monitor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#include "monitor.hpp"
22

3+
#include <qcontainerfwd.h>
4+
#include <qstring.h>
5+
#include <qtmetamacros.h>
6+
#include <qtypes.h>
7+
8+
#include "workspace.hpp"
9+
310
namespace qs::i3::ipc {
411

512
qint32 I3Monitor::id() const { return this->mId; };

src/x11/i3/ipc/qml.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
21
#include "qml.hpp"
32

3+
#include <qobject.h>
4+
#include <qstring.h>
5+
6+
#include "../../../core/model.hpp"
47
#include "connection.hpp"
58
#include "workspace.hpp"
69

src/x11/i3/ipc/workspace.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#include "workspace.hpp"
22

3+
#include <qcontainerfwd.h>
4+
#include <qstring.h>
5+
#include <qtmetamacros.h>
6+
#include <qtypes.h>
7+
8+
#include "monitor.hpp"
9+
310
namespace qs::i3::ipc {
411

512
qint32 I3Workspace ::id() const { return this->mId; }
@@ -61,6 +68,6 @@ void I3Workspace::updateFromObject(const QVariantMap& obj) {
6168
}
6269
}
6370

64-
void I3Workspace::setFocus(bool data) { this->mFocused = data; }
71+
void I3Workspace::setFocus(bool focus) { this->mFocused = focus; }
6572

6673
} // namespace qs::i3::ipc

src/x11/i3/ipc/workspace.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class I3Workspace: public QObject {
3030
[[nodiscard]] QVariantMap lastIpcObject() const;
3131

3232
void updateFromObject(const QVariantMap& obj);
33-
void setFocus(bool);
33+
void setFocus(bool focus);
3434

3535
signals:
3636
void idChanged();

0 commit comments

Comments
 (0)