mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 21:45:38 -05:00
fix context menus and general stuff
This commit is contained in:
@@ -85,7 +85,6 @@ PanelWindow {
|
||||
x: Theme.spacingL
|
||||
y: Theme.barHeight + Theme.spacingXS
|
||||
|
||||
// GPU-accelerated scale + opacity animation
|
||||
opacity: appDrawerPopout.isVisible ? 1 : 0
|
||||
scale: appDrawerPopout.isVisible ? 1 : 0.9
|
||||
|
||||
@@ -249,12 +248,21 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (appDrawerPopout.isVisible) {
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onVisibleChanged() {
|
||||
if (appDrawerPopout.visible)
|
||||
searchField.forceActiveFocus();
|
||||
else
|
||||
function onIsVisibleChanged() {
|
||||
if (appDrawerPopout.isVisible) {
|
||||
Qt.callLater(function() {
|
||||
searchField.forceActiveFocus();
|
||||
});
|
||||
} else {
|
||||
searchField.clearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
target: appDrawerPopout
|
||||
|
||||
@@ -23,7 +23,7 @@ PanelWindow {
|
||||
visible: controlCenterVisible
|
||||
onVisibleChanged: {
|
||||
// Enable/disable WiFi auto-refresh based on control center visibility
|
||||
WifiService.autoRefreshEnabled = visible && NetworkService.wifiEnabled;
|
||||
NetworkService.autoRefreshEnabled = visible && NetworkService.wifiEnabled;
|
||||
// Stop bluetooth scanning when control center is closed
|
||||
if (!visible && BluetoothService.adapter && BluetoothService.adapter.discovering)
|
||||
BluetoothService.adapter.discovering = false;
|
||||
|
||||
@@ -49,8 +49,8 @@ Rectangle {
|
||||
name: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "wifi_off";
|
||||
} else if (WifiService.currentWifiSSID !== "") {
|
||||
return getWiFiSignalIcon(WifiService.wifiSignalStrength);
|
||||
} else if (NetworkService.currentWifiSSID !== "") {
|
||||
return getWiFiSignalIcon(NetworkService.wifiSignalStrength);
|
||||
} else {
|
||||
return "wifi";
|
||||
}
|
||||
@@ -64,8 +64,8 @@ Rectangle {
|
||||
text: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "WiFi is off";
|
||||
} else if (NetworkService.wifiEnabled && WifiService.currentWifiSSID) {
|
||||
return WifiService.currentWifiSSID || "Connected";
|
||||
} else if (NetworkService.wifiEnabled && NetworkService.currentWifiSSID) {
|
||||
return NetworkService.currentWifiSSID || "Connected";
|
||||
} else {
|
||||
return "Not Connected";
|
||||
}
|
||||
@@ -82,7 +82,7 @@ Rectangle {
|
||||
text: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "Turn on WiFi to see networks";
|
||||
} else if (NetworkService.wifiEnabled && WifiService.currentWifiSSID) {
|
||||
} else if (NetworkService.wifiEnabled && NetworkService.currentWifiSSID) {
|
||||
return NetworkService.wifiIP || "Connected";
|
||||
} else {
|
||||
return "Select a network below";
|
||||
@@ -130,13 +130,13 @@ Rectangle {
|
||||
onClicked: {
|
||||
if (NetworkService.wifiEnabled) {
|
||||
// When turning WiFi off, clear all cached WiFi data
|
||||
WifiService.currentWifiSSID = "";
|
||||
WifiService.wifiSignalStrength = "excellent";
|
||||
WifiService.wifiNetworks = [];
|
||||
WifiService.savedWifiNetworks = [];
|
||||
WifiService.connectionStatus = "";
|
||||
WifiService.connectingSSID = "";
|
||||
WifiService.isScanning = false;
|
||||
NetworkService.currentWifiSSID = "";
|
||||
NetworkService.wifiSignalStrength = "excellent";
|
||||
NetworkService.wifiNetworks = [];
|
||||
NetworkService.savedWifiNetworks = [];
|
||||
NetworkService.connectionStatus = "";
|
||||
NetworkService.connectingSSID = "";
|
||||
NetworkService.isScanning = false;
|
||||
NetworkService.refreshNetworkStatus();
|
||||
}
|
||||
NetworkService.toggleWifiRadio();
|
||||
|
||||
@@ -118,10 +118,10 @@ Rectangle {
|
||||
onClicked: {
|
||||
if (wifiContextMenuWindow.networkData) {
|
||||
if (wifiContextMenuWindow.networkData.connected) {
|
||||
WifiService.disconnectWifi();
|
||||
NetworkService.disconnectWifi();
|
||||
} else {
|
||||
if (wifiContextMenuWindow.networkData.saved) {
|
||||
WifiService.connectToWifi(wifiContextMenuWindow.networkData.ssid);
|
||||
NetworkService.connectToWifi(wifiContextMenuWindow.networkData.ssid);
|
||||
} else if (wifiContextMenuWindow.networkData.secured) {
|
||||
if (wifiPasswordModalRef) {
|
||||
wifiPasswordModalRef.wifiPasswordSSID = wifiContextMenuWindow.networkData.ssid;
|
||||
@@ -129,7 +129,7 @@ Rectangle {
|
||||
wifiPasswordModalRef.wifiPasswordModalVisible = true;
|
||||
}
|
||||
} else {
|
||||
WifiService.connectToWifi(wifiContextMenuWindow.networkData.ssid);
|
||||
NetworkService.connectToWifi(wifiContextMenuWindow.networkData.ssid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (wifiContextMenuWindow.networkData) {
|
||||
WifiService.forgetWifiNetwork(wifiContextMenuWindow.networkData.ssid);
|
||||
NetworkService.forgetWifiNetwork(wifiContextMenuWindow.networkData.ssid);
|
||||
}
|
||||
wifiContextMenuWindow.hide();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ Column {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: refreshAreaSpan.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : WifiService.isScanning ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
|
||||
color: refreshAreaSpan.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : NetworkService.isScanning ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
|
||||
|
||||
DankIcon {
|
||||
id: refreshIconSpan
|
||||
@@ -63,12 +63,12 @@ Column {
|
||||
name: "refresh"
|
||||
size: Theme.iconSize - 6
|
||||
color: refreshAreaSpan.containsMouse ? Theme.primary : Theme.surfaceText
|
||||
rotation: WifiService.isScanning ? refreshIconSpan.rotation : 0
|
||||
rotation: NetworkService.isScanning ? refreshIconSpan.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: refreshIconSpan
|
||||
property: "rotation"
|
||||
running: WifiService.isScanning
|
||||
running: NetworkService.isScanning
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
@@ -89,10 +89,10 @@ Column {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (!WifiService.isScanning) {
|
||||
if (!NetworkService.isScanning) {
|
||||
// Immediate visual feedback
|
||||
refreshIconSpan.rotation += 30;
|
||||
WifiService.scanWifi();
|
||||
NetworkService.scanWifi();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,9 +164,9 @@ Column {
|
||||
text: {
|
||||
if (modelData.connected)
|
||||
return "Connected";
|
||||
if (WifiService.connectionStatus === "connecting" && WifiService.connectingSSID === modelData.ssid)
|
||||
if (NetworkService.connectionStatus === "connecting" && NetworkService.connectingSSID === modelData.ssid)
|
||||
return "Connecting...";
|
||||
if (WifiService.connectionStatus === "invalid_password" && WifiService.connectingSSID === modelData.ssid)
|
||||
if (NetworkService.connectionStatus === "invalid_password" && NetworkService.connectingSSID === modelData.ssid)
|
||||
return "Invalid password";
|
||||
if (modelData.saved)
|
||||
return "Saved" + (modelData.secured ? " • Secured" : " • Open");
|
||||
@@ -174,9 +174,9 @@ Column {
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall - 1
|
||||
color: {
|
||||
if (WifiService.connectionStatus === "connecting" && WifiService.connectingSSID === modelData.ssid)
|
||||
if (NetworkService.connectionStatus === "connecting" && NetworkService.connectingSSID === modelData.ssid)
|
||||
return Theme.primary;
|
||||
if (WifiService.connectionStatus === "invalid_password" && WifiService.connectingSSID === modelData.ssid)
|
||||
if (NetworkService.connectionStatus === "invalid_password" && NetworkService.connectingSSID === modelData.ssid)
|
||||
return Theme.error;
|
||||
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ Column {
|
||||
return;
|
||||
|
||||
if (modelData.saved) {
|
||||
WifiService.connectToWifi(modelData.ssid);
|
||||
NetworkService.connectToWifi(modelData.ssid);
|
||||
} else if (modelData.secured) {
|
||||
if (wifiPasswordModalRef) {
|
||||
wifiPasswordModalRef.wifiPasswordSSID = modelData.ssid;
|
||||
@@ -261,7 +261,7 @@ Column {
|
||||
wifiPasswordModalRef.wifiPasswordModalVisible = true;
|
||||
}
|
||||
} else {
|
||||
WifiService.connectToWifi(modelData.ssid);
|
||||
NetworkService.connectToWifi(modelData.ssid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ Item {
|
||||
}
|
||||
|
||||
// Explicitly reference both arrays to ensure reactivity
|
||||
var allNetworks = WifiService.wifiNetworks;
|
||||
var savedNetworks = WifiService.savedWifiNetworks;
|
||||
var currentSSID = WifiService.currentWifiSSID;
|
||||
var signalStrength = WifiService.wifiSignalStrength;
|
||||
var allNetworks = NetworkService.wifiNetworks;
|
||||
var savedNetworks = NetworkService.savedWifiNetworks;
|
||||
var currentSSID = NetworkService.currentWifiSSID;
|
||||
var signalStrength = NetworkService.wifiSignalStrength;
|
||||
var refreshTrigger = forceRefresh; // Force recalculation
|
||||
|
||||
var networks = [...allNetworks];
|
||||
@@ -58,7 +58,7 @@ Item {
|
||||
property int forceRefresh: 0
|
||||
|
||||
Connections {
|
||||
target: WifiService
|
||||
target: NetworkService
|
||||
function onNetworksUpdated() {
|
||||
forceRefresh++;
|
||||
}
|
||||
@@ -66,9 +66,9 @@ Item {
|
||||
|
||||
// Auto-enable WiFi auto-refresh when network tab is visible
|
||||
Component.onCompleted: {
|
||||
WifiService.autoRefreshEnabled = true;
|
||||
NetworkService.autoRefreshEnabled = true;
|
||||
if (NetworkService.wifiEnabled)
|
||||
WifiService.scanWifi();
|
||||
NetworkService.scanWifi();
|
||||
// Start smart monitoring
|
||||
wifiMonitorTimer.start();
|
||||
}
|
||||
@@ -199,8 +199,8 @@ Item {
|
||||
property bool triggered: false
|
||||
onTriggered: {
|
||||
NetworkService.refreshNetworkStatus();
|
||||
if (NetworkService.wifiEnabled && !WifiService.isScanning) {
|
||||
WifiService.scanWifi();
|
||||
if (NetworkService.wifiEnabled && !NetworkService.isScanning) {
|
||||
NetworkService.scanWifi();
|
||||
}
|
||||
triggered = false;
|
||||
}
|
||||
@@ -218,13 +218,13 @@ Item {
|
||||
wifiMonitorTimer.start();
|
||||
} else {
|
||||
// When WiFi is disabled, clear all cached WiFi data
|
||||
WifiService.currentWifiSSID = "";
|
||||
WifiService.wifiSignalStrength = "excellent";
|
||||
WifiService.wifiNetworks = [];
|
||||
WifiService.savedWifiNetworks = [];
|
||||
WifiService.connectionStatus = "";
|
||||
WifiService.connectingSSID = "";
|
||||
WifiService.isScanning = false;
|
||||
NetworkService.currentWifiSSID = "";
|
||||
NetworkService.wifiSignalStrength = "excellent";
|
||||
NetworkService.wifiNetworks = [];
|
||||
NetworkService.savedWifiNetworks = [];
|
||||
NetworkService.connectionStatus = "";
|
||||
NetworkService.connectingSSID = "";
|
||||
NetworkService.isScanning = false;
|
||||
NetworkService.refreshNetworkStatus();
|
||||
// Stop monitoring when WiFi is off
|
||||
wifiMonitorTimer.stop();
|
||||
@@ -240,8 +240,8 @@ Item {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (NetworkService.wifiEnabled && visible) {
|
||||
if (!WifiService.isScanning) {
|
||||
WifiService.scanWifi();
|
||||
if (!NetworkService.isScanning) {
|
||||
NetworkService.scanWifi();
|
||||
} else {
|
||||
// If still scanning, try again in a bit
|
||||
wifiRetryTimer.start();
|
||||
@@ -257,9 +257,9 @@ Item {
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (NetworkService.wifiEnabled && visible && WifiService.wifiNetworks.length === 0) {
|
||||
if (!WifiService.isScanning) {
|
||||
WifiService.scanWifi();
|
||||
if (NetworkService.wifiEnabled && visible && NetworkService.wifiNetworks.length === 0) {
|
||||
if (!NetworkService.isScanning) {
|
||||
NetworkService.scanWifi();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,13 +288,13 @@ Item {
|
||||
reason = "not connected to WiFi";
|
||||
}
|
||||
// Also scan occasionally even when connected to keep networks fresh
|
||||
else if (WifiService.wifiNetworks.length === 0) {
|
||||
else if (NetworkService.wifiNetworks.length === 0) {
|
||||
shouldScan = true;
|
||||
reason = "no networks cached";
|
||||
}
|
||||
|
||||
if (shouldScan && !WifiService.isScanning) {
|
||||
WifiService.scanWifi();
|
||||
if (shouldScan && !NetworkService.isScanning) {
|
||||
NetworkService.scanWifi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,80 +1,74 @@
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
PanelWindow {
|
||||
id: processContextMenuWindow
|
||||
Popup {
|
||||
id: processContextMenu
|
||||
|
||||
property var processData: null
|
||||
property bool menuVisible: false
|
||||
|
||||
function show(x, y) {
|
||||
if (!processContextMenu.parent && typeof Overlay !== "undefined" && Overlay.overlay) {
|
||||
processContextMenu.parent = Overlay.overlay;
|
||||
}
|
||||
|
||||
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;
|
||||
const screenWidth = Screen.width;
|
||||
const screenHeight = Screen.height;
|
||||
|
||||
let finalX = x;
|
||||
let finalY = y;
|
||||
if (x + menuWidth > screenWidth - 20)
|
||||
|
||||
if (x + menuWidth > screenWidth - 20) {
|
||||
finalX = x - menuWidth;
|
||||
|
||||
if (y + menuHeight > screenHeight - 20)
|
||||
}
|
||||
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;
|
||||
processContextMenu.x = Math.max(20, finalX);
|
||||
processContextMenu.y = Math.max(20, finalY);
|
||||
open();
|
||||
}
|
||||
|
||||
function hide() {
|
||||
processContextMenuWindow.menuVisible = false;
|
||||
width: 180
|
||||
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||
padding: 0
|
||||
modal: false
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
|
||||
onClosed: {
|
||||
closePolicy = Popup.CloseOnEscape;
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
outsideClickTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: outsideClickTimer
|
||||
interval: 100
|
||||
onTriggered: {
|
||||
processContextMenu.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside;
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
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
|
||||
contentItem: Rectangle {
|
||||
id: menuContent
|
||||
color: Theme.popupBackground()
|
||||
radius: Theme.cornerRadiusLarge
|
||||
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
|
||||
@@ -97,27 +91,17 @@ PanelWindow {
|
||||
|
||||
MouseArea {
|
||||
id: copyPidArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (processContextMenuWindow.processData) {
|
||||
copyPidProcess.command = ["wl-copy", processContextMenuWindow.processData.pid.toString()];
|
||||
if (processContextMenu.processData) {
|
||||
copyPidProcess.command = ["wl-copy", processContextMenu.processData.pid.toString()];
|
||||
copyPidProcess.running = true;
|
||||
}
|
||||
processContextMenuWindow.hide();
|
||||
processContextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -138,28 +122,18 @@ PanelWindow {
|
||||
|
||||
MouseArea {
|
||||
id: copyNameArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (processContextMenuWindow.processData) {
|
||||
let processName = processContextMenuWindow.processData.displayName || processContextMenuWindow.processData.command;
|
||||
if (processContextMenu.processData) {
|
||||
let processName = processContextMenu.processData.displayName || processContextMenu.processData.command;
|
||||
copyNameProcess.command = ["wl-copy", processName];
|
||||
copyNameProcess.running = true;
|
||||
}
|
||||
processContextMenuWindow.hide();
|
||||
processContextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -174,7 +148,6 @@ PanelWindow {
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -182,7 +155,7 @@ PanelWindow {
|
||||
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
|
||||
enabled: processContextMenu.processData && processContextMenu.processData.pid > 1000
|
||||
opacity: enabled ? 1 : 0.5
|
||||
|
||||
Text {
|
||||
@@ -197,28 +170,18 @@ PanelWindow {
|
||||
|
||||
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()];
|
||||
if (processContextMenu.processData) {
|
||||
killProcess.command = ["kill", processContextMenu.processData.pid.toString()];
|
||||
killProcess.running = true;
|
||||
}
|
||||
processContextMenuWindow.hide();
|
||||
processContextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -226,7 +189,7 @@ PanelWindow {
|
||||
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
|
||||
enabled: processContextMenu.processData && processContextMenu.processData.pid > 1000
|
||||
opacity: enabled ? 1 : 0.5
|
||||
|
||||
Text {
|
||||
@@ -241,80 +204,40 @@ PanelWindow {
|
||||
|
||||
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()];
|
||||
if (processContextMenu.processData) {
|
||||
forceKillProcess.command = ["kill", "-9", processContextMenu.processData.pid.toString()];
|
||||
forceKillProcess.running = true;
|
||||
}
|
||||
processContextMenuWindow.hide();
|
||||
processContextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ Rectangle {
|
||||
|
||||
property var process: null
|
||||
property var contextMenu: null
|
||||
property var processContextMenuWindow: null
|
||||
|
||||
width: parent.width
|
||||
height: 40
|
||||
@@ -29,15 +28,16 @@ Rectangle {
|
||||
if (process && process.pid > 0 && contextMenu) {
|
||||
contextMenu.processData = process;
|
||||
let globalPos = processMouseArea.mapToGlobal(mouse.x, mouse.y);
|
||||
contextMenu.show(globalPos.x, globalPos.y);
|
||||
let localPos = contextMenu.parent ? contextMenu.parent.mapFromGlobal(globalPos.x, globalPos.y) : globalPos;
|
||||
contextMenu.show(localPos.x, localPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
onPressAndHold: {
|
||||
if (process && process.pid > 0 && processContextMenuWindow) {
|
||||
processContextMenuWindow.processData = process;
|
||||
if (process && process.pid > 0 && contextMenu) {
|
||||
contextMenu.processData = process;
|
||||
let globalPos = processMouseArea.mapToGlobal(processMouseArea.width / 2, processMouseArea.height / 2);
|
||||
processContextMenuWindow.show(globalPos.x, globalPos.y);
|
||||
contextMenu.show(globalPos.x, globalPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,10 +188,11 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (process && process.pid > 0 && processContextMenuWindow) {
|
||||
processContextMenuWindow.processData = process;
|
||||
if (process && process.pid > 0 && contextMenu) {
|
||||
contextMenu.processData = process;
|
||||
let globalPos = menuButtonArea.mapToGlobal(menuButtonArea.width / 2, menuButtonArea.height);
|
||||
processContextMenuWindow.show(globalPos.x, globalPos.y);
|
||||
let localPos = contextMenu.parent ? contextMenu.parent.mapFromGlobal(globalPos.x, globalPos.y) : globalPos;
|
||||
contextMenu.show(localPos.x, localPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,4 +208,4 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,10 @@ PanelWindow {
|
||||
|
||||
function hide() {
|
||||
isVisible = false;
|
||||
// Close any open context menus
|
||||
if (processContextMenu.visible) {
|
||||
processContextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
function show() {
|
||||
@@ -127,13 +131,13 @@ PanelWindow {
|
||||
ProcessListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
contextMenu: processContextMenuWindow
|
||||
contextMenu: processContextMenu
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContextMenu {
|
||||
id: processContextMenuWindow
|
||||
id: processContextMenu
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import qs.Services
|
||||
|
||||
Column {
|
||||
id: root
|
||||
property var processContextMenuWindow: null
|
||||
property var contextMenu: null
|
||||
|
||||
Item {
|
||||
@@ -130,8 +129,7 @@ Column {
|
||||
delegate: ProcessListItem {
|
||||
process: modelData
|
||||
contextMenu: root.contextMenu
|
||||
processContextMenuWindow: root.contextMenu
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,13 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Modules.ProcessList
|
||||
|
||||
ColumnLayout {
|
||||
id: processesTab
|
||||
anchors.fill: parent
|
||||
spacing: Theme.spacingM
|
||||
|
||||
|
||||
property var contextMenu: null
|
||||
|
||||
SystemOverview {
|
||||
@@ -17,6 +18,10 @@ ColumnLayout {
|
||||
ProcessListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
contextMenu: processesTab.contextMenu
|
||||
contextMenu: processesTab.contextMenu || localContextMenu
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContextMenu {
|
||||
id: localContextMenu
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import qs.Services
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var audioLevels: [0, 0, 0, 0]
|
||||
property var audioLevels: [0, 0, 0, 0, 0, 0]
|
||||
readonly property MprisPlayer activePlayer: MprisController.activePlayer
|
||||
readonly property bool hasActiveMedia: activePlayer !== null
|
||||
property bool cavaAvailable: false
|
||||
@@ -41,10 +41,10 @@ Item {
|
||||
id: cavaProcess
|
||||
|
||||
running: false
|
||||
command: ["sh", "-c", `printf '[general]\nmode=normal\nframerate=30\nautosens=0\nsensitivity=50\nbars=4\n[output]\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nchannels=mono\nmono_option=average\n[smoothing]\nnoise_reduction=20' | cava -p /dev/stdin`]
|
||||
command: ["sh", "-c", `printf '[general]\nmode=normal\nframerate=25\nautosens=0\nsensitivity=30\nbars=6\nlower_cutoff_freq=50\nhigher_cutoff_freq=12000\n[output]\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nchannels=mono\nmono_option=average\n[smoothing]\nnoise_reduction=35\nintegral=90\ngravity=95\nignore=2\nmonstercat=1.5' | cava -p /dev/stdin`]
|
||||
onRunningChanged: {
|
||||
if (!running)
|
||||
root.audioLevels = [0, 0, 0, 0];
|
||||
root.audioLevels = [0, 0, 0, 0, 0, 0];
|
||||
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ Item {
|
||||
}).filter((p) => {
|
||||
return !isNaN(p);
|
||||
});
|
||||
if (points.length >= 4)
|
||||
root.audioLevels = [points[0], points[1], points[2], points[3]];
|
||||
if (points.length >= 6)
|
||||
root.audioLevels = [points[0], points[1], points[2], points[3], points[4], points[5]];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -73,19 +73,19 @@ Item {
|
||||
interval: 100
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
root.audioLevels = [Math.random() * 40 + 10, Math.random() * 60 + 20, Math.random() * 50 + 15, Math.random() * 35 + 20];
|
||||
root.audioLevels = [Math.random() * 40 + 10, Math.random() * 60 + 20, Math.random() * 50 + 15, Math.random() * 35 + 20, Math.random() * 45 + 15, Math.random() * 55 + 25];
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: 2
|
||||
spacing: 1.5
|
||||
|
||||
Repeater {
|
||||
model: 4
|
||||
model: 6
|
||||
|
||||
Rectangle {
|
||||
width: 3
|
||||
width: 2
|
||||
height: {
|
||||
if (root.activePlayer && root.activePlayer.playbackState === MprisPlaybackState.Playing && root.audioLevels.length > index) {
|
||||
const rawLevel = root.audioLevels[index] || 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ Rectangle {
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
return "lan";
|
||||
else if (NetworkService.networkStatus === "wifi")
|
||||
return getWiFiSignalIcon(WifiService.wifiSignalStrength);
|
||||
return getWiFiSignalIcon(NetworkService.wifiSignalStrength);
|
||||
else
|
||||
return "wifi_off";
|
||||
}
|
||||
|
||||
@@ -85,8 +85,6 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
AudioVisualization {
|
||||
width: 20
|
||||
height: Theme.iconSize
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import "../../Common/Utilities.js" as Utils
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
@@ -277,7 +276,7 @@ PanelWindow {
|
||||
controlCenterPopout.controlCenterVisible = !controlCenterPopout.controlCenterVisible;
|
||||
if (controlCenterPopout.controlCenterVisible) {
|
||||
if (NetworkService.wifiEnabled)
|
||||
WifiService.scanWifi();
|
||||
NetworkService.scanWifi();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user