add network
This commit is contained in:
parent
37497ddb10
commit
aaeac7a5cd
4 changed files with 99 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ 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 {}
|
||||||
|
|
@ -52,6 +53,14 @@ 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
|
||||||
|
|
@ -74,9 +83,9 @@ Singleton {
|
||||||
property int height: 30
|
property int height: 30
|
||||||
property int horizontalPadding: 8
|
property int horizontalPadding: 8
|
||||||
property int verticalPadding: 6
|
property int verticalPadding: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
component Gpu: QtObject {
|
component Gpu: QtObject {
|
||||||
property int iconSize: 14
|
property int iconSize: 14
|
||||||
property int fontSize: 14
|
property int fontSize: 14
|
||||||
property int height: 30
|
property int height: 30
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ 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,6 +104,10 @@ Scope {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Network {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
Storage {
|
Storage {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
@ -114,9 +118,9 @@ Scope {
|
||||||
|
|
||||||
Cpu {
|
Cpu {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Gpu {
|
Gpu {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
78
modules/bar/components/Network.qml
Normal file
78
modules/bar/components/Network.qml
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
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()}%`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue