mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05: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,248 +83,255 @@ DankModal {
|
|||||||
id: processContextMenu
|
id: processContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
content: Component {
|
FocusScope {
|
||||||
Item {
|
id: contentFocusScope
|
||||||
anchors.fill: parent
|
|
||||||
focus: true
|
anchors.fill: parent
|
||||||
Keys.onPressed: event => {
|
focus: true
|
||||||
if (event.key === Qt.Key_Escape) {
|
|
||||||
processListModal.hide();
|
Keys.onPressed: event => {
|
||||||
event.accepted = true;
|
if (event.key === Qt.Key_Escape) {
|
||||||
} else if (event.key === Qt.Key_1) {
|
hide();
|
||||||
currentTab = 0;
|
event.accepted = true;
|
||||||
event.accepted = true;
|
return;
|
||||||
} else if (event.key === Qt.Key_2) {
|
|
||||||
currentTab = 1;
|
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_3) {
|
|
||||||
currentTab = 2;
|
|
||||||
event.accepted = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show error message when dgop is not available
|
switch (event.key) {
|
||||||
Rectangle {
|
case Qt.Key_1:
|
||||||
|
currentTab = 0;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_2:
|
||||||
|
currentTab = 1;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_3:
|
||||||
|
currentTab = 2;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 400
|
||||||
|
height: 200
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.1)
|
||||||
|
border.color: Theme.error
|
||||||
|
border.width: 2
|
||||||
|
visible: !DgopService.dgopAvailable
|
||||||
|
|
||||||
|
Column {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 400
|
spacing: Theme.spacingL
|
||||||
height: 200
|
|
||||||
|
DankIcon {
|
||||||
|
name: "error"
|
||||||
|
size: 48
|
||||||
|
color: Theme.error
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("System Monitor Unavailable")
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.error
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("The 'dgop' tool is required for system monitoring.\nPlease install dgop to use this feature.")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
visible: DgopService.dgopAvailable
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 40
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("System Monitor")
|
||||||
|
font.pixelSize: Theme.fontSizeLarge + 4
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.surfaceText
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
circular: false
|
||||||
|
iconName: "close"
|
||||||
|
iconSize: Theme.iconSize - 4
|
||||||
|
iconColor: Theme.surfaceText
|
||||||
|
onClicked: () => {
|
||||||
|
processListModal.hide();
|
||||||
|
}
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 52
|
||||||
|
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.1)
|
border.color: Theme.outlineLight
|
||||||
border.color: Theme.error
|
border.width: 1
|
||||||
border.width: 2
|
|
||||||
visible: !DgopService.dgopAvailable
|
|
||||||
|
|
||||||
Column {
|
Row {
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
spacing: Theme.spacingL
|
anchors.margins: 4
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
DankIcon {
|
Repeater {
|
||||||
name: "error"
|
model: tabNames
|
||||||
size: 48
|
|
||||||
color: Theme.error
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
Rectangle {
|
||||||
text: I18n.tr("System Monitor Unavailable")
|
width: (parent.width - (tabNames.length - 1) * 2) / tabNames.length
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
height: 44
|
||||||
font.weight: Font.Bold
|
radius: Theme.cornerRadius
|
||||||
color: Theme.error
|
color: currentTab === index ? Theme.primaryPressed : (tabMouseArea.containsMouse ? Theme.primaryHoverLight : "transparent")
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
border.color: currentTab === index ? Theme.primary : "transparent"
|
||||||
}
|
border.width: currentTab === index ? 1 : 0
|
||||||
|
|
||||||
StyledText {
|
Row {
|
||||||
text: I18n.tr("The 'dgop' tool is required for system monitoring.\nPlease install dgop to use this feature.")
|
anchors.centerIn: parent
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
spacing: Theme.spacingXS
|
||||||
color: Theme.surfaceText
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
DankIcon {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
name: {
|
||||||
wrapMode: Text.WordWrap
|
const tabIcons = ["list_alt", "analytics", "settings"];
|
||||||
|
return tabIcons[index] || "tab";
|
||||||
|
}
|
||||||
|
size: Theme.iconSize - 2
|
||||||
|
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
||||||
|
opacity: currentTab === index ? 1 : 0.7
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: -1
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
Rectangle {
|
||||||
anchors.fill: parent
|
Layout.fillWidth: true
|
||||||
anchors.margins: Theme.spacingL
|
Layout.fillHeight: true
|
||||||
spacing: Theme.spacingL
|
radius: Theme.cornerRadius
|
||||||
visible: DgopService.dgopAvailable
|
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
|
border.color: Theme.outlineLight
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
RowLayout {
|
Loader {
|
||||||
Layout.fillWidth: true
|
id: processesTab
|
||||||
height: 40
|
|
||||||
|
|
||||||
StyledText {
|
anchors.fill: parent
|
||||||
text: I18n.tr("System Monitor")
|
anchors.margins: Theme.spacingS
|
||||||
font.pixelSize: Theme.fontSizeLarge + 4
|
active: processListModal.visible && currentTab === 0
|
||||||
font.weight: Font.Bold
|
visible: currentTab === 0
|
||||||
color: Theme.surfaceText
|
opacity: currentTab === 0 ? 1 : 0
|
||||||
Layout.alignment: Qt.AlignVCenter
|
sourceComponent: processesTabComponent
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Behavior on opacity {
|
||||||
Layout.fillWidth: true
|
NumberAnimation {
|
||||||
}
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
DankActionButton {
|
|
||||||
circular: false
|
|
||||||
iconName: "close"
|
|
||||||
iconSize: Theme.iconSize - 4
|
|
||||||
iconColor: Theme.surfaceText
|
|
||||||
onClicked: () => {
|
|
||||||
return processListModal.hide();
|
|
||||||
}
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
height: 52
|
|
||||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
border.color: Theme.outlineLight
|
|
||||||
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.cornerRadius
|
|
||||||
color: currentTab === index ? Theme.primaryPressed : (tabMouseArea.containsMouse ? Theme.primaryHoverLight : "transparent")
|
|
||||||
border.color: currentTab === index ? Theme.primary : "transparent"
|
|
||||||
border.width: currentTab === index ? 1 : 0
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: {
|
|
||||||
const tabIcons = ["list_alt", "analytics", "settings"];
|
|
||||||
return tabIcons[index] || "tab";
|
|
||||||
}
|
|
||||||
size: Theme.iconSize - 2
|
|
||||||
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
|
||||||
opacity: currentTab === index ? 1 : 0.7
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
font.weight: Font.Medium
|
|
||||||
color: currentTab === index ? Theme.primary : Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.verticalCenterOffset: -1
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Loader {
|
||||||
Layout.fillWidth: true
|
id: performanceTab
|
||||||
Layout.fillHeight: true
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
|
||||||
border.color: Theme.outlineLight
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Loader {
|
anchors.fill: parent
|
||||||
id: processesTab
|
anchors.margins: Theme.spacingS
|
||||||
|
active: processListModal.visible && currentTab === 1
|
||||||
|
visible: currentTab === 1
|
||||||
|
opacity: currentTab === 1 ? 1 : 0
|
||||||
|
sourceComponent: performanceTabComponent
|
||||||
|
|
||||||
anchors.fill: parent
|
Behavior on opacity {
|
||||||
anchors.margins: Theme.spacingS
|
NumberAnimation {
|
||||||
active: processListModal.shouldBeVisible && currentTab === 0
|
duration: Theme.mediumDuration
|
||||||
visible: currentTab === 0
|
easing.type: Theme.emphasizedEasing
|
||||||
opacity: currentTab === 0 ? 1 : 0
|
|
||||||
sourceComponent: processesTabComponent
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.mediumDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: performanceTab
|
id: systemTab
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: processListModal.shouldBeVisible && currentTab === 1
|
active: processListModal.visible && currentTab === 2
|
||||||
visible: currentTab === 1
|
visible: currentTab === 2
|
||||||
opacity: currentTab === 1 ? 1 : 0
|
opacity: currentTab === 2 ? 1 : 0
|
||||||
sourceComponent: performanceTabComponent
|
sourceComponent: systemTabComponent
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Theme.mediumDuration
|
duration: Theme.mediumDuration
|
||||||
easing.type: Theme.emphasizedEasing
|
easing.type: Theme.emphasizedEasing
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: systemTab
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingS
|
|
||||||
active: processListModal.shouldBeVisible && currentTab === 2
|
|
||||||
visible: currentTab === 2
|
|
||||||
opacity: currentTab === 2 ? 1 : 0
|
|
||||||
sourceComponent: systemTabComponent
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.mediumDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user