Compare commits
No commits in common. "aaeac7a5cd1114b958169d7aaceaf0c90e0829d1" and "35d2addd70c1f86e620b2ae7de5e9e7a8dc95213" have entirely different histories.
aaeac7a5cd
...
35d2addd70
5 changed files with 4 additions and 180 deletions
|
|
@ -12,7 +12,6 @@ Singleton {
|
||||||
property Mpris mpris: Mpris {}
|
property Mpris mpris: Mpris {}
|
||||||
property Clock clock: Clock {}
|
property Clock clock: Clock {}
|
||||||
property Pipewire pipewire: Pipewire {}
|
property Pipewire pipewire: Pipewire {}
|
||||||
property Network network: Network {}
|
|
||||||
property Storage storage: Storage {}
|
property Storage storage: Storage {}
|
||||||
property Memory memory: Memory {}
|
property Memory memory: Memory {}
|
||||||
property Cpu cpu: Cpu {}
|
property Cpu cpu: Cpu {}
|
||||||
|
|
@ -53,14 +52,6 @@ Singleton {
|
||||||
property int verticalPadding: 6
|
property int verticalPadding: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
component Network: QtObject {
|
|
||||||
property int iconSize: 14
|
|
||||||
property int fontSize: 14
|
|
||||||
property int height: 30
|
|
||||||
property int horizontalPadding: 8
|
|
||||||
property int verticalPadding: 6
|
|
||||||
}
|
|
||||||
|
|
||||||
component Storage: QtObject {
|
component Storage: QtObject {
|
||||||
property int iconSize: 14
|
property int iconSize: 14
|
||||||
property int fontSize: 14
|
property int fontSize: 14
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,6 @@ Singleton {
|
||||||
property string gpu: "\u{E66f}"
|
property string gpu: "\u{E66f}"
|
||||||
property string hardDrive: "\u{E0f1}"
|
property string hardDrive: "\u{E0f1}"
|
||||||
property string memoryStick: "\u{E44a}"
|
property string memoryStick: "\u{E44a}"
|
||||||
property string wifiOff: "\u{E1af}"
|
|
||||||
property string wifiLow: "\u{E5fd}"
|
|
||||||
property string wifiHigh: "\u{E5fc}"
|
|
||||||
property string wifi: "\u{E1ae}"
|
|
||||||
property string triangle: "\u{E192}"
|
property string triangle: "\u{E192}"
|
||||||
property string triangleDashed: "\u{E642}"
|
property string triangleDashed: "\u{E642}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,6 @@ Scope {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Network {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Storage {
|
Storage {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import "../../../config/"
|
|
||||||
import "../../../constants/"
|
|
||||||
import "../../../services/"
|
|
||||||
import "../../../styled/"
|
|
||||||
import "../../../utils/"
|
|
||||||
|
|
||||||
StyledLabel {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
implicitWidth: row.width
|
|
||||||
implicitHeight: Dimensions.network.height
|
|
||||||
|
|
||||||
Ref {
|
|
||||||
id: ref
|
|
||||||
service: NetworkService
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: row
|
|
||||||
StyledText {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
font.family: Theme.lucide.font.family
|
|
||||||
font.pixelSize: Dimensions.network.iconSize
|
|
||||||
font.bold: true
|
|
||||||
text: Icons.wifiOff
|
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
topPadding: Dimensions.network.verticalPadding
|
|
||||||
bottomPadding: Dimensions.network.verticalPadding
|
|
||||||
leftPadding: Dimensions.network.horizontalPadding
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "high"
|
|
||||||
when: NetworkService.active?.strength > 50
|
|
||||||
PropertyChanges {
|
|
||||||
icon {
|
|
||||||
text: Icons.wifi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "medium"
|
|
||||||
when: NetworkService.active?.strength > 25
|
|
||||||
PropertyChanges {
|
|
||||||
icon {
|
|
||||||
text: Icons.wifiHigh
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "low"
|
|
||||||
when: NetworkService.active?.strength > 0
|
|
||||||
PropertyChanges {
|
|
||||||
icon {
|
|
||||||
text: Icons.wifiLow
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
id: text
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
topPadding: Dimensions.network.verticalPadding
|
|
||||||
bottomPadding: Dimensions.network.verticalPadding
|
|
||||||
rightPadding: Dimensions.network.horizontalPadding
|
|
||||||
|
|
||||||
font.pixelSize: Dimensions.network.fontSize
|
|
||||||
|
|
||||||
text: ` ${(NetworkService.active?.strength ?? 0).toFixed()}%`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property list<AccessPoint> networks: []
|
|
||||||
readonly property AccessPoint active: networks.find(n => n.active) ?? null
|
|
||||||
|
|
||||||
reloadableId: "network"
|
|
||||||
|
|
||||||
Process {
|
|
||||||
running: true
|
|
||||||
command: ["nmcli", "m"]
|
|
||||||
stdout: SplitParser {
|
|
||||||
onRead: getNetworks.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: getNetworks
|
|
||||||
running: true
|
|
||||||
command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID,BSSID", "d", "w"]
|
|
||||||
environment: ({
|
|
||||||
LANG: "C",
|
|
||||||
LC_ALL: "C"
|
|
||||||
})
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const PLACEHOLDER = "STRINGWHICHHOPEFULLYWONTBEUSED";
|
|
||||||
const rep = new RegExp("\\\\:", "g");
|
|
||||||
const rep2 = new RegExp(PLACEHOLDER, "g");
|
|
||||||
|
|
||||||
const networks = text.trim().split("\n").map(n => {
|
|
||||||
const net = n.replace(rep, PLACEHOLDER).split(":");
|
|
||||||
return {
|
|
||||||
active: net[0] === "yes",
|
|
||||||
strength: parseInt(net[1]),
|
|
||||||
frequency: parseInt(net[2]),
|
|
||||||
ssid: net[3],
|
|
||||||
bssid: net[4]?.replace(rep2, ":") ?? ""
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const rNetworks = root.networks;
|
|
||||||
|
|
||||||
const destroyed = rNetworks.filter(rn => !networks.find(n => n.frequency === rn.frequency && n.ssid === rn.ssid && n.bssid === rn.bssid));
|
|
||||||
for (const network of destroyed)
|
|
||||||
rNetworks.splice(rNetworks.indexOf(network), 1).forEach(n => n.destroy());
|
|
||||||
|
|
||||||
for (const network of networks) {
|
|
||||||
const match = rNetworks.find(n => n.frequency === network.frequency && n.ssid === network.ssid && n.bssid === network.bssid);
|
|
||||||
if (match) {
|
|
||||||
match.lastIpcObject = network;
|
|
||||||
} else {
|
|
||||||
rNetworks.push(apComp.createObject(root, {
|
|
||||||
lastIpcObject: network
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component AccessPoint: QtObject {
|
|
||||||
required property var lastIpcObject
|
|
||||||
readonly property string ssid: lastIpcObject.ssid
|
|
||||||
readonly property string bssid: lastIpcObject.bssid
|
|
||||||
readonly property int strength: lastIpcObject.strength
|
|
||||||
readonly property int frequency: lastIpcObject.frequency
|
|
||||||
readonly property bool active: lastIpcObject.active
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: apComp
|
|
||||||
|
|
||||||
AccessPoint {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue