mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
processlist: breakout and de-dupe code, change styles
Also reverts bluetooth pairing modals since quickshell did not approve of the PR
This commit is contained in:
@@ -21,6 +21,7 @@ Singleton {
|
|||||||
property bool nightModeEnabled: false
|
property bool nightModeEnabled: false
|
||||||
property string profileImage: ""
|
property string profileImage: ""
|
||||||
property string weatherLocationOverride: "New York, NY"
|
property string weatherLocationOverride: "New York, NY"
|
||||||
|
property bool weatherLocationOverrideEnabled: false
|
||||||
property bool showFocusedWindow: true
|
property bool showFocusedWindow: true
|
||||||
property bool showWeather: true
|
property bool showWeather: true
|
||||||
property bool showMusic: true
|
property bool showMusic: true
|
||||||
@@ -36,6 +37,9 @@ Singleton {
|
|||||||
property var availableIconThemes: ["System Default"]
|
property var availableIconThemes: ["System Default"]
|
||||||
property string systemDefaultIconTheme: "Adwaita"
|
property string systemDefaultIconTheme: "Adwaita"
|
||||||
property bool useOSLogo: false
|
property bool useOSLogo: false
|
||||||
|
property string osLogoColorOverride: ""
|
||||||
|
property real osLogoBrightness: 0.5
|
||||||
|
property real osLogoContrast: 1.0
|
||||||
|
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
parseSettings(settingsFile.text());
|
parseSettings(settingsFile.text());
|
||||||
@@ -56,6 +60,7 @@ Singleton {
|
|||||||
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false;
|
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false;
|
||||||
profileImage = settings.profileImage !== undefined ? settings.profileImage : "";
|
profileImage = settings.profileImage !== undefined ? settings.profileImage : "";
|
||||||
weatherLocationOverride = settings.weatherLocationOverride !== undefined ? settings.weatherLocationOverride : "New York, NY";
|
weatherLocationOverride = settings.weatherLocationOverride !== undefined ? settings.weatherLocationOverride : "New York, NY";
|
||||||
|
weatherLocationOverrideEnabled = settings.weatherLocationOverrideEnabled !== undefined ? settings.weatherLocationOverrideEnabled : false;
|
||||||
showFocusedWindow = settings.showFocusedWindow !== undefined ? settings.showFocusedWindow : true;
|
showFocusedWindow = settings.showFocusedWindow !== undefined ? settings.showFocusedWindow : true;
|
||||||
showWeather = settings.showWeather !== undefined ? settings.showWeather : true;
|
showWeather = settings.showWeather !== undefined ? settings.showWeather : true;
|
||||||
showMusic = settings.showMusic !== undefined ? settings.showMusic : true;
|
showMusic = settings.showMusic !== undefined ? settings.showMusic : true;
|
||||||
@@ -69,6 +74,9 @@ Singleton {
|
|||||||
networkPreference = settings.networkPreference !== undefined ? settings.networkPreference : "auto";
|
networkPreference = settings.networkPreference !== undefined ? settings.networkPreference : "auto";
|
||||||
iconTheme = settings.iconTheme !== undefined ? settings.iconTheme : "System Default";
|
iconTheme = settings.iconTheme !== undefined ? settings.iconTheme : "System Default";
|
||||||
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false;
|
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false;
|
||||||
|
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : "";
|
||||||
|
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5;
|
||||||
|
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1.0;
|
||||||
applyStoredTheme();
|
applyStoredTheme();
|
||||||
detectAvailableIconThemes();
|
detectAvailableIconThemes();
|
||||||
updateGtkIconTheme(iconTheme);
|
updateGtkIconTheme(iconTheme);
|
||||||
@@ -94,6 +102,7 @@ Singleton {
|
|||||||
"nightModeEnabled": nightModeEnabled,
|
"nightModeEnabled": nightModeEnabled,
|
||||||
"profileImage": profileImage,
|
"profileImage": profileImage,
|
||||||
"weatherLocationOverride": weatherLocationOverride,
|
"weatherLocationOverride": weatherLocationOverride,
|
||||||
|
"weatherLocationOverrideEnabled": weatherLocationOverrideEnabled,
|
||||||
"showFocusedWindow": showFocusedWindow,
|
"showFocusedWindow": showFocusedWindow,
|
||||||
"showWeather": showWeather,
|
"showWeather": showWeather,
|
||||||
"showMusic": showMusic,
|
"showMusic": showMusic,
|
||||||
@@ -106,7 +115,10 @@ Singleton {
|
|||||||
"spotlightLauncherViewMode": spotlightLauncherViewMode,
|
"spotlightLauncherViewMode": spotlightLauncherViewMode,
|
||||||
"networkPreference": networkPreference,
|
"networkPreference": networkPreference,
|
||||||
"iconTheme": iconTheme,
|
"iconTheme": iconTheme,
|
||||||
"useOSLogo": useOSLogo
|
"useOSLogo": useOSLogo,
|
||||||
|
"osLogoColorOverride": osLogoColorOverride,
|
||||||
|
"osLogoBrightness": osLogoBrightness,
|
||||||
|
"osLogoContrast": osLogoContrast
|
||||||
}, null, 2));
|
}, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +288,11 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setWeatherLocationOverrideEnabled(enabled) {
|
||||||
|
weatherLocationOverrideEnabled = enabled;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// Network preference setter
|
// Network preference setter
|
||||||
function setNetworkPreference(preference) {
|
function setNetworkPreference(preference) {
|
||||||
networkPreference = preference;
|
networkPreference = preference;
|
||||||
@@ -386,6 +403,21 @@ gtk-application-prefer-dark-theme=true`;
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setOSLogoColorOverride(color) {
|
||||||
|
osLogoColorOverride = color;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOSLogoBrightness(brightness) {
|
||||||
|
osLogoBrightness = brightness;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOSLogoContrast(contrast) {
|
||||||
|
osLogoContrast = contrast;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: loadSettings()
|
Component.onCompleted: loadSettings()
|
||||||
onShowSystemResourcesChanged: {
|
onShowSystemResourcesChanged: {
|
||||||
if (typeof SystemMonitorService !== 'undefined')
|
if (typeof SystemMonitorService !== 'undefined')
|
||||||
|
|||||||
@@ -1,372 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import Quickshell.Bluetooth
|
|
||||||
import qs.Common
|
|
||||||
import qs.Services
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool bluetoothPairingDialogVisible: BluetoothService.pairingDialogVisible
|
|
||||||
property int pairingType: BluetoothService.pairingType
|
|
||||||
property int passkey: BluetoothService.pendingPasskey
|
|
||||||
property string deviceAddress: BluetoothService.pendingDeviceAddress
|
|
||||||
property alias inputText: pairingInput.text
|
|
||||||
|
|
||||||
visible: bluetoothPairingDialogVisible
|
|
||||||
WlrLayershell.layer: WlrLayershell.Overlay
|
|
||||||
WlrLayershell.exclusiveZone: -1
|
|
||||||
WlrLayershell.keyboardFocus: bluetoothPairingDialogVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
|
||||||
color: "transparent"
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
console.log("BluetoothPairingDialog: Showing dialog for device:", deviceAddress, "name:", BluetoothService.pendingDeviceName, "type:", pairingType);
|
|
||||||
pairingInput.enabled = true;
|
|
||||||
BluetoothService.inputText = "";
|
|
||||||
Qt.callLater(function() {
|
|
||||||
if (pairingType === BluetoothPairingRequestType.PinCode || pairingType === BluetoothPairingRequestType.Passkey)
|
|
||||||
pairingInput.forceActiveFocus();
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
pairingInput.enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: true
|
|
||||||
left: true
|
|
||||||
right: true
|
|
||||||
bottom: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.5)
|
|
||||||
opacity: bluetoothPairingDialogVisible ? 1 : 0
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
pairingInput.enabled = false;
|
|
||||||
BluetoothService.rejectPairing();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.mediumDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: Math.min(400, parent.width - Theme.spacingL * 2)
|
|
||||||
height: Math.min(contentColumn.implicitHeight + Theme.spacingL * 2, parent.height - Theme.spacingL * 2)
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: Theme.surfaceContainer
|
|
||||||
radius: Theme.cornerRadiusLarge
|
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
|
||||||
border.width: 1
|
|
||||||
opacity: bluetoothPairingDialogVisible ? 1 : 0
|
|
||||||
scale: bluetoothPairingDialogVisible ? 1 : 0.9
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
// Prevent propagation to background
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: contentColumn
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingL
|
|
||||||
spacing: Theme.spacingL
|
|
||||||
|
|
||||||
// Header
|
|
||||||
Row {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "bluetooth"
|
|
||||||
size: Theme.iconSize
|
|
||||||
color: Theme.primary
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
width: parent.width - 40 - Theme.spacingM - Theme.iconSize
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Bluetooth Pairing"
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: BluetoothService.pendingDeviceName || deviceAddress || "Unknown Device"
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
|
||||||
width: parent.width
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: deviceAddress || ""
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
|
||||||
font.family: "monospace"
|
|
||||||
visible: deviceAddress && deviceAddress !== BluetoothService.pendingDeviceName
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DankActionButton {
|
|
||||||
iconName: "close"
|
|
||||||
iconSize: Theme.iconSize - 4
|
|
||||||
iconColor: Theme.surfaceText
|
|
||||||
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
|
|
||||||
onClicked: {
|
|
||||||
pairingInput.enabled = false;
|
|
||||||
BluetoothService.rejectPairing();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dynamic content based on pairing type
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
// Authorization
|
|
||||||
Text {
|
|
||||||
text: "Allow pairing with this device?"
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
visible: pairingType === BluetoothPairingRequestType.Authorization
|
|
||||||
}
|
|
||||||
|
|
||||||
// Service Authorization
|
|
||||||
Text {
|
|
||||||
text: "Allow service connection from this device?"
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
visible: pairingType === BluetoothPairingRequestType.ServiceAuthorization
|
|
||||||
}
|
|
||||||
|
|
||||||
// Confirmation
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 80
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08)
|
|
||||||
border.color: Theme.primary
|
|
||||||
border.width: 1
|
|
||||||
visible: pairingType === BluetoothPairingRequestType.Confirmation
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Confirm this passkey matches on both devices:"
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: passkey.toString().padStart(6, '0')
|
|
||||||
font.pixelSize: Theme.fontSizeXXLarge
|
|
||||||
color: Theme.primary
|
|
||||||
font.weight: Font.Bold
|
|
||||||
font.family: "monospace"
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// PIN Code or Passkey Input
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
visible: pairingType === BluetoothPairingRequestType.PinCode || pairingType === BluetoothPairingRequestType.Passkey
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: pairingType === BluetoothPairingRequestType.PinCode ? "Enter PIN code for this device:" : "Enter 6-digit passkey shown on other device:"
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.surfaceText
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 50
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
|
|
||||||
border.color: pairingInput.activeFocus ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
|
||||||
border.width: pairingInput.activeFocus ? 2 : 1
|
|
||||||
|
|
||||||
DankTextField {
|
|
||||||
id: pairingInput
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
textColor: Theme.surfaceText
|
|
||||||
text: BluetoothService.inputText
|
|
||||||
enabled: bluetoothPairingDialogVisible
|
|
||||||
placeholderText: pairingType === BluetoothPairingRequestType.PinCode ? "e.g., 0000 or 1234" : "123456"
|
|
||||||
backgroundColor: "transparent"
|
|
||||||
normalBorderColor: "transparent"
|
|
||||||
focusedBorderColor: "transparent"
|
|
||||||
inputMethodHints: pairingType === BluetoothPairingRequestType.Passkey ? Qt.ImhDigitsOnly : Qt.ImhNone
|
|
||||||
onTextEdited: {
|
|
||||||
// For passkey, limit to 6 digits only
|
|
||||||
if (pairingType === BluetoothPairingRequestType.Passkey) {
|
|
||||||
var filtered = text.replace(/[^0-9]/g, '').substring(0, 6);
|
|
||||||
if (text !== filtered) {
|
|
||||||
text = filtered;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BluetoothService.inputText = text;
|
|
||||||
}
|
|
||||||
onAccepted: {
|
|
||||||
if (text.length > 0)
|
|
||||||
BluetoothService.acceptPairing();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
Row {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: (parent.width - Theme.spacingM) / 2
|
|
||||||
height: 40
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: rejectArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
|
|
||||||
border.color: Theme.error
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "Cancel"
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.error
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: rejectArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: BluetoothService.rejectPairing()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: (parent.width - Theme.spacingM) / 2
|
|
||||||
height: 40
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: acceptArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
|
||||||
border.color: Theme.primary
|
|
||||||
border.width: 1
|
|
||||||
opacity: {
|
|
||||||
// Authorization/Confirmation/ServiceAuthorization always enabled
|
|
||||||
if (pairingType <= BluetoothPairingRequestType.Confirmation || pairingType === BluetoothPairingRequestType.ServiceAuthorization)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// PIN/Passkey need input
|
|
||||||
return BluetoothService.inputText.length > 0 ? 1 : 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: {
|
|
||||||
switch (pairingType) {
|
|
||||||
case BluetoothPairingRequestType.Authorization:
|
|
||||||
return "Accept";
|
|
||||||
case BluetoothPairingRequestType.Confirmation:
|
|
||||||
return "Confirm";
|
|
||||||
case BluetoothPairingRequestType.ServiceAuthorization:
|
|
||||||
return "Allow";
|
|
||||||
case BluetoothPairingRequestType.PinCode:
|
|
||||||
return "Pair";
|
|
||||||
case BluetoothPairingRequestType.Passkey:
|
|
||||||
return "Enter";
|
|
||||||
default:
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.primary
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: acceptArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
enabled: pairingType <= BluetoothPairingRequestType.Confirmation || pairingType === BluetoothPairingRequestType.ServiceAuthorization || BluetoothService.inputText.length > 0
|
|
||||||
onClicked: BluetoothService.acceptPairing()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.mediumDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on scale {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.mediumDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -25,8 +25,8 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 60
|
height: 60
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: bluetoothToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (BluetoothService.enabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12))
|
color: bluetoothToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (BluetoothService.adapter && BluetoothService.adapter.enabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12))
|
||||||
border.color: BluetoothService.enabled ? Theme.primary : "transparent"
|
border.color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : "transparent"
|
||||||
border.width: 2
|
border.width: 2
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -38,7 +38,7 @@ Item {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
size: Theme.iconSizeLarge
|
size: Theme.iconSizeLarge
|
||||||
color: BluetoothService.enabled ? Theme.primary : Theme.surfaceText
|
color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,12 +49,12 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
text: "Bluetooth"
|
text: "Bluetooth"
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
color: BluetoothService.enabled ? Theme.primary : Theme.surfaceText
|
color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : Theme.surfaceText
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: BluetoothService.enabled ? "Enabled" : "Disabled"
|
text: BluetoothService.adapter && BluetoothService.adapter.enabled ? "Enabled" : "Disabled"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,11 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
enabled: !BluetoothService.operationInProgress
|
cursorShape: Qt.PointingHandCursor
|
||||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.BusyCursor
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
BluetoothService.toggleAdapter();
|
if (BluetoothService.adapter) {
|
||||||
|
BluetoothService.adapter.enabled = !BluetoothService.adapter.enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
visible: BluetoothService.enabled
|
visible: BluetoothService.adapter && BluetoothService.adapter.enabled
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Paired Devices"
|
text: "Paired Devices"
|
||||||
@@ -90,7 +91,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: BluetoothService.devices ? BluetoothService.devices.values.filter((dev) => {
|
model: BluetoothService.adapter && BluetoothService.adapter.devices ? BluetoothService.adapter.devices.values.filter((dev) => {
|
||||||
return dev && (dev.paired || dev.trusted);
|
return dev && (dev.paired || dev.trusted);
|
||||||
}) : []
|
}) : []
|
||||||
|
|
||||||
@@ -223,7 +224,7 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
visible: BluetoothService.enabled
|
visible: BluetoothService.adapter && BluetoothService.adapter.enabled
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -255,7 +256,7 @@ Item {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: BluetoothService.discovering ? "stop" : "bluetooth_searching"
|
name: BluetoothService.adapter && BluetoothService.adapter.discovering ? "stop" : "bluetooth_searching"
|
||||||
size: Theme.iconSize - 4
|
size: Theme.iconSize - 4
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -264,7 +265,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: scanText
|
id: scanText
|
||||||
|
|
||||||
text: BluetoothService.discovering ? "Stop Scanning" : "Start Scanning"
|
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? "Stop Scanning" : "Start Scanning"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -278,10 +279,11 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
enabled: !BluetoothService.operationInProgress
|
cursorShape: Qt.PointingHandCursor
|
||||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.BusyCursor
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
BluetoothService.toggleDiscovery();
|
if (BluetoothService.adapter) {
|
||||||
|
BluetoothService.adapter.discovering = !BluetoothService.adapter.discovering;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,12 +291,56 @@ Item {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: noteColumn.implicitHeight + Theme.spacingM * 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.08)
|
||||||
|
border.color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.2)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: noteColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingM
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "info"
|
||||||
|
size: Theme.iconSize - 2
|
||||||
|
color: Theme.warning
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Pairing Limitation"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.warning
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Quickshell does not support pairing devices that require pin or confirmation."
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8)
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: {
|
model: {
|
||||||
if (!BluetoothService.discovering || !BluetoothService.devices)
|
if (!BluetoothService.adapter || !BluetoothService.adapter.discovering || !Bluetooth.devices)
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
var filtered = BluetoothService.devices.values.filter((dev) => {
|
var filtered = Bluetooth.devices.values.filter((dev) => {
|
||||||
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
||||||
});
|
});
|
||||||
return BluetoothService.sortDevices(filtered);
|
return BluetoothService.sortDevices(filtered);
|
||||||
@@ -494,10 +540,10 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
visible: {
|
visible: {
|
||||||
if (!BluetoothService.discovering || !BluetoothService.devices)
|
if (!BluetoothService.adapter || !BluetoothService.adapter.discovering || !Bluetooth.devices)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var availableCount = BluetoothService.devices.values.filter((dev) => {
|
var availableCount = Bluetooth.devices.values.filter((dev) => {
|
||||||
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
@@ -548,14 +594,14 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
visible: {
|
visible: {
|
||||||
if (!BluetoothService.devices)
|
if (!BluetoothService.adapter || !Bluetooth.devices)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var availableCount = BluetoothService.devices.values.filter((dev) => {
|
var availableCount = Bluetooth.devices.values.filter((dev) => {
|
||||||
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
return dev && !dev.paired && !dev.pairing && !dev.blocked && (dev.signalStrength === undefined || dev.signalStrength > 0);
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
return availableCount === 0 && !BluetoothService.discovering;
|
return availableCount === 0 && !BluetoothService.adapter.discovering;
|
||||||
}
|
}
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
466
Modules/ProcessList/PerformanceTab.qml
Normal file
466
Modules/ProcessList/PerformanceTab.qml
Normal file
@@ -0,0 +1,466 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
function formatNetworkSpeed(bytesPerSec) {
|
||||||
|
if (bytesPerSec < 1024)
|
||||||
|
return bytesPerSec.toFixed(0) + " B/s";
|
||||||
|
else if (bytesPerSec < 1024 * 1024)
|
||||||
|
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
|
||||||
|
else if (bytesPerSec < 1024 * 1024 * 1024)
|
||||||
|
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
|
||||||
|
else
|
||||||
|
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(1) + " GB/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDiskSpeed(bytesPerSec) {
|
||||||
|
if (bytesPerSec < 1024 * 1024)
|
||||||
|
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
|
||||||
|
else if (bytesPerSec < 1024 * 1024 * 1024)
|
||||||
|
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
|
||||||
|
else
|
||||||
|
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(1) + " GB/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 200
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.04)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.06)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingM
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: 32
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "CPU"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 80
|
||||||
|
height: 24
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalCpuUsage.toFixed(1) + "%"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width - 280
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.cpuCount + " cores"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - 40
|
||||||
|
clip: true
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ProcessMonitorService.perCoreCpuUsage.length
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: 20
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "C" + index
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
width: 24
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width - 80
|
||||||
|
height: 6
|
||||||
|
radius: 3
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width * Math.min(1, ProcessMonitorService.perCoreCpuUsage[index] / 100)
|
||||||
|
height: parent.height
|
||||||
|
radius: parent.radius
|
||||||
|
color: {
|
||||||
|
const usage = ProcessMonitorService.perCoreCpuUsage[index];
|
||||||
|
if (usage > 80)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (usage > 60)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.perCoreCpuUsage[index] ? ProcessMonitorService.perCoreCpuUsage[index].toFixed(0) + "%" : "0%"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: 32
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.04)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.06)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
anchors.margins: Theme.spacingM
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Memory"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.formatSystemMemory(ProcessMonitorService.usedMemoryKB) + " / " + ProcessMonitorService.formatSystemMemory(ProcessMonitorService.totalMemoryKB)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: Theme.spacingL
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 4
|
||||||
|
width: 200
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 16
|
||||||
|
radius: 8
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: ProcessMonitorService.totalMemoryKB > 0 ? parent.width * (ProcessMonitorService.usedMemoryKB / ProcessMonitorService.totalMemoryKB) : 0
|
||||||
|
height: parent.height
|
||||||
|
radius: parent.radius
|
||||||
|
color: {
|
||||||
|
const usage = ProcessMonitorService.totalMemoryKB > 0 ? (ProcessMonitorService.usedMemoryKB / ProcessMonitorService.totalMemoryKB) : 0;
|
||||||
|
if (usage > 0.9)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (usage > 0.7)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalMemoryKB > 0 ? ((ProcessMonitorService.usedMemoryKB / ProcessMonitorService.totalMemoryKB) * 100).toFixed(1) + "% used" : "No data"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: Theme.spacingL
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Swap"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalSwapKB > 0 ?
|
||||||
|
ProcessMonitorService.formatSystemMemory(ProcessMonitorService.usedSwapKB) + " / " + ProcessMonitorService.formatSystemMemory(ProcessMonitorService.totalSwapKB) :
|
||||||
|
"No swap configured"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: Theme.spacingL
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 4
|
||||||
|
width: 200
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 16
|
||||||
|
radius: 8
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: ProcessMonitorService.totalSwapKB > 0 ? parent.width * (ProcessMonitorService.usedSwapKB / ProcessMonitorService.totalSwapKB) : 0
|
||||||
|
height: parent.height
|
||||||
|
radius: parent.radius
|
||||||
|
color: {
|
||||||
|
if (!ProcessMonitorService.totalSwapKB) return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3);
|
||||||
|
const usage = ProcessMonitorService.usedSwapKB / ProcessMonitorService.totalSwapKB;
|
||||||
|
if (usage > 0.9) return Theme.error;
|
||||||
|
if (usage > 0.7) return Theme.warning;
|
||||||
|
return Theme.info;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalSwapKB > 0 ? ((ProcessMonitorService.usedSwapKB / ProcessMonitorService.totalSwapKB) * 100).toFixed(1) + "% used" : "Not available"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: 80
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - Theme.spacingM) / 2
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.04)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.06)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Network"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "↓"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.info
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: formatNetworkSpeed(ProcessMonitorService.networkRxRate)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "↑"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.error
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: formatNetworkSpeed(ProcessMonitorService.networkTxRate)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - Theme.spacingM) / 2
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.04)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.06)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Disk"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "R"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.primary
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: formatDiskSpeed(ProcessMonitorService.diskReadRate)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "W"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.warning
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: formatDiskSpeed(ProcessMonitorService.diskWriteRate)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
320
Modules/ProcessList/ProcessContextMenu.qml
Normal file
320
Modules/ProcessList/ProcessContextMenu.qml
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: processContextMenuWindow
|
||||||
|
|
||||||
|
property var processData: null
|
||||||
|
property bool menuVisible: false
|
||||||
|
|
||||||
|
function show(x, y) {
|
||||||
|
const menuWidth = 180;
|
||||||
|
const menuHeight = menuColumn.implicitHeight + Theme.spacingS * 2;
|
||||||
|
const screenWidth = processContextMenuWindow.screen ? processContextMenuWindow.screen.width : 1920;
|
||||||
|
const screenHeight = processContextMenuWindow.screen ? processContextMenuWindow.screen.height : 1080;
|
||||||
|
let finalX = x;
|
||||||
|
let finalY = y;
|
||||||
|
if (x + menuWidth > screenWidth - 20)
|
||||||
|
finalX = x - menuWidth;
|
||||||
|
|
||||||
|
if (y + menuHeight > screenHeight - 20)
|
||||||
|
finalY = y - menuHeight;
|
||||||
|
|
||||||
|
finalX = Math.max(20, finalX);
|
||||||
|
finalY = Math.max(20, finalY);
|
||||||
|
processContextMenu.x = finalX;
|
||||||
|
processContextMenu.y = finalY;
|
||||||
|
processContextMenuWindow.menuVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
processContextMenuWindow.menuVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: menuVisible
|
||||||
|
color: "transparent"
|
||||||
|
WlrLayershell.layer: WlrLayershell.Overlay
|
||||||
|
WlrLayershell.exclusiveZone: -1
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: processContextMenu
|
||||||
|
|
||||||
|
width: 180
|
||||||
|
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Theme.popupBackground()
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||||
|
border.width: 1
|
||||||
|
opacity: processContextMenuWindow.menuVisible ? 1 : 0
|
||||||
|
scale: processContextMenuWindow.menuVisible ? 1 : 0.85
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 4
|
||||||
|
anchors.leftMargin: 2
|
||||||
|
anchors.rightMargin: -2
|
||||||
|
anchors.bottomMargin: -4
|
||||||
|
radius: parent.radius
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.15)
|
||||||
|
z: parent.z - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: menuColumn
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingS
|
||||||
|
spacing: 1
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: copyPidArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "Copy PID"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Normal
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: copyPidArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
if (processContextMenuWindow.processData) {
|
||||||
|
copyPidProcess.command = ["wl-copy", processContextMenuWindow.processData.pid.toString()];
|
||||||
|
copyPidProcess.running = true;
|
||||||
|
}
|
||||||
|
processContextMenuWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: copyNameArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "Copy Process Name"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Normal
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: copyNameArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
if (processContextMenuWindow.processData) {
|
||||||
|
let processName = processContextMenuWindow.processData.displayName || processContextMenuWindow.processData.command;
|
||||||
|
copyNameProcess.command = ["wl-copy", processName];
|
||||||
|
copyNameProcess.running = true;
|
||||||
|
}
|
||||||
|
processContextMenuWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width - Theme.spacingS * 2
|
||||||
|
height: 5
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: killArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent"
|
||||||
|
enabled: processContextMenuWindow.processData && processContextMenuWindow.processData.pid > 1000
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "Kill Process"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: parent.enabled ? (killArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||||
|
font.weight: Font.Normal
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: killArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
enabled: parent.enabled
|
||||||
|
onClicked: {
|
||||||
|
if (processContextMenuWindow.processData) {
|
||||||
|
killProcess.command = ["kill", processContextMenuWindow.processData.pid.toString()];
|
||||||
|
killProcess.running = true;
|
||||||
|
}
|
||||||
|
processContextMenuWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: forceKillArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent"
|
||||||
|
enabled: processContextMenuWindow.processData && processContextMenuWindow.processData.pid > 1000
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "Force Kill Process"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: parent.enabled ? (forceKillArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||||
|
font.weight: Font.Normal
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: forceKillArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
enabled: parent.enabled
|
||||||
|
onClicked: {
|
||||||
|
if (processContextMenuWindow.processData) {
|
||||||
|
forceKillProcess.command = ["kill", "-9", processContextMenuWindow.processData.pid.toString()];
|
||||||
|
forceKillProcess.running = true;
|
||||||
|
}
|
||||||
|
processContextMenuWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
z: -1
|
||||||
|
onClicked: {
|
||||||
|
processContextMenuWindow.menuVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: copyPidProcess
|
||||||
|
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: copyNameProcess
|
||||||
|
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: killProcess
|
||||||
|
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: forceKillProcess
|
||||||
|
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
177
Modules/ProcessList/ProcessListDropdown.qml
Normal file
177
Modules/ProcessList/ProcessListDropdown.qml
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Effects
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: processListDropdown
|
||||||
|
|
||||||
|
property bool isVisible: false
|
||||||
|
property var parentWidget: null
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
isVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
isVisible = true;
|
||||||
|
ProcessMonitorService.updateSystemInfo();
|
||||||
|
ProcessMonitorService.updateProcessList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
if (isVisible)
|
||||||
|
hide();
|
||||||
|
else
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: isVisible
|
||||||
|
onIsVisibleChanged: {
|
||||||
|
ProcessMonitorService.enableMonitoring(isVisible);
|
||||||
|
}
|
||||||
|
implicitWidth: 600
|
||||||
|
implicitHeight: 600
|
||||||
|
WlrLayershell.layer: WlrLayershell.Overlay
|
||||||
|
WlrLayershell.exclusiveZone: -1
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: processListDropdown.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: dropdownContent
|
||||||
|
|
||||||
|
width: Math.min(600, Screen.width - Theme.spacingL * 2)
|
||||||
|
height: Math.min(600, Screen.height - Theme.barHeight - Theme.spacingS * 2)
|
||||||
|
x: Math.max(Theme.spacingL, Screen.width - width - Theme.spacingL)
|
||||||
|
y: Theme.barHeight + Theme.spacingXS
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Theme.popupBackground()
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||||
|
border.width: 1
|
||||||
|
clip: true
|
||||||
|
opacity: processListDropdown.isVisible ? 1 : 0
|
||||||
|
layer.enabled: true
|
||||||
|
transform: [
|
||||||
|
Scale {
|
||||||
|
id: scaleTransform
|
||||||
|
|
||||||
|
origin.x: dropdownContent.width * 0.85
|
||||||
|
origin.y: 0
|
||||||
|
xScale: processListDropdown.isVisible ? 1 : 0.95
|
||||||
|
yScale: processListDropdown.isVisible ? 1 : 0.8
|
||||||
|
|
||||||
|
Behavior on xScale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on yScale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
Translate {
|
||||||
|
id: translateTransform
|
||||||
|
|
||||||
|
x: processListDropdown.isVisible ? 0 : 20
|
||||||
|
y: processListDropdown.isVisible ? 0 : -30
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on y {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
SystemOverview {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessListView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
contextMenu: processContextMenuWindow
|
||||||
|
processContextMenuWindow: processContextMenuWindow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
shadowVerticalOffset: 8
|
||||||
|
shadowBlur: 1
|
||||||
|
shadowColor: Qt.rgba(0, 0, 0, 0.15)
|
||||||
|
shadowOpacity: processListDropdown.isVisible ? 0.15 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessContextMenu {
|
||||||
|
id: processContextMenuWindow
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
210
Modules/ProcessList/ProcessListItem.qml
Normal file
210
Modules/ProcessList/ProcessListItem.qml
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: processItem
|
||||||
|
|
||||||
|
property var process: null
|
||||||
|
property var contextMenu: null
|
||||||
|
property var processContextMenuWindow: null
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
|
||||||
|
border.color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: processMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onClicked: (mouse) => {
|
||||||
|
if (mouse.button === Qt.RightButton) {
|
||||||
|
if (process && process.pid > 0 && contextMenu) {
|
||||||
|
contextMenu.processData = process;
|
||||||
|
let globalPos = processMouseArea.mapToGlobal(mouse.x, mouse.y);
|
||||||
|
contextMenu.show(globalPos.x, globalPos.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onPressAndHold: {
|
||||||
|
if (process && process.pid > 0 && processContextMenuWindow) {
|
||||||
|
processContextMenuWindow.processData = process;
|
||||||
|
let globalPos = processMouseArea.mapToGlobal(processMouseArea.width / 2, processMouseArea.height / 2);
|
||||||
|
processContextMenuWindow.show(globalPos.x, globalPos.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 8
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: processIcon
|
||||||
|
|
||||||
|
name: ProcessMonitorService.getProcessIcon(process ? process.command : "")
|
||||||
|
size: Theme.iconSize - 4
|
||||||
|
color: {
|
||||||
|
if (process && process.cpu > 80)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (process && process.cpu > 50)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
opacity: 0.8
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: process ? process.displayName : ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: 250
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.left: processIcon.right
|
||||||
|
anchors.leftMargin: 8
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: cpuBadge
|
||||||
|
|
||||||
|
width: 80
|
||||||
|
height: 20
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: {
|
||||||
|
if (process && process.cpu > 80)
|
||||||
|
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
|
||||||
|
|
||||||
|
if (process && process.cpu > 50)
|
||||||
|
return Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.12);
|
||||||
|
|
||||||
|
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08);
|
||||||
|
}
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 194
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.formatCpuUsage(process ? process.cpu : 0)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: {
|
||||||
|
if (process && process.cpu > 80)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (process && process.cpu > 50)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: memoryBadge
|
||||||
|
|
||||||
|
width: 80
|
||||||
|
height: 20
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: {
|
||||||
|
if (process && process.memoryKB > 1024 * 1024)
|
||||||
|
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
|
||||||
|
|
||||||
|
if (process && process.memoryKB > 512 * 1024)
|
||||||
|
return Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.12);
|
||||||
|
|
||||||
|
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08);
|
||||||
|
}
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 102
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.formatMemoryUsage(process ? process.memoryKB : 0)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: {
|
||||||
|
if (process && process.memoryKB > 1024 * 1024)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (process && process.memoryKB > 512 * 1024)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: process ? process.pid.toString() : ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
width: 50
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 40
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: menuButton
|
||||||
|
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: menuButtonArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08) : "transparent"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "more_vert"
|
||||||
|
size: Theme.iconSize - 2
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.6
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: menuButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
if (process && process.pid > 0 && processContextMenuWindow) {
|
||||||
|
processContextMenuWindow.processData = process;
|
||||||
|
let globalPos = menuButtonArea.mapToGlobal(menuButtonArea.width / 2, menuButtonArea.height);
|
||||||
|
processContextMenuWindow.show(globalPos.x, globalPos.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
390
Modules/ProcessList/ProcessListPopup.qml
Normal file
390
Modules/ProcessList/ProcessListPopup.qml
Normal file
@@ -0,0 +1,390 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Effects
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: processListPopup
|
||||||
|
|
||||||
|
property bool isVisible: false
|
||||||
|
property int currentTab: 0
|
||||||
|
property var tabNames: ["Processes", "Performance", "System"]
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
processListPopup.isVisible = true;
|
||||||
|
ProcessMonitorService.updateSystemInfo();
|
||||||
|
ProcessMonitorService.updateProcessList();
|
||||||
|
SystemMonitorService.enableDetailedMonitoring(true);
|
||||||
|
SystemMonitorService.updateSystemInfo();
|
||||||
|
UserInfoService.getUptime();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
processListPopup.isVisible = false;
|
||||||
|
SystemMonitorService.enableDetailedMonitoring(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
if (processListPopup.isVisible)
|
||||||
|
hide();
|
||||||
|
else
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayershell.Overlay
|
||||||
|
WlrLayershell.exclusiveZone: -1
|
||||||
|
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
|
WlrLayershell.namespace: "quickshell-processlist"
|
||||||
|
visible: isVisible
|
||||||
|
color: "transparent"
|
||||||
|
onIsVisibleChanged: {
|
||||||
|
ProcessMonitorService.enableMonitoring(isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.4)
|
||||||
|
opacity: processListPopup.isVisible ? 1 : 0
|
||||||
|
visible: processListPopup.isVisible
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: processListPopup.isVisible
|
||||||
|
onClicked: processListPopup.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: mainContainer
|
||||||
|
|
||||||
|
width: 900
|
||||||
|
height: 680
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: Theme.popupBackground()
|
||||||
|
radius: Theme.cornerRadiusXLarge
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||||
|
border.width: 1
|
||||||
|
layer.enabled: true
|
||||||
|
opacity: processListPopup.isVisible ? 1 : 0
|
||||||
|
scale: processListPopup.isVisible ? 1 : 0.96
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
Keys.onPressed: function(event) {
|
||||||
|
if (event.key === Qt.Key_Escape) {
|
||||||
|
processListPopup.hide();
|
||||||
|
event.accepted = true;
|
||||||
|
} else if (event.key === Qt.Key_1) {
|
||||||
|
currentTab = 0;
|
||||||
|
event.accepted = true;
|
||||||
|
} else if (event.key === Qt.Key_2) {
|
||||||
|
currentTab = 1;
|
||||||
|
event.accepted = true;
|
||||||
|
} else if (event.key === Qt.Key_3) {
|
||||||
|
currentTab = 2;
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingXL
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
Row {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 40
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "System Monitor"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge + 4
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width - 280
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: ProcessMonitorService.processes.length + " processes"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
width: Math.min(implicitWidth, 120)
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 52
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.04)
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.06)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: tabNames
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - (tabNames.length - 1) * 2) / tabNames.length
|
||||||
|
height: 44
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: currentTab === index ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : (tabMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent")
|
||||||
|
border.color: currentTab === index ? Theme.primary : "transparent"
|
||||||
|
border.width: currentTab === index ? 1 : 0
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return "list_alt";
|
||||||
|
case 1:
|
||||||
|
return "analytics";
|
||||||
|
case 2:
|
||||||
|
return "settings";
|
||||||
|
default:
|
||||||
|
return "tab";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size: Theme.iconSize - 2
|
||||||
|
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
||||||
|
opacity: currentTab === index ? 1 : 0.7
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: currentTab === index ? Font.Bold : Font.Medium
|
||||||
|
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: tabMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
currentTab = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: processesTab
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: currentTab === 0
|
||||||
|
opacity: currentTab === 0 ? 1 : 0
|
||||||
|
sourceComponent: processesTabComponent
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: performanceTab
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: currentTab === 1
|
||||||
|
opacity: currentTab === 1 ? 1 : 0
|
||||||
|
sourceComponent: performanceTabComponent
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: systemTab
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: currentTab === 2
|
||||||
|
opacity: currentTab === 2 ? 1 : 0
|
||||||
|
sourceComponent: systemTabComponent
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
shadowVerticalOffset: 8
|
||||||
|
shadowBlur: 1
|
||||||
|
shadowColor: Qt.rgba(0, 0, 0, 0.3)
|
||||||
|
shadowOpacity: 0.3
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: processesTabComponent
|
||||||
|
ProcessesTab {
|
||||||
|
contextMenu: processContextMenuWindow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: performanceTabComponent
|
||||||
|
PerformanceTab {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: systemTabComponent
|
||||||
|
SystemTab {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ProcessContextMenu {
|
||||||
|
id: processContextMenuWindow
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
function open() {
|
||||||
|
processListPopup.show();
|
||||||
|
return "PROCESSLIST_OPEN_SUCCESS";
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
processListPopup.hide();
|
||||||
|
return "PROCESSLIST_CLOSE_SUCCESS";
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
processListPopup.toggle();
|
||||||
|
return "PROCESSLIST_TOGGLE_SUCCESS";
|
||||||
|
}
|
||||||
|
|
||||||
|
target: "processlist"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
137
Modules/ProcessList/ProcessListView.qml
Normal file
137
Modules/ProcessList/ProcessListView.qml
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
property var processContextMenuWindow: null
|
||||||
|
property var contextMenu: null
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: columnHeaders
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
anchors.leftMargin: 8
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Process"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0 // Left align with content area
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 80
|
||||||
|
height: 20
|
||||||
|
color: "transparent"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 200 // Slight adjustment to move right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "CPU"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 80
|
||||||
|
height: 20
|
||||||
|
color: "transparent"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 112 // Move right by decreasing rightMargin
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "RAM"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "PID"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
width: 50
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 53 // Move left by increasing rightMargin
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: sortOrderArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08) : "transparent"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 8
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.sortDescending ? "↓" : "↑"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: sortOrderArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: ProcessMonitorService.toggleSortOrder()
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - 24 // Subtract header height
|
||||||
|
clip: true
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: processListView
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
model: ProcessMonitorService.processes
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
delegate: ProcessListItem {
|
||||||
|
process: modelData
|
||||||
|
contextMenu: root.contextMenu
|
||||||
|
processContextMenuWindow: root.contextMenu
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Modules/ProcessList/ProcessesTab.qml
Normal file
22
Modules/ProcessList/ProcessesTab.qml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: processesTab
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
property var contextMenu: null
|
||||||
|
|
||||||
|
SystemOverview {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessListView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
contextMenu: processesTab.contextMenu
|
||||||
|
}
|
||||||
|
}
|
||||||
189
Modules/ProcessList/SystemOverview.qml
Normal file
189
Modules/ProcessList/SystemOverview.qml
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - Theme.spacingM * 2) / 3
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: {
|
||||||
|
if (ProcessMonitorService.sortBy === "cpu")
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
||||||
|
else if (cpuCardMouseArea.containsMouse)
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12);
|
||||||
|
else
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08);
|
||||||
|
}
|
||||||
|
border.color: ProcessMonitorService.sortBy === "cpu" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
|
||||||
|
border.width: ProcessMonitorService.sortBy === "cpu" ? 2 : 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: cpuCardMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: ProcessMonitorService.setSortBy("cpu")
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "CPU"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: ProcessMonitorService.sortBy === "cpu" ? Theme.primary : Theme.secondary
|
||||||
|
opacity: ProcessMonitorService.sortBy === "cpu" ? 1 : 0.8
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalCpuUsage.toFixed(1) + "%"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.cpuCount + " cores"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - Theme.spacingM * 2) / 3
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: {
|
||||||
|
if (ProcessMonitorService.sortBy === "memory")
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
||||||
|
else if (memoryCardMouseArea.containsMouse)
|
||||||
|
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.12);
|
||||||
|
else
|
||||||
|
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.08);
|
||||||
|
}
|
||||||
|
border.color: ProcessMonitorService.sortBy === "memory" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.2)
|
||||||
|
border.width: ProcessMonitorService.sortBy === "memory" ? 2 : 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: memoryCardMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: ProcessMonitorService.setSortBy("memory")
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Memory"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: ProcessMonitorService.sortBy === "memory" ? Theme.primary : Theme.secondary
|
||||||
|
opacity: ProcessMonitorService.sortBy === "memory" ? 1 : 0.8
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.formatSystemMemory(ProcessMonitorService.usedMemoryKB)
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "of " + ProcessMonitorService.formatSystemMemory(ProcessMonitorService.totalMemoryKB)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: (parent.width - Theme.spacingM * 2) / 3
|
||||||
|
height: 80
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: ProcessMonitorService.totalSwapKB > 0 ? Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.08) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.04)
|
||||||
|
border.color: ProcessMonitorService.totalSwapKB > 0 ? Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.2) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.12)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Swap"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: ProcessMonitorService.totalSwapKB > 0 ? Theme.warning : Theme.surfaceText
|
||||||
|
opacity: 0.8
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalSwapKB > 0 ? ProcessMonitorService.formatSystemMemory(ProcessMonitorService.usedSwapKB) : "None"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: ProcessMonitorService.totalSwapKB > 0 ? "of " + ProcessMonitorService.formatSystemMemory(ProcessMonitorService.totalSwapKB) : "No swap configured"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
opacity: 0.7
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
349
Modules/ProcessList/SystemTab.qml
Normal file
349
Modules/ProcessList/SystemTab.qml
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
anchors.fill: parent
|
||||||
|
clip: true
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 200
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.6)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
SystemLogo {
|
||||||
|
width: 80
|
||||||
|
height: 80
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width - 80 - Theme.spacingL
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: SystemMonitorService.hostname
|
||||||
|
font.pixelSize: Theme.fontSizeXLarge
|
||||||
|
font.weight: Font.Light
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: SystemMonitorService.distribution + " • " + SystemMonitorService.architecture + " • " + SystemMonitorService.kernelVersion
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Up " + UserInfoService.uptime + " • Boot: " + SystemMonitorService.bootTime
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Load: " + SystemMonitorService.loadAverage + " • " + SystemMonitorService.processCount + " processes, " + SystemMonitorService.threadCount + " threads"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingXL
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: (parent.width - Theme.spacingXL) / 2
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: SystemMonitorService.cpuModel
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: SystemMonitorService.motherboard
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: (parent.width - Theme.spacingXL) / 2
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: SystemMonitorService.formatMemory(SystemMonitorService.totalMemory) + " Memory"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "BIOS " + SystemMonitorService.biosVersion
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: Math.max(180, diskMountRepeater.count * 28 + 100)
|
||||||
|
radius: Theme.cornerRadiusLarge
|
||||||
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.6)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "storage"
|
||||||
|
size: Theme.iconSize
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Storage & Disks"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "I/O Scheduler: " + SystemMonitorService.scheduler
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
width: parent.width
|
||||||
|
height: Math.max(120, diskMountRepeater.count * 28 + 50)
|
||||||
|
clip: true
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: 24
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Device"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.25
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Mount"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Size"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Used"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Available"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Use%"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.1
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: diskMountRepeater
|
||||||
|
|
||||||
|
model: SystemMonitorService.diskMounts
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 24
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: diskMouseArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.04) : "transparent"
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: diskMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.device
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.25
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.mount
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.size
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.used
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.avail
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
width: parent.width * 0.15
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.percent
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: {
|
||||||
|
const percent = parseInt(modelData.percent);
|
||||||
|
if (percent > 90)
|
||||||
|
return Theme.error;
|
||||||
|
|
||||||
|
if (percent > 75)
|
||||||
|
return Theme.warning;
|
||||||
|
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
width: parent.width * 0.1
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -68,4 +68,106 @@ Column {
|
|||||||
return Prefs.setUseOSLogo(checked);
|
return Prefs.setUseOSLogo(checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
visible: Prefs.useOSLogo
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: Theme.spacingS
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "OS Logo Customization"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Color Override:"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 90
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
width: 120
|
||||||
|
height: 36
|
||||||
|
placeholderText: "#ffffff"
|
||||||
|
text: Prefs.osLogoColorOverride
|
||||||
|
maximumLength: 7
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
topPadding: Theme.spacingS
|
||||||
|
bottomPadding: Theme.spacingS
|
||||||
|
onEditingFinished: {
|
||||||
|
var color = text.trim();
|
||||||
|
if (color === "" || /^#[0-9A-Fa-f]{6}$/.test(color)) {
|
||||||
|
Prefs.setOSLogoColorOverride(color);
|
||||||
|
} else {
|
||||||
|
text = Prefs.osLogoColorOverride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Brightness:"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 90
|
||||||
|
}
|
||||||
|
|
||||||
|
DankSlider {
|
||||||
|
width: 120
|
||||||
|
height: 24
|
||||||
|
minimum: 0
|
||||||
|
maximum: 100
|
||||||
|
value: Math.round(Prefs.osLogoBrightness * 100)
|
||||||
|
unit: ""
|
||||||
|
showValue: false
|
||||||
|
onSliderValueChanged: (newValue) => {
|
||||||
|
Prefs.setOSLogoBrightness(newValue / 100.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Contrast:"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 90
|
||||||
|
}
|
||||||
|
|
||||||
|
DankSlider {
|
||||||
|
width: 120
|
||||||
|
height: 24
|
||||||
|
minimum: 0
|
||||||
|
maximum: 200
|
||||||
|
value: Math.round(Prefs.osLogoContrast * 100)
|
||||||
|
unit: ""
|
||||||
|
showValue: false
|
||||||
|
onSliderValueChanged: (newValue) => {
|
||||||
|
Prefs.setOSLogoContrast(newValue / 100.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,9 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: Theme.iconSize - 3
|
width: Theme.iconSize - 3
|
||||||
height: Theme.iconSize - 3
|
height: Theme.iconSize - 3
|
||||||
color: Theme.surfaceText
|
colorOverride: Prefs.osLogoColorOverride
|
||||||
|
brightnessOverride: Prefs.osLogoBrightness
|
||||||
|
contrastOverride: Prefs.osLogoContrast
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import Quickshell.Wayland
|
|||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Modules
|
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import qs.Modules
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
// Proxy objects for external connections
|
// Proxy objects for external connections
|
||||||
|
|||||||
@@ -10,10 +10,8 @@ Singleton {
|
|||||||
|
|
||||||
readonly property BluetoothAdapter adapter: Bluetooth.defaultAdapter
|
readonly property BluetoothAdapter adapter: Bluetooth.defaultAdapter
|
||||||
readonly property bool available: adapter !== null
|
readonly property bool available: adapter !== null
|
||||||
readonly property bool enabled: available ? adapter.enabled ?? false : false
|
readonly property bool enabled: (adapter && adapter.enabled) ?? false
|
||||||
readonly property bool discovering: available ? adapter.discovering ?? false : false
|
readonly property bool discovering: (adapter && adapter.discovering) ?? false
|
||||||
|
|
||||||
property bool operationInProgress: false
|
|
||||||
readonly property var devices: adapter ? adapter.devices : null
|
readonly property var devices: adapter ? adapter.devices : null
|
||||||
readonly property var pairedDevices: {
|
readonly property var pairedDevices: {
|
||||||
if (!adapter || !adapter.devices)
|
if (!adapter || !adapter.devices)
|
||||||
@@ -32,15 +30,6 @@ Singleton {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pairing dialog properties
|
|
||||||
property bool pairingDialogVisible: false
|
|
||||||
property int pairingType: BluetoothPairingRequestType.Authorization
|
|
||||||
property string pendingDeviceAddress: ""
|
|
||||||
property string pendingDeviceName: ""
|
|
||||||
property int pendingPasskey: 0
|
|
||||||
property var pendingToken: null
|
|
||||||
property string inputText: ""
|
|
||||||
|
|
||||||
function sortDevices(devices) {
|
function sortDevices(devices) {
|
||||||
return devices.sort((a, b) => {
|
return devices.sort((a, b) => {
|
||||||
var aName = a.name || a.deviceName || "";
|
var aName = a.name || a.deviceName || "";
|
||||||
@@ -178,145 +167,8 @@ Singleton {
|
|||||||
function connectDeviceWithTrust(device) {
|
function connectDeviceWithTrust(device) {
|
||||||
if (!device) return;
|
if (!device) return;
|
||||||
|
|
||||||
device.connect()
|
device.trusted = true;
|
||||||
}
|
device.connect();
|
||||||
|
|
||||||
function toggleAdapter() {
|
|
||||||
if (!available || operationInProgress) {
|
|
||||||
console.warn("BluetoothService: Cannot toggle adapter - not available or operation in progress");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
operationInProgress = true;
|
|
||||||
var targetState = !adapter.enabled;
|
|
||||||
|
|
||||||
try {
|
|
||||||
adapter.enabled = targetState;
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("BluetoothService: Failed to toggle adapter:", error);
|
|
||||||
operationInProgress = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleDiscovery() {
|
|
||||||
if (!available || !adapter.enabled || operationInProgress) {
|
|
||||||
console.warn("BluetoothService: Cannot toggle discovery - adapter not ready or operation in progress");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
operationInProgress = true;
|
|
||||||
var targetState = !adapter.discovering;
|
|
||||||
|
|
||||||
try {
|
|
||||||
adapter.discovering = targetState;
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("BluetoothService: Failed to toggle discovery:", error);
|
|
||||||
operationInProgress = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Monitor adapter state changes to clear operation flags
|
|
||||||
Connections {
|
|
||||||
target: adapter
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
|
|
||||||
function onEnabledChanged() {
|
|
||||||
operationInProgress = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDiscoveringChanged() {
|
|
||||||
operationInProgress = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pairing agent signal handler
|
|
||||||
Connections {
|
|
||||||
target: Bluetooth.agent
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
|
|
||||||
function onPairingRequested(deviceAddress, type, passkey, token) {
|
|
||||||
console.log("BluetoothService: Pairing requested for", deviceAddress, "type:", type, "passkey:", passkey, "token:", token);
|
|
||||||
root.pairingType = type;
|
|
||||||
root.pendingDeviceAddress = deviceAddress;
|
|
||||||
root.pendingPasskey = passkey;
|
|
||||||
root.pendingToken = token;
|
|
||||||
root.inputText = "";
|
|
||||||
|
|
||||||
// Try to find and store the device name using MAC address
|
|
||||||
var device = root.getDeviceFromAddress(deviceAddress);
|
|
||||||
root.pendingDeviceName = device ? (device.name || device.deviceName || deviceAddress) : deviceAddress;
|
|
||||||
console.log("BluetoothService: Device name:", root.pendingDeviceName, "for address:", deviceAddress, "token:", token);
|
|
||||||
|
|
||||||
root.pairingDialogVisible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function acceptPairing() {
|
|
||||||
console.log("BluetoothService: Accepting pairing for", root.pendingDeviceAddress, "type:", root.pairingType, "token:", root.pendingToken);
|
|
||||||
if (!Bluetooth.agent || root.pendingToken === null) return;
|
|
||||||
|
|
||||||
switch (root.pairingType) {
|
|
||||||
case BluetoothPairingRequestType.Authorization:
|
|
||||||
case BluetoothPairingRequestType.Confirmation:
|
|
||||||
case BluetoothPairingRequestType.ServiceAuthorization:
|
|
||||||
Bluetooth.agent.respondToRequest(root.pendingToken, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BluetoothPairingRequestType.PinCode:
|
|
||||||
if (root.inputText.length > 0) {
|
|
||||||
Bluetooth.agent.respondWithPinCode(root.pendingToken, root.inputText);
|
|
||||||
} else {
|
|
||||||
console.warn("BluetoothService: No PIN code entered");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BluetoothPairingRequestType.Passkey:
|
|
||||||
var passkey = parseInt(root.inputText);
|
|
||||||
if (passkey >= 0 && passkey <= 999999) {
|
|
||||||
Bluetooth.agent.respondWithPasskey(root.pendingToken, passkey);
|
|
||||||
} else {
|
|
||||||
console.warn("BluetoothService: Invalid passkey:", root.inputText);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
closePairingDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
function rejectPairing() {
|
|
||||||
console.log("BluetoothService: Rejecting pairing for", root.pendingDeviceAddress, "token:", root.pendingToken);
|
|
||||||
if (Bluetooth.agent && root.pendingToken !== null) {
|
|
||||||
Bluetooth.agent.respondToRequest(root.pendingToken, false);
|
|
||||||
}
|
|
||||||
closePairingDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
function closePairingDialog() {
|
|
||||||
root.pairingDialogVisible = false;
|
|
||||||
root.pendingDeviceAddress = "";
|
|
||||||
root.pendingDeviceName = "";
|
|
||||||
root.pendingPasskey = 0;
|
|
||||||
root.pendingToken = null;
|
|
||||||
root.inputText = "";
|
|
||||||
root.pairingType = BluetoothPairingRequestType.Authorization;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeviceFromPath(devicePath) {
|
|
||||||
if (!adapter || !adapter.devices || !devicePath)
|
|
||||||
return null;
|
|
||||||
return adapter.devices.values.find(d => d && d.path === devicePath) || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeviceFromAddress(deviceAddress) {
|
|
||||||
if (!adapter || !adapter.devices || !deviceAddress)
|
|
||||||
return null;
|
|
||||||
return adapter.devices.values.find(d => d && d.address === deviceAddress) || null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ PanelWindow {
|
|||||||
property real height: 300
|
property real height: 300
|
||||||
|
|
||||||
// Screen-relative sizing helpers
|
// Screen-relative sizing helpers
|
||||||
readonly property real screenWidth: parent ? parent.width : width
|
readonly property real screenWidth: screen ? screen.width : 1920
|
||||||
readonly property real screenHeight: parent ? parent.height : height
|
readonly property real screenHeight: screen ? screen.height : 1080
|
||||||
|
|
||||||
// Background behavior
|
// Background behavior
|
||||||
property bool showBackground: true
|
property bool showBackground: true
|
||||||
@@ -123,7 +123,7 @@ PanelWindow {
|
|||||||
anchors.centerIn: positioning === "center" ? parent : undefined
|
anchors.centerIn: positioning === "center" ? parent : undefined
|
||||||
x: {
|
x: {
|
||||||
if (positioning === "top-right") {
|
if (positioning === "top-right") {
|
||||||
return Math.max(Theme.spacingL, parent.width - width - Theme.spacingL)
|
return Math.max(Theme.spacingL, root.screenWidth - width - Theme.spacingL)
|
||||||
} else if (positioning === "custom") {
|
} else if (positioning === "custom") {
|
||||||
return root.customPosition.x
|
return root.customPosition.x
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,18 @@ import qs.Common
|
|||||||
IconImage {
|
IconImage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property color color: Theme.surfaceText
|
property string colorOverride: ""
|
||||||
|
property real brightnessOverride: 0.5
|
||||||
|
property real contrastOverride: 1.0
|
||||||
|
|
||||||
smooth: true
|
smooth: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
layer.enabled: true
|
layer.enabled: colorOverride !== ""
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
colorization: 1
|
colorization: 1
|
||||||
colorizationColor: root.color
|
colorizationColor: colorOverride
|
||||||
brightness: 0.5
|
brightness: brightnessOverride
|
||||||
|
contrast: contrastOverride
|
||||||
}
|
}
|
||||||
Process {
|
Process {
|
||||||
running: true
|
running: true
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import qs.Modules.CenterCommandCenter
|
|||||||
import qs.Modules.ControlCenter
|
import qs.Modules.ControlCenter
|
||||||
import qs.Modules.Settings
|
import qs.Modules.Settings
|
||||||
import qs.Modules.TopBar
|
import qs.Modules.TopBar
|
||||||
|
import qs.Modules.ProcessList
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
id: root
|
id: root
|
||||||
@@ -51,10 +52,6 @@ ShellRoot {
|
|||||||
id: wifiPasswordDialog
|
id: wifiPasswordDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothPairingDialog {
|
|
||||||
id: bluetoothPairingDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkInfoDialog {
|
NetworkInfoDialog {
|
||||||
id: networkInfoDialog
|
id: networkInfoDialog
|
||||||
}
|
}
|
||||||
@@ -96,8 +93,8 @@ ShellRoot {
|
|||||||
id: spotlightLauncher
|
id: spotlightLauncher
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessListWidget {
|
ProcessListPopup {
|
||||||
id: processListWidget
|
id: processListPopup
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipboardHistory {
|
ClipboardHistory {
|
||||||
|
|||||||
Reference in New Issue
Block a user