-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathdisable-network-and-bluetooth.patch
More file actions
148 lines (123 loc) · 4.31 KB
/
disable-network-and-bluetooth.patch
File metadata and controls
148 lines (123 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
--- a/SysLoad.cxx
+++ b/SysLoad.cxx
@@ -19,7 +19,9 @@
#include <KLocalizedString>
+#ifndef __TERMUX__
#include <NetworkManagerQt/Manager>
+#endif
//--------------------------------------------------------------------------------
@@ -45,20 +47,29 @@
timeoutTimer.start();
connect(&timeoutTimer, &QTimer::timeout, this, &SysLoad::fetch);
+#ifndef __TERMUX__
connect(NetworkManager::notifier(), &NetworkManager::Notifier::primaryConnectionChanged,
[this]() { maxScale = NET_INIT_SCALE; maxBytes = 0; }); // reset since we're changing network (which might be slower)
+#endif
// gradually decrease max network throughput to really be able to see when network traffic occurs
+#ifndef __TERMUX__
netLoadTimer.setInterval(NET_INTERVAL_S * 1000);
netLoadTimer.start();
connect(&netLoadTimer, &QTimer::timeout, this, [this]() { maxBytes = 0; if ( maxScale > NET_INIT_SCALE ) maxScale /= 2; });
+#endif
fetch();
const int cpuBars = cpuSummaryBar ? 1 : cpus.count();
const int cpuBarWidth = (cpuBars <= 4) ? BAR_WIDTH : SMALL_BAR_WIDTH;
+#ifdef __TERMUX__
+ setFixedWidth((cpuBars * cpuBarWidth) + (2 * BAR_WIDTH) +
+ contentsMargins().left() + contentsMargins().right());
+#else
setFixedWidth((cpuBars * cpuBarWidth) + ((2 + 1) * BAR_WIDTH) + // 2 memory bars, 1 net - they shall be more prominent
contentsMargins().left() + contentsMargins().right());
+#endif
}
//--------------------------------------------------------------------------------
@@ -143,6 +154,7 @@
f.close();
}
+#ifndef __TERMUX__
f.setFileName("/proc/net/dev");
sumSent = sumReceived = 0;
if ( f.open(QIODevice::ReadOnly) )
@@ -190,6 +202,7 @@
maxBytes = std::max(maxBytes, (sumReceived + sumSent));
maxScale = std::max(maxBytes, maxScale);
+#endif
update();
@@ -220,11 +233,13 @@
tip += i18n("Swap Free: %1 MB (%2 GB)" , swapFree / 1024, locale().toString(swapFree / 1024.0 / 1024.0, 'f', 2));
tip += "<hr>";
+#ifndef __TERMUX__
tip += i18n("Net send/receive: %1/%2 KB/sec",
locale().toString((sumSent / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2),
locale().toString((sumReceived / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2));
tip += "<br>";
tip += i18n("Net max (last %2 secs): %1 KB/sec", locale().toString((maxBytes / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2), NET_INTERVAL_S);
+#endif
if ( underMouse() )
QToolTip::showText(QCursor::pos(), QLatin1String("<html>") + tip + QLatin1String("</html>"), this, rect());
@@ -291,6 +306,7 @@
painter.fillRect(x, y - h, BAR_WIDTH, h, memSwapColor);
+#ifndef __TERMUX__
// net
x += BAR_WIDTH;
y = contentsRect().y() + contentsRect().height();
@@ -299,6 +315,7 @@
y -= h;
h = contentsRect().height() * (double(sumSent) / maxScale);
painter.fillRect(x, y - h, BAR_WIDTH, h, netSentColor);
+#endif
}
//--------------------------------------------------------------------------------
--- a/SysTray.cxx
+++ b/SysTray.cxx
@@ -9,10 +9,12 @@
#include <SysTray.hxx>
#include <DBusTypes.hxx>
#include <NotificationServer.hxx>
+#ifndef __TERMUX__
#include <Network.hxx>
+#include <Bluetooth.hxx>
+#endif
#include <DeviceNotifier.hxx>
#include <Battery.hxx>
-#include <Bluetooth.hxx>
#ifdef WITH_PACKAGEKIT
#include <PkUpdates.hxx>
@@ -111,10 +113,14 @@
QVector<QWidget *> internalWidgets =
{
notificationServer = new NotificationServer(this),
+#ifndef __TERMUX__
new Network(this),
+#endif
new DeviceNotifier(this),
new Battery(this),
+#ifndef __TERMUX__
new Bluetooth(this),
+#endif
#ifdef WITH_PACKAGEKIT
new PkUpdates(this)
#endif
--- a/WeatherApplet.cxx
+++ b/WeatherApplet.cxx
@@ -24,7 +24,9 @@
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
+#ifndef __TERMUX__
#include <NetworkManagerQt/Manager>
+#endif
//--------------------------------------------------------------------------------
@@ -96,12 +98,14 @@
hbox->addStretch();
}
+#ifndef __TERMUX__
connect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged, this,
[this](NetworkManager::Connectivity connectivity)
{
if ( connectivity == NetworkManager::Full )
fetchData();
});
+#endif
}
//--------------------------------------------------------------------------------