mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-17 03:02:05 -04:00
processlist: convert to floating window
This commit is contained in:
@@ -126,9 +126,7 @@ windowrulev2 = float, class:^(firefox)$, title:^(Picture-in-Picture)$
|
|||||||
windowrulev2 = float, class:^(zoom)$
|
windowrulev2 = float, class:^(zoom)$
|
||||||
|
|
||||||
# DMS windows floating by default
|
# DMS windows floating by default
|
||||||
windowrulev2 = float, class:^(org.quickshell)$, title:^(Settings)$
|
windowrulev2 = float, class:^(org.quickshell)$
|
||||||
windowrulev2 = float, class:^(org.quickshell)$, title:^(File)$
|
|
||||||
|
|
||||||
windowrulev2 = opacity 0.9 0.9, floating:0, focus:0
|
windowrulev2 = opacity 0.9 0.9, floating:0, focus:0
|
||||||
|
|
||||||
layerrule = noanim, ^(quickshell)$
|
layerrule = noanim, ^(quickshell)$
|
||||||
|
|||||||
@@ -218,16 +218,9 @@ window-rule {
|
|||||||
geometry-corner-radius 12
|
geometry-corner-radius 12
|
||||||
clip-to-geometry true
|
clip-to-geometry true
|
||||||
}
|
}
|
||||||
// Open dms settings as floating by default
|
// Open dms windows as floating by default
|
||||||
window-rule {
|
window-rule {
|
||||||
match app-id=r#"org.quickshell$"#
|
match app-id=r#"org.quickshell$"#
|
||||||
match title="Settings"
|
|
||||||
open-floating true
|
|
||||||
}
|
|
||||||
// dms file browser
|
|
||||||
window-rule {
|
|
||||||
match app-id=r#"org.quickshell$"#
|
|
||||||
match title=r#"File$"#
|
|
||||||
open-floating true
|
open-floating true
|
||||||
}
|
}
|
||||||
binds {
|
binds {
|
||||||
|
|||||||
@@ -1,30 +1,32 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Common
|
|
||||||
import qs.Modules.ProcessList
|
import qs.Modules.ProcessList
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
DankModal {
|
FloatingWindow {
|
||||||
id: processListModal
|
id: processListModal
|
||||||
|
|
||||||
layerNamespace: "dms:process-list-modal"
|
|
||||||
|
|
||||||
property int currentTab: 0
|
property int currentTab: 0
|
||||||
property var tabNames: ["Processes", "Performance", "System"]
|
property var tabNames: ["Processes", "Performance", "System"]
|
||||||
|
property bool shouldHaveFocus: visible
|
||||||
|
property alias shouldBeVisible: processListModal.visible
|
||||||
|
|
||||||
|
signal closingModal
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
if (!DgopService.dgopAvailable) {
|
if (!DgopService.dgopAvailable) {
|
||||||
console.warn("ProcessListModal: dgop is not available");
|
console.warn("ProcessListModal: dgop is not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
open();
|
visible = true;
|
||||||
UserInfoService.getUptime();
|
UserInfoService.getUptime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
close();
|
visible = false;
|
||||||
if (processContextMenu.visible) {
|
if (processContextMenu.visible) {
|
||||||
processContextMenu.close();
|
processContextMenu.close();
|
||||||
}
|
}
|
||||||
@@ -35,20 +37,26 @@ DankModal {
|
|||||||
console.warn("ProcessListModal: dgop is not available");
|
console.warn("ProcessListModal: dgop is not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shouldBeVisible) {
|
visible = !visible;
|
||||||
hide();
|
|
||||||
} else {
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modalWidth: 900
|
objectName: "processListModal"
|
||||||
modalHeight: 680
|
title: "System Monitor"
|
||||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
implicitWidth: 900
|
||||||
cornerRadius: Theme.cornerRadius
|
implicitHeight: 680
|
||||||
enableShadow: true
|
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
onBackgroundClicked: () => {
|
visible: false
|
||||||
return hide();
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (!visible) {
|
||||||
|
closingModal();
|
||||||
|
} else {
|
||||||
|
Qt.callLater(() => {
|
||||||
|
if (contentFocusScope) {
|
||||||
|
contentFocusScope.forceActiveFocus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -75,27 +83,35 @@ DankModal {
|
|||||||
id: processContextMenu
|
id: processContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
content: Component {
|
FocusScope {
|
||||||
Item {
|
id: contentFocusScope
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
processListModal.hide();
|
hide();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_1) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_1:
|
||||||
currentTab = 0;
|
currentTab = 0;
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_2) {
|
return;
|
||||||
|
case Qt.Key_2:
|
||||||
currentTab = 1;
|
currentTab = 1;
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_3) {
|
return;
|
||||||
|
case Qt.Key_3:
|
||||||
currentTab = 2;
|
currentTab = 2;
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show error message when dgop is not available
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 400
|
width: 400
|
||||||
@@ -164,7 +180,7 @@ DankModal {
|
|||||||
iconSize: Theme.iconSize - 4
|
iconSize: Theme.iconSize - 4
|
||||||
iconColor: Theme.surfaceText
|
iconColor: Theme.surfaceText
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
return processListModal.hide();
|
processListModal.hide();
|
||||||
}
|
}
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
@@ -271,7 +287,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: processListModal.shouldBeVisible && currentTab === 0
|
active: processListModal.visible && currentTab === 0
|
||||||
visible: currentTab === 0
|
visible: currentTab === 0
|
||||||
opacity: currentTab === 0 ? 1 : 0
|
opacity: currentTab === 0 ? 1 : 0
|
||||||
sourceComponent: processesTabComponent
|
sourceComponent: processesTabComponent
|
||||||
@@ -289,7 +305,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: processListModal.shouldBeVisible && currentTab === 1
|
active: processListModal.visible && currentTab === 1
|
||||||
visible: currentTab === 1
|
visible: currentTab === 1
|
||||||
opacity: currentTab === 1 ? 1 : 0
|
opacity: currentTab === 1 ? 1 : 0
|
||||||
sourceComponent: performanceTabComponent
|
sourceComponent: performanceTabComponent
|
||||||
@@ -307,7 +323,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: processListModal.shouldBeVisible && currentTab === 2
|
active: processListModal.visible && currentTab === 2
|
||||||
visible: currentTab === 2
|
visible: currentTab === 2
|
||||||
opacity: currentTab === 2 ? 1 : 0
|
opacity: currentTab === 2 ? 1 : 0
|
||||||
sourceComponent: systemTabComponent
|
sourceComponent: systemTabComponent
|
||||||
@@ -322,5 +338,4 @@ DankModal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user