mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e327b1ca5b | ||
|
|
ad43ca11eb | ||
|
|
41ba76e2e2 | ||
|
|
15e773434e | ||
|
|
ed118f4e7a |
@@ -195,7 +195,7 @@ Item {
|
||||
powerMenuModalLoader: controlCenterLoader.powerModalLoaderRef
|
||||
|
||||
onLockRequested: {
|
||||
lock.activate()
|
||||
lockLoader.item.activate()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
@@ -17,7 +17,7 @@ DankModal {
|
||||
networkData = data
|
||||
networkInfoModalVisible = true
|
||||
open()
|
||||
NetworkManagerService.fetchNetworkInfo(ssid)
|
||||
NetworkService.fetchNetworkInfo(ssid)
|
||||
}
|
||||
|
||||
function hideDialog() {
|
||||
@@ -101,7 +101,7 @@ DankModal {
|
||||
id: detailsText
|
||||
|
||||
width: parent.width
|
||||
text: NetworkManagerService.networkInfoDetails && NetworkManagerService.networkInfoDetails.replace(/\\n/g, '\n') || "No information available"
|
||||
text: NetworkService.networkInfoDetails && NetworkService.networkInfoDetails.replace(/\\n/g, '\n') || "No information available"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
@@ -17,7 +17,7 @@ DankModal {
|
||||
wifiPasswordInput = ""
|
||||
wifiUsernameInput = ""
|
||||
|
||||
const network = NetworkManagerService.wifiNetworks.find(n => n.ssid === ssid)
|
||||
const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid)
|
||||
requiresEnterprise = network?.enterprise || false
|
||||
|
||||
open()
|
||||
@@ -59,14 +59,14 @@ DankModal {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: NetworkManagerService
|
||||
target: NetworkService
|
||||
|
||||
function onPasswordDialogShouldReopenChanged() {
|
||||
if (NetworkManagerService.passwordDialogShouldReopen && NetworkManagerService.connectingSSID !== "") {
|
||||
wifiPasswordSSID = NetworkManagerService.connectingSSID
|
||||
if (NetworkService.passwordDialogShouldReopen && NetworkService.connectingSSID !== "") {
|
||||
wifiPasswordSSID = NetworkService.connectingSSID
|
||||
wifiPasswordInput = ""
|
||||
open()
|
||||
NetworkManagerService.passwordDialogShouldReopen = false
|
||||
NetworkService.passwordDialogShouldReopen = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ DankModal {
|
||||
}
|
||||
onAccepted: () => {
|
||||
const username = requiresEnterprise ? usernameInput.text : ""
|
||||
NetworkManagerService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||
close()
|
||||
wifiPasswordInput = ""
|
||||
wifiUsernameInput = ""
|
||||
@@ -344,7 +344,7 @@ DankModal {
|
||||
enabled: parent.enabled
|
||||
onClicked: () => {
|
||||
const username = requiresEnterprise ? usernameInput.text : ""
|
||||
NetworkManagerService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||
close()
|
||||
wifiPasswordInput = ""
|
||||
wifiUsernameInput = ""
|
||||
|
||||
@@ -126,15 +126,7 @@ Column {
|
||||
return builtinPluginWidgetComponent
|
||||
} else if (id.startsWith("plugin_")) {
|
||||
return pluginWidgetComponent
|
||||
} else if (id === "wifi") {
|
||||
if (!DMSService.dmsAvailable) {
|
||||
return errorPillComponent
|
||||
}
|
||||
if (DMSService.dmsAvailable && !DMSService.capabilities.includes("network")) {
|
||||
return errorPillComponent
|
||||
}
|
||||
return compoundPillComponent
|
||||
} else if (id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
||||
} else if (id === "wifi" || id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
||||
return compoundPillComponent
|
||||
} else if (id === "volumeSlider") {
|
||||
return audioSliderComponent
|
||||
@@ -211,13 +203,13 @@ Column {
|
||||
switch (widgetData.id || "") {
|
||||
case "wifi":
|
||||
{
|
||||
if (NetworkManagerService.wifiToggling)
|
||||
if (NetworkService.wifiToggling)
|
||||
return "sync"
|
||||
if (NetworkManagerService.networkStatus === "ethernet")
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
return "settings_ethernet"
|
||||
if (NetworkManagerService.networkStatus === "wifi")
|
||||
return NetworkManagerService.wifiSignalIcon
|
||||
if (NetworkManagerService.wifiEnabled)
|
||||
if (NetworkService.networkStatus === "wifi")
|
||||
return NetworkService.wifiSignalIcon
|
||||
if (NetworkService.wifiEnabled)
|
||||
return "wifi_off"
|
||||
return "wifi_off"
|
||||
}
|
||||
@@ -270,13 +262,13 @@ Column {
|
||||
switch (widgetData.id || "") {
|
||||
case "wifi":
|
||||
{
|
||||
if (NetworkManagerService.wifiToggling)
|
||||
return NetworkManagerService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||
if (NetworkManagerService.networkStatus === "ethernet")
|
||||
if (NetworkService.wifiToggling)
|
||||
return NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
return "Ethernet"
|
||||
if (NetworkManagerService.networkStatus === "wifi" && NetworkManagerService.currentWifiSSID)
|
||||
return NetworkManagerService.currentWifiSSID
|
||||
if (NetworkManagerService.wifiEnabled)
|
||||
if (NetworkService.networkStatus === "wifi" && NetworkService.currentWifiSSID)
|
||||
return NetworkService.currentWifiSSID
|
||||
if (NetworkService.wifiEnabled)
|
||||
return "Not connected"
|
||||
return "WiFi off"
|
||||
}
|
||||
@@ -302,13 +294,13 @@ Column {
|
||||
switch (widgetData.id || "") {
|
||||
case "wifi":
|
||||
{
|
||||
if (NetworkManagerService.wifiToggling)
|
||||
if (NetworkService.wifiToggling)
|
||||
return "Please wait..."
|
||||
if (NetworkManagerService.networkStatus === "ethernet")
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
return "Connected"
|
||||
if (NetworkManagerService.networkStatus === "wifi")
|
||||
return NetworkManagerService.wifiSignalStrength > 0 ? NetworkManagerService.wifiSignalStrength + "%" : "Connected"
|
||||
if (NetworkManagerService.wifiEnabled)
|
||||
if (NetworkService.networkStatus === "wifi")
|
||||
return NetworkService.wifiSignalStrength > 0 ? NetworkService.wifiSignalStrength + "%" : "Connected"
|
||||
if (NetworkService.wifiEnabled)
|
||||
return "Select network"
|
||||
return ""
|
||||
}
|
||||
@@ -356,13 +348,13 @@ Column {
|
||||
switch (widgetData.id || "") {
|
||||
case "wifi":
|
||||
{
|
||||
if (NetworkManagerService.wifiToggling)
|
||||
if (NetworkService.wifiToggling)
|
||||
return false
|
||||
if (NetworkManagerService.networkStatus === "ethernet")
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
return true
|
||||
if (NetworkManagerService.networkStatus === "wifi")
|
||||
if (NetworkService.networkStatus === "wifi")
|
||||
return true
|
||||
return NetworkManagerService.wifiEnabled
|
||||
return NetworkService.wifiEnabled
|
||||
}
|
||||
case "bluetooth":
|
||||
return !!(BluetoothService.available && BluetoothService.adapter && BluetoothService.adapter.enabled)
|
||||
|
||||
@@ -73,13 +73,17 @@ DankPopout {
|
||||
onShouldBeVisibleChanged: {
|
||||
if (shouldBeVisible) {
|
||||
Qt.callLater(() => {
|
||||
NetworkManagerService.autoRefreshEnabled = NetworkManagerService.wifiEnabled
|
||||
if (NetworkService.activeService) {
|
||||
NetworkService.activeService.autoRefreshEnabled = NetworkService.wifiEnabled
|
||||
}
|
||||
if (UserInfoService)
|
||||
UserInfoService.getUptime()
|
||||
})
|
||||
} else {
|
||||
Qt.callLater(() => {
|
||||
NetworkManagerService.autoRefreshEnabled = false
|
||||
if (NetworkService.activeService) {
|
||||
NetworkService.activeService.autoRefreshEnabled = false
|
||||
}
|
||||
if (BluetoothService.adapter && BluetoothService.adapter.discovering)
|
||||
BluetoothService.adapter.discovering = false
|
||||
editMode = false
|
||||
|
||||
@@ -8,10 +8,10 @@ import qs.Modals
|
||||
|
||||
Rectangle {
|
||||
implicitHeight: {
|
||||
if (NetworkManagerService.wifiToggling) {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return headerRow.height + wifiToggleContent.height + Theme.spacingM
|
||||
}
|
||||
if (NetworkManagerService.wifiEnabled) {
|
||||
if (NetworkService.wifiEnabled) {
|
||||
return headerRow.height + wifiContent.height + Theme.spacingM
|
||||
}
|
||||
return headerRow.height + wifiOffContent.height + Theme.spacingM
|
||||
@@ -22,11 +22,11 @@ Rectangle {
|
||||
border.width: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
NetworkManagerService.addRef()
|
||||
NetworkService.addRef()
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
NetworkManagerService.removeRef()
|
||||
NetworkService.removeRef()
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -56,11 +56,11 @@ Rectangle {
|
||||
DankButtonGroup {
|
||||
id: preferenceControls
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: NetworkManagerService.ethernetConnected
|
||||
visible: NetworkService.ethernetConnected
|
||||
|
||||
property int currentPreferenceIndex: {
|
||||
const pref = NetworkManagerService.userPreference
|
||||
const status = NetworkManagerService.networkStatus
|
||||
const pref = NetworkService.userPreference
|
||||
const status = NetworkService.networkStatus
|
||||
let index = 1
|
||||
|
||||
if (pref === "ethernet") {
|
||||
@@ -80,7 +80,7 @@ Rectangle {
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return
|
||||
console.log("NetworkDetail: Setting preference to", index === 0 ? "ethernet" : "wifi")
|
||||
NetworkManagerService.setNetworkPreference(index === 0 ? "ethernet" : "wifi")
|
||||
NetworkService.setNetworkPreference(index === 0 ? "ethernet" : "wifi")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.spacingM
|
||||
anchors.topMargin: Theme.spacingM
|
||||
visible: NetworkManagerService.wifiToggling
|
||||
visible: NetworkService.wifiToggling
|
||||
height: visible ? 80 : 0
|
||||
|
||||
Column {
|
||||
@@ -106,7 +106,7 @@ Rectangle {
|
||||
color: Theme.primary
|
||||
|
||||
RotationAnimation on rotation {
|
||||
running: NetworkManagerService.wifiToggling
|
||||
running: NetworkService.wifiToggling
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 360
|
||||
@@ -116,7 +116,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: NetworkManagerService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||
text: NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -131,7 +131,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.spacingM
|
||||
anchors.topMargin: Theme.spacingM
|
||||
visible: !NetworkManagerService.wifiEnabled && !NetworkManagerService.wifiToggling
|
||||
visible: !NetworkService.wifiEnabled && !NetworkService.wifiToggling
|
||||
height: visible ? 120 : 0
|
||||
|
||||
Column {
|
||||
@@ -177,7 +177,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: NetworkManagerService.toggleWifiRadio()
|
||||
onClicked: NetworkService.toggleWifiRadio()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,7 +192,7 @@ Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: Theme.spacingM
|
||||
anchors.topMargin: Theme.spacingM
|
||||
visible: NetworkManagerService.wifiInterface && NetworkManagerService.wifiEnabled && !NetworkManagerService.wifiToggling
|
||||
visible: NetworkService.wifiInterface && NetworkService.wifiEnabled && !NetworkService.wifiToggling
|
||||
contentHeight: wifiColumn.height
|
||||
clip: true
|
||||
|
||||
@@ -204,7 +204,7 @@ Rectangle {
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 200
|
||||
visible: NetworkManagerService.wifiInterface && NetworkManagerService.wifiNetworks?.length < 1 && !NetworkManagerService.wifiToggling && NetworkManagerService.isScanning
|
||||
visible: NetworkService.wifiInterface && NetworkService.wifiNetworks?.length < 1 && !NetworkService.wifiToggling && NetworkService.isScanning
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
@@ -213,7 +213,7 @@ Rectangle {
|
||||
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
|
||||
|
||||
RotationAnimation on rotation {
|
||||
running: NetworkManagerService.isScanning
|
||||
running: NetworkService.isScanning
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 360
|
||||
@@ -226,8 +226,8 @@ Rectangle {
|
||||
model: sortedNetworks
|
||||
|
||||
property var sortedNetworks: {
|
||||
const ssid = NetworkManagerService.currentWifiSSID
|
||||
const networks = NetworkManagerService.wifiNetworks
|
||||
const ssid = NetworkService.currentWifiSSID
|
||||
const networks = NetworkService.wifiNetworks
|
||||
let sorted = [...networks]
|
||||
sorted.sort((a, b) => {
|
||||
if (a.ssid === ssid) return -1
|
||||
@@ -244,7 +244,7 @@ Rectangle {
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: networkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.surfaceContainerHighest
|
||||
border.color: modelData.ssid === NetworkManagerService.currentWifiSSID ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: 0
|
||||
|
||||
Row {
|
||||
@@ -261,7 +261,7 @@ Rectangle {
|
||||
return "wifi_1_bar"
|
||||
}
|
||||
size: Theme.iconSize - 4
|
||||
color: modelData.ssid === NetworkManagerService.currentWifiSSID ? Theme.primary : Theme.surfaceText
|
||||
color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ Rectangle {
|
||||
text: modelData.ssid || "Unknown Network"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: modelData.ssid === NetworkManagerService.currentWifiSSID ? Font.Medium : Font.Normal
|
||||
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
}
|
||||
@@ -282,7 +282,7 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: modelData.ssid === NetworkManagerService.currentWifiSSID ? "Connected" : (modelData.secured ? "Secured" : "Open")
|
||||
text: modelData.ssid === NetworkService.currentWifiSSID ? "Connected" : (modelData.secured ? "Secured" : "Open")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
@@ -316,7 +316,7 @@ Rectangle {
|
||||
} else {
|
||||
networkContextMenu.currentSSID = modelData.ssid
|
||||
networkContextMenu.currentSecured = modelData.secured
|
||||
networkContextMenu.currentConnected = modelData.ssid === NetworkManagerService.currentWifiSSID
|
||||
networkContextMenu.currentConnected = modelData.ssid === NetworkService.currentWifiSSID
|
||||
networkContextMenu.currentSaved = modelData.saved
|
||||
networkContextMenu.currentSignal = modelData.signal
|
||||
networkContextMenu.popup(optionsButton, -networkContextMenu.width + optionsButton.width, optionsButton.height + Theme.spacingXS)
|
||||
@@ -331,11 +331,11 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function(event) {
|
||||
if (modelData.ssid !== NetworkManagerService.currentWifiSSID) {
|
||||
if (modelData.ssid !== NetworkService.currentWifiSSID) {
|
||||
if (modelData.secured && !modelData.saved) {
|
||||
wifiPasswordModal.show(modelData.ssid)
|
||||
} else {
|
||||
NetworkManagerService.connectToWifi(modelData.ssid)
|
||||
NetworkService.connectToWifi(modelData.ssid)
|
||||
}
|
||||
}
|
||||
event.accepted = true
|
||||
@@ -384,12 +384,12 @@ Rectangle {
|
||||
|
||||
onTriggered: {
|
||||
if (networkContextMenu.currentConnected) {
|
||||
NetworkManagerService.disconnectWifi()
|
||||
NetworkService.disconnectWifi()
|
||||
} else {
|
||||
if (networkContextMenu.currentSecured && !networkContextMenu.currentSaved) {
|
||||
wifiPasswordModal.show(networkContextMenu.currentSSID)
|
||||
} else {
|
||||
NetworkManagerService.connectToWifi(networkContextMenu.currentSSID)
|
||||
NetworkService.connectToWifi(networkContextMenu.currentSSID)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -413,7 +413,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onTriggered: {
|
||||
let networkData = NetworkManagerService.getNetworkInfo(networkContextMenu.currentSSID)
|
||||
let networkData = NetworkService.getNetworkInfo(networkContextMenu.currentSSID)
|
||||
networkInfoModal.showNetworkInfo(networkContextMenu.currentSSID, networkData)
|
||||
}
|
||||
}
|
||||
@@ -437,7 +437,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onTriggered: {
|
||||
NetworkManagerService.forgetWifiNetwork(networkContextMenu.currentSSID)
|
||||
NetworkService.forgetWifiNetwork(networkContextMenu.currentSSID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ QtObject {
|
||||
"description": "Wi-Fi and Ethernet connection",
|
||||
"icon": "wifi",
|
||||
"type": "connection",
|
||||
"enabled": NetworkManagerService.wifiAvailable,
|
||||
"warning": !NetworkManagerService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||
"enabled": NetworkService.wifiAvailable,
|
||||
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||
}, {
|
||||
"id": "bluetooth",
|
||||
"text": "Bluetooth",
|
||||
|
||||
@@ -1003,8 +1003,8 @@ Item {
|
||||
}
|
||||
controlCenterLoader.item.triggerScreen = barWindow.screen
|
||||
controlCenterLoader.item.toggle()
|
||||
if (controlCenterLoader.item.shouldBeVisible && NetworkManagerService.wifiEnabled) {
|
||||
NetworkManagerService.scanWifi()
|
||||
if (controlCenterLoader.item.shouldBeVisible && NetworkService.wifiEnabled) {
|
||||
NetworkService.scanWifi()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,26 +42,26 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: {
|
||||
if (NetworkManagerService.wifiToggling) {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return "sync"
|
||||
}
|
||||
|
||||
if (NetworkManagerService.networkStatus === "ethernet") {
|
||||
if (NetworkService.networkStatus === "ethernet") {
|
||||
return "lan"
|
||||
}
|
||||
|
||||
return NetworkManagerService.wifiSignalIcon
|
||||
return NetworkService.wifiSignalIcon
|
||||
}
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (NetworkManagerService.wifiToggling) {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return Theme.primary
|
||||
}
|
||||
|
||||
return NetworkManagerService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
||||
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: root.showNetworkIcon && NetworkManagerService.networkAvailable
|
||||
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
@@ -141,26 +141,26 @@ Rectangle {
|
||||
id: networkIcon
|
||||
|
||||
name: {
|
||||
if (NetworkManagerService.wifiToggling) {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return "sync";
|
||||
}
|
||||
|
||||
if (NetworkManagerService.networkStatus === "ethernet") {
|
||||
if (NetworkService.networkStatus === "ethernet") {
|
||||
return "lan";
|
||||
}
|
||||
|
||||
return NetworkManagerService.wifiSignalIcon;
|
||||
return NetworkService.wifiSignalIcon;
|
||||
}
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (NetworkManagerService.wifiToggling) {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return Theme.primary;
|
||||
}
|
||||
|
||||
return NetworkManagerService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton;
|
||||
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton;
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: root.showNetworkIcon && NetworkManagerService.networkAvailable
|
||||
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ Rectangle {
|
||||
|
||||
const name = split[0];
|
||||
const path = split[1];
|
||||
const fileName = name.substring(name.lastIndexOf("/") + 1);
|
||||
let fileName = name.substring(name.lastIndexOf("/") + 1);
|
||||
if (fileName.startsWith("dropboxstatus")) {
|
||||
fileName = `hicolor/16x16/status/${fileName}`;
|
||||
}
|
||||
return `file://${path}/${fileName}`;
|
||||
}
|
||||
if (icon.startsWith("/") && !icon.startsWith("file://")) {
|
||||
|
||||
@@ -13,7 +13,7 @@ Item {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (SessionService.loginctlAvailable) {
|
||||
if (SessionService.loginctlAvailable || SessionService.sessionPath) {
|
||||
if (SessionService.locked || SessionService.lockedHint) {
|
||||
console.log("Lock: Session locked on startup")
|
||||
loader.activeAsync = true
|
||||
|
||||
@@ -906,20 +906,20 @@ Item {
|
||||
height: 24
|
||||
color: Qt.rgba(255, 255, 255, 0.2)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: WeatherService.weather.available && (NetworkManagerService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio) || BatteryService.batteryAvailable)
|
||||
visible: WeatherService.weather.available && (NetworkService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio) || BatteryService.batteryAvailable)
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: NetworkManagerService.networkStatus !== "disconnected" || (BluetoothService.available && BluetoothService.enabled) || (AudioService.sink && AudioService.sink.audio)
|
||||
visible: NetworkService.networkStatus !== "disconnected" || (BluetoothService.available && BluetoothService.enabled) || (AudioService.sink && AudioService.sink.audio)
|
||||
|
||||
DankIcon {
|
||||
name: NetworkManagerService.networkStatus === "ethernet" ? "lan" : NetworkManagerService.wifiSignalIcon
|
||||
name: NetworkService.networkStatus === "ethernet" ? "lan" : NetworkService.wifiSignalIcon
|
||||
size: Theme.iconSize - 2
|
||||
color: NetworkManagerService.networkStatus !== "disconnected" ? "white" : Qt.rgba(255, 255, 255, 0.5)
|
||||
color: NetworkService.networkStatus !== "disconnected" ? "white" : Qt.rgba(255, 255, 255, 0.5)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: NetworkManagerService.networkStatus !== "disconnected"
|
||||
visible: NetworkService.networkStatus !== "disconnected"
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
@@ -955,7 +955,7 @@ Item {
|
||||
height: 24
|
||||
color: Qt.rgba(255, 255, 255, 0.2)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: BatteryService.batteryAvailable && (NetworkManagerService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio))
|
||||
visible: BatteryService.batteryAvailable && (NetworkService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio))
|
||||
}
|
||||
|
||||
Row {
|
||||
|
||||
1094
Services/LegacyNetworkService.qml
Normal file
1094
Services/LegacyNetworkService.qml
Normal file
File diff suppressed because it is too large
Load Diff
236
Services/NetworkService.qml
Normal file
236
Services/NetworkService.qml
Normal file
@@ -0,0 +1,236 @@
|
||||
pragma Singleton
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool networkAvailable: activeService !== null
|
||||
property string networkStatus: activeService?.networkStatus ?? "disconnected"
|
||||
property string primaryConnection: activeService?.primaryConnection ?? ""
|
||||
|
||||
property string ethernetIP: activeService?.ethernetIP ?? ""
|
||||
property string ethernetInterface: activeService?.ethernetInterface ?? ""
|
||||
property bool ethernetConnected: activeService?.ethernetConnected ?? false
|
||||
property string ethernetConnectionUuid: activeService?.ethernetConnectionUuid ?? ""
|
||||
|
||||
property string wifiIP: activeService?.wifiIP ?? ""
|
||||
property string wifiInterface: activeService?.wifiInterface ?? ""
|
||||
property bool wifiConnected: activeService?.wifiConnected ?? false
|
||||
property bool wifiEnabled: activeService?.wifiEnabled ?? true
|
||||
property string wifiConnectionUuid: activeService?.wifiConnectionUuid ?? ""
|
||||
property string wifiDevicePath: activeService?.wifiDevicePath ?? ""
|
||||
property string activeAccessPointPath: activeService?.activeAccessPointPath ?? ""
|
||||
|
||||
property string currentWifiSSID: activeService?.currentWifiSSID ?? ""
|
||||
property int wifiSignalStrength: activeService?.wifiSignalStrength ?? 0
|
||||
property var wifiNetworks: activeService?.wifiNetworks ?? []
|
||||
property var savedConnections: activeService?.savedConnections ?? []
|
||||
property var ssidToConnectionName: activeService?.ssidToConnectionName ?? ({})
|
||||
property var wifiSignalIcon: activeService?.wifiSignalIcon ?? "wifi_off"
|
||||
|
||||
property string userPreference: activeService?.userPreference ?? "auto"
|
||||
property bool isConnecting: activeService?.isConnecting ?? false
|
||||
property string connectingSSID: activeService?.connectingSSID ?? ""
|
||||
property string connectionError: activeService?.connectionError ?? ""
|
||||
|
||||
property bool isScanning: activeService?.isScanning ?? false
|
||||
property bool autoScan: activeService?.autoScan ?? false
|
||||
|
||||
property bool wifiAvailable: activeService?.wifiAvailable ?? true
|
||||
property bool wifiToggling: activeService?.wifiToggling ?? false
|
||||
property bool changingPreference: activeService?.changingPreference ?? false
|
||||
property string targetPreference: activeService?.targetPreference ?? ""
|
||||
property var savedWifiNetworks: activeService?.savedWifiNetworks ?? []
|
||||
property string connectionStatus: activeService?.connectionStatus ?? ""
|
||||
property string lastConnectionError: activeService?.lastConnectionError ?? ""
|
||||
property bool passwordDialogShouldReopen: activeService?.passwordDialogShouldReopen ?? false
|
||||
property bool autoRefreshEnabled: activeService?.autoRefreshEnabled ?? false
|
||||
property string wifiPassword: activeService?.wifiPassword ?? ""
|
||||
property string forgetSSID: activeService?.forgetSSID ?? ""
|
||||
|
||||
property string networkInfoSSID: activeService?.networkInfoSSID ?? ""
|
||||
property string networkInfoDetails: activeService?.networkInfoDetails ?? ""
|
||||
property bool networkInfoLoading: activeService?.networkInfoLoading ?? false
|
||||
|
||||
property int refCount: activeService?.refCount ?? 0
|
||||
property bool stateInitialized: activeService?.stateInitialized ?? false
|
||||
|
||||
property bool subscriptionConnected: activeService?.subscriptionConnected ?? false
|
||||
|
||||
signal networksUpdated
|
||||
signal connectionChanged
|
||||
|
||||
property bool usingLegacy: false
|
||||
property var activeService: null
|
||||
|
||||
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("NetworkService: Initializing...")
|
||||
if (!socketPath || socketPath.length === 0) {
|
||||
console.log("NetworkService: DMS_SOCKET not set, using LegacyNetworkService")
|
||||
useLegacyService()
|
||||
} else {
|
||||
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...")
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: NetworkManagerService
|
||||
|
||||
function onNetworkAvailableChanged() {
|
||||
if (!activeService && NetworkManagerService.networkAvailable) {
|
||||
console.log("NetworkService: Network capability detected, using NetworkManagerService")
|
||||
activeService = NetworkManagerService
|
||||
usingLegacy = false
|
||||
console.log("NetworkService: Switched to NetworkManagerService, networkAvailable:", networkAvailable)
|
||||
connectSignals()
|
||||
} else if (!activeService && !NetworkManagerService.networkAvailable && socketPath && socketPath.length > 0) {
|
||||
console.log("NetworkService: Network capability not available in DMS, using LegacyNetworkService")
|
||||
useLegacyService()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function useLegacyService() {
|
||||
activeService = LegacyNetworkService
|
||||
usingLegacy = true
|
||||
console.log("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable)
|
||||
if (LegacyNetworkService.activate) {
|
||||
LegacyNetworkService.activate()
|
||||
}
|
||||
connectSignals()
|
||||
}
|
||||
|
||||
function connectSignals() {
|
||||
if (activeService) {
|
||||
if (activeService.networksUpdated) {
|
||||
activeService.networksUpdated.connect(root.networksUpdated)
|
||||
}
|
||||
if (activeService.connectionChanged) {
|
||||
activeService.connectionChanged.connect(root.connectionChanged)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addRef() {
|
||||
if (activeService && activeService.addRef) {
|
||||
activeService.addRef()
|
||||
}
|
||||
}
|
||||
|
||||
function removeRef() {
|
||||
if (activeService && activeService.removeRef) {
|
||||
activeService.removeRef()
|
||||
}
|
||||
}
|
||||
|
||||
function getState() {
|
||||
if (activeService && activeService.getState) {
|
||||
activeService.getState()
|
||||
}
|
||||
}
|
||||
|
||||
function scanWifi() {
|
||||
if (activeService && activeService.scanWifi) {
|
||||
activeService.scanWifi()
|
||||
}
|
||||
}
|
||||
|
||||
function scanWifiNetworks() {
|
||||
if (activeService && activeService.scanWifiNetworks) {
|
||||
activeService.scanWifiNetworks()
|
||||
}
|
||||
}
|
||||
|
||||
function connectToWifi(ssid, password = "", username = "") {
|
||||
if (activeService && activeService.connectToWifi) {
|
||||
activeService.connectToWifi(ssid, password, username)
|
||||
}
|
||||
}
|
||||
|
||||
function disconnectWifi() {
|
||||
if (activeService && activeService.disconnectWifi) {
|
||||
activeService.disconnectWifi()
|
||||
}
|
||||
}
|
||||
|
||||
function forgetWifiNetwork(ssid) {
|
||||
if (activeService && activeService.forgetWifiNetwork) {
|
||||
activeService.forgetWifiNetwork(ssid)
|
||||
}
|
||||
}
|
||||
|
||||
function toggleWifiRadio() {
|
||||
if (activeService && activeService.toggleWifiRadio) {
|
||||
activeService.toggleWifiRadio()
|
||||
}
|
||||
}
|
||||
|
||||
function enableWifiDevice() {
|
||||
if (activeService && activeService.enableWifiDevice) {
|
||||
activeService.enableWifiDevice()
|
||||
}
|
||||
}
|
||||
|
||||
function setNetworkPreference(preference) {
|
||||
if (activeService && activeService.setNetworkPreference) {
|
||||
activeService.setNetworkPreference(preference)
|
||||
}
|
||||
}
|
||||
|
||||
function setConnectionPriority(type) {
|
||||
if (activeService && activeService.setConnectionPriority) {
|
||||
activeService.setConnectionPriority(type)
|
||||
}
|
||||
}
|
||||
|
||||
function connectToWifiAndSetPreference(ssid, password, username = "") {
|
||||
if (activeService && activeService.connectToWifiAndSetPreference) {
|
||||
activeService.connectToWifiAndSetPreference(ssid, password, username)
|
||||
}
|
||||
}
|
||||
|
||||
function toggleNetworkConnection(type) {
|
||||
if (activeService && activeService.toggleNetworkConnection) {
|
||||
activeService.toggleNetworkConnection(type)
|
||||
}
|
||||
}
|
||||
|
||||
function startAutoScan() {
|
||||
if (activeService && activeService.startAutoScan) {
|
||||
activeService.startAutoScan()
|
||||
}
|
||||
}
|
||||
|
||||
function stopAutoScan() {
|
||||
if (activeService && activeService.stopAutoScan) {
|
||||
activeService.stopAutoScan()
|
||||
}
|
||||
}
|
||||
|
||||
function fetchNetworkInfo(ssid) {
|
||||
if (activeService && activeService.fetchNetworkInfo) {
|
||||
activeService.fetchNetworkInfo(ssid)
|
||||
}
|
||||
}
|
||||
|
||||
function getNetworkInfo(ssid) {
|
||||
if (activeService && activeService.getNetworkInfo) {
|
||||
return activeService.getNetworkInfo(ssid)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function refreshNetworkState() {
|
||||
if (activeService && activeService.refreshNetworkState) {
|
||||
activeService.refreshNetworkState()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,22 +21,24 @@ Singleton {
|
||||
function init() {}
|
||||
|
||||
function getSystemProfileImage() {
|
||||
if (!freedeskAvailable || !dmsService || !dmsService.service) return
|
||||
if (freedeskAvailable && dmsService && dmsService.service) {
|
||||
const username = Quickshell.env("USER")
|
||||
if (!username) return
|
||||
|
||||
const username = Quickshell.env("USER")
|
||||
if (!username) return
|
||||
|
||||
dmsService.service.sendRequest("freedesktop.accounts.getUserIconFile", { username: username }, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const iconFile = response.result.value || ""
|
||||
if (iconFile && iconFile !== "" && iconFile !== "/var/lib/AccountsService/icons/") {
|
||||
systemProfileImage = iconFile
|
||||
if (!profileImage || profileImage === "") {
|
||||
profileImage = iconFile
|
||||
dmsService.service.sendRequest("freedesktop.accounts.getUserIconFile", { username: username }, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const iconFile = response.result.value || ""
|
||||
if (iconFile && iconFile !== "" && iconFile !== "/var/lib/AccountsService/icons/") {
|
||||
systemProfileImage = iconFile
|
||||
if (!profileImage || profileImage === "") {
|
||||
profileImage = iconFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
systemProfileCheckProcess.running = true
|
||||
}
|
||||
}
|
||||
|
||||
function getUserProfileImage(username) {
|
||||
@@ -48,20 +50,27 @@ Singleton {
|
||||
profileImage = ""
|
||||
return
|
||||
}
|
||||
if (!freedeskAvailable || !dmsService || !dmsService.service) return
|
||||
|
||||
dmsService.service.sendRequest("freedesktop.accounts.getUserIconFile", { username: username }, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const icon = response.result.value || ""
|
||||
if (icon && icon !== "" && icon !== "/var/lib/AccountsService/icons/") {
|
||||
profileImage = icon
|
||||
if (freedeskAvailable && dmsService && dmsService.service) {
|
||||
dmsService.service.sendRequest("freedesktop.accounts.getUserIconFile", { username: username }, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const icon = response.result.value || ""
|
||||
if (icon && icon !== "" && icon !== "/var/lib/AccountsService/icons/") {
|
||||
profileImage = icon
|
||||
} else {
|
||||
profileImage = ""
|
||||
}
|
||||
} else {
|
||||
profileImage = ""
|
||||
}
|
||||
} else {
|
||||
profileImage = ""
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
userProfileCheckProcess.command = [
|
||||
"bash", "-c",
|
||||
`uid=$(id -u ${username} 2>/dev/null) && [ -n "$uid" ] && dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$uid org.freedesktop.DBus.Properties.Get string:org.freedesktop.Accounts.User string:IconFile 2>/dev/null | grep -oP 'string "\\K[^"]+' || echo ""`
|
||||
]
|
||||
userProfileCheckProcess.running = true
|
||||
}
|
||||
}
|
||||
|
||||
function setProfileImage(imagePath) {
|
||||
@@ -76,23 +85,25 @@ Singleton {
|
||||
}
|
||||
|
||||
function getSystemColorScheme() {
|
||||
if (!freedeskAvailable || !dmsService || !dmsService.service) return
|
||||
if (freedeskAvailable && dmsService && dmsService.service) {
|
||||
dmsService.service.sendRequest("freedesktop.settings.getColorScheme", null, response => {
|
||||
if (response.result) {
|
||||
systemColorScheme = response.result.value || 0
|
||||
|
||||
dmsService.service.sendRequest("freedesktop.settings.getColorScheme", null, response => {
|
||||
if (response.result) {
|
||||
systemColorScheme = response.result.value || 0
|
||||
|
||||
if (typeof Theme !== "undefined") {
|
||||
const shouldBeLightMode = (systemColorScheme === 2)
|
||||
if (Theme.isLightMode !== shouldBeLightMode) {
|
||||
Theme.isLightMode = shouldBeLightMode
|
||||
if (typeof SessionData !== "undefined") {
|
||||
SessionData.setLightMode(shouldBeLightMode)
|
||||
if (typeof Theme !== "undefined") {
|
||||
const shouldBeLightMode = (systemColorScheme === 2)
|
||||
if (Theme.isLightMode !== shouldBeLightMode) {
|
||||
Theme.isLightMode = shouldBeLightMode
|
||||
if (typeof SessionData !== "undefined") {
|
||||
SessionData.setLightMode(shouldBeLightMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
systemColorSchemeCheckProcess.running = true
|
||||
}
|
||||
}
|
||||
|
||||
function setLightMode(isLightMode) {
|
||||
@@ -121,15 +132,21 @@ Singleton {
|
||||
}
|
||||
|
||||
function setSystemProfileImage(imagePath) {
|
||||
if (!accountsServiceAvailable || !freedeskAvailable || !dmsService || !dmsService.service) return
|
||||
if (!accountsServiceAvailable) return
|
||||
|
||||
dmsService.service.sendRequest("freedesktop.accounts.setIconFile", { path: imagePath || "" }, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon file:", response.error)
|
||||
} else {
|
||||
Qt.callLater(() => getSystemProfileImage())
|
||||
}
|
||||
})
|
||||
if (freedeskAvailable && dmsService && dmsService.service) {
|
||||
dmsService.service.sendRequest("freedesktop.accounts.setIconFile", { path: imagePath || "" }, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon file:", response.error)
|
||||
} else {
|
||||
Qt.callLater(() => getSystemProfileImage())
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const path = imagePath || ""
|
||||
systemProfileSetProcess.command = ["bash", "-c", `dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$(id -u) org.freedesktop.Accounts.User.SetIconFile string:'${path}'`]
|
||||
systemProfileSetProcess.running = true
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -144,10 +161,23 @@ Singleton {
|
||||
dmsService.service.capabilitiesChanged.connect(onDMSCapabilitiesChanged)
|
||||
if (dmsService.service.isConnected) {
|
||||
onDMSConnected()
|
||||
} else {
|
||||
Qt.callLater(checkFallback)
|
||||
}
|
||||
} else {
|
||||
Qt.callLater(checkFallback)
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("PortalService: Failed to initialize DMS connection:", e)
|
||||
Qt.callLater(checkFallback)
|
||||
}
|
||||
}
|
||||
|
||||
function checkFallback() {
|
||||
if (!freedeskAvailable) {
|
||||
console.log("PortalService: DMS not available, using fallback methods")
|
||||
checkAccountsServiceFallback()
|
||||
checkSettingsPortalFallback()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +231,14 @@ Singleton {
|
||||
})
|
||||
}
|
||||
|
||||
// For greeter use alternate method to get user profile image - since we dont run with dms
|
||||
function checkAccountsServiceFallback() {
|
||||
accountsServiceCheckProcess.running = true
|
||||
}
|
||||
|
||||
function checkSettingsPortalFallback() {
|
||||
settingsPortalCheckProcess.running = true
|
||||
}
|
||||
|
||||
function getGreeterUserProfileImage(username) {
|
||||
if (!username) {
|
||||
profileImage = ""
|
||||
@@ -214,6 +251,54 @@ Singleton {
|
||||
userProfileCheckProcess.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: accountsServiceCheckProcess
|
||||
command: ["bash", "-c", "dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts.FindUserByName string:\"$USER\""]
|
||||
running: false
|
||||
|
||||
onExited: exitCode => {
|
||||
accountsServiceAvailable = (exitCode === 0)
|
||||
if (accountsServiceAvailable) {
|
||||
getSystemProfileImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: systemProfileCheckProcess
|
||||
command: ["bash", "-c", "dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$(id -u) org.freedesktop.DBus.Properties.Get string:org.freedesktop.Accounts.User string:IconFile"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const match = text.match(/string\s+"([^"]+)"/)
|
||||
if (match && match[1] && match[1] !== "" && match[1] !== "/var/lib/AccountsService/icons/") {
|
||||
systemProfileImage = match[1]
|
||||
if (!profileImage || profileImage === "") {
|
||||
profileImage = systemProfileImage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
systemProfileImage = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: systemProfileSetProcess
|
||||
running: false
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode === 0) {
|
||||
getSystemProfileImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: userProfileCheckProcess
|
||||
command: []
|
||||
@@ -237,6 +322,50 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: settingsPortalCheckProcess
|
||||
command: ["gdbus", "call", "--session", "--dest", "org.freedesktop.portal.Desktop", "--object-path", "/org/freedesktop/portal/desktop", "--method", "org.freedesktop.portal.Settings.ReadOne", "org.freedesktop.appearance", "color-scheme"]
|
||||
running: false
|
||||
|
||||
onExited: exitCode => {
|
||||
settingsPortalAvailable = (exitCode === 0)
|
||||
if (settingsPortalAvailable) {
|
||||
getSystemColorScheme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: systemColorSchemeCheckProcess
|
||||
command: ["gdbus", "call", "--session", "--dest", "org.freedesktop.portal.Desktop", "--object-path", "/org/freedesktop/portal/desktop", "--method", "org.freedesktop.portal.Settings.ReadOne", "org.freedesktop.appearance", "color-scheme"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const match = text.match(/uint32 (\d+)/)
|
||||
if (match && match[1]) {
|
||||
systemColorScheme = parseInt(match[1])
|
||||
|
||||
if (typeof Theme !== "undefined") {
|
||||
const shouldBeLightMode = (systemColorScheme === 2)
|
||||
if (Theme.isLightMode !== shouldBeLightMode) {
|
||||
Theme.isLightMode = shouldBeLightMode
|
||||
if (typeof SessionData !== "undefined") {
|
||||
SessionData.setLightMode(shouldBeLightMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
systemColorScheme = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "profile"
|
||||
|
||||
|
||||
@@ -311,17 +311,25 @@ Singleton {
|
||||
}
|
||||
|
||||
function initializeDMSConnection() {
|
||||
if (!socketPath || socketPath.length === 0) {
|
||||
console.log("SessionService: DMS_SOCKET not set, using fallback")
|
||||
initFallbackLoginctl()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
dmsService = Qt.createQmlObject('import QtQuick; import qs.Services; QtObject { property var service: DMSService }', root)
|
||||
if (dmsService && dmsService.service) {
|
||||
checkCapabilities()
|
||||
dmsService.service.connectionStateChanged.connect(onDMSConnectionStateChanged)
|
||||
dmsService.service.capabilitiesChanged.connect(onDMSCapabilitiesChanged)
|
||||
checkCapabilities()
|
||||
} else {
|
||||
console.warn("SessionService: Failed to get DMS service reference")
|
||||
console.warn("SessionService: Failed to get DMS service reference, using fallback")
|
||||
initFallbackLoginctl()
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("SessionService: Failed to initialize DMS connection:", e)
|
||||
console.warn("SessionService: Failed to initialize DMS connection, using fallback:", e)
|
||||
initFallbackLoginctl()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,12 +346,17 @@ Singleton {
|
||||
}
|
||||
|
||||
function onDMSCapabilitiesChanged() {
|
||||
if (dmsService && dmsService.service && dmsService.service.capabilities.includes("loginctl")) {
|
||||
loginctlAvailable = true
|
||||
if (dmsService.service.isConnected && !stateInitialized) {
|
||||
stateInitialized = true
|
||||
getLoginctlState()
|
||||
subscriptionSocket.connected = true
|
||||
if (dmsService && dmsService.service) {
|
||||
if (dmsService.service.capabilities.includes("loginctl")) {
|
||||
loginctlAvailable = true
|
||||
if (dmsService.service.isConnected && !stateInitialized) {
|
||||
stateInitialized = true
|
||||
getLoginctlState()
|
||||
subscriptionSocket.connected = true
|
||||
}
|
||||
} else if (dmsService.service.capabilities.length > 0 && !loginctlAvailable) {
|
||||
console.log("SessionService: loginctl capability not available in DMS, using fallback")
|
||||
initFallbackLoginctl()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,6 +369,9 @@ Singleton {
|
||||
stateInitialized = true
|
||||
getLoginctlState()
|
||||
subscriptionSocket.connected = true
|
||||
} else if (!loginctlAvailable) {
|
||||
console.log("SessionService: loginctl capability not available in DMS, using fallback")
|
||||
initFallbackLoginctl()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,13 +426,100 @@ Singleton {
|
||||
}
|
||||
|
||||
function lockSession() {
|
||||
if (!loginctlAvailable || !dmsService || !dmsService.service) return
|
||||
if (loginctlAvailable && dmsService && dmsService.service) {
|
||||
dmsService.service.sendRequest("loginctl.lock", null, response => {
|
||||
if (response.error) {
|
||||
console.warn("SessionService: Failed to lock session:", response.error)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
lockSessionFallback.running = true
|
||||
}
|
||||
}
|
||||
|
||||
dmsService.service.sendRequest("loginctl.lock", null, response => {
|
||||
if (response.error) {
|
||||
console.warn("SessionService: Failed to lock session:", response.error)
|
||||
function initFallbackLoginctl() {
|
||||
getSessionPathFallback.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: getSessionPathFallback
|
||||
command: ["gdbus", "call", "--system", "--dest", "org.freedesktop.login1", "--object-path", "/org/freedesktop/login1", "--method", "org.freedesktop.login1.Manager.GetSession", Quickshell.env("XDG_SESSION_ID") || "self"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const match = text.match(/objectpath '([^']+)'/)
|
||||
if (match) {
|
||||
sessionPath = match[1]
|
||||
console.log("SessionService: Found session path (fallback):", sessionPath)
|
||||
checkCurrentLockStateFallback.running = true
|
||||
lockStateMonitorFallback.running = true
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: checkCurrentLockStateFallback
|
||||
command: sessionPath ? ["gdbus", "call", "--system", "--dest", "org.freedesktop.login1", "--object-path", sessionPath, "--method", "org.freedesktop.DBus.Properties.Get", "org.freedesktop.login1.Session", "LockedHint"] : []
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text.includes("true")) {
|
||||
locked = true
|
||||
lockedHint = true
|
||||
sessionLocked()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: lockStateMonitorFallback
|
||||
command: sessionPath ? ["gdbus", "monitor", "--system", "--dest", "org.freedesktop.login1"] : []
|
||||
running: false
|
||||
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
onRead: line => {
|
||||
if (sessionPath && line.includes(sessionPath)) {
|
||||
if (line.includes("org.freedesktop.login1.Session.Lock")) {
|
||||
locked = true
|
||||
lockedHint = true
|
||||
sessionLocked()
|
||||
} else if (line.includes("org.freedesktop.login1.Session.Unlock")) {
|
||||
locked = false
|
||||
lockedHint = false
|
||||
sessionUnlocked()
|
||||
} else if (line.includes("LockedHint") && line.includes("true")) {
|
||||
locked = true
|
||||
lockedHint = true
|
||||
loginctlStateChanged()
|
||||
} else if (line.includes("LockedHint") && line.includes("false")) {
|
||||
locked = false
|
||||
lockedHint = false
|
||||
loginctlStateChanged()
|
||||
}
|
||||
}
|
||||
if (line.includes("PrepareForSleep") && line.includes("true") && SessionData.lockBeforeSuspend) {
|
||||
preparingForSleep = true
|
||||
prepareForSleep()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("SessionService: gdbus monitor fallback failed, exit code:", exitCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: lockSessionFallback
|
||||
command: ["loginctl", "lock-session"]
|
||||
running: false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user