mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 21:02:06 -04:00
ipc/focus: add focusOrToggle to settings and processlist
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
import qs.Modules.ProcessList
|
||||
import qs.Services
|
||||
@@ -39,6 +40,27 @@ FloatingWindow {
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
function focusOrToggle() {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
console.warn("ProcessListModal: dgop is not available");
|
||||
return;
|
||||
}
|
||||
if (visible) {
|
||||
const modalTitle = I18n.tr("System Monitor", "sysmon window title");
|
||||
for (const toplevel of ToplevelManager.toplevels.values) {
|
||||
if (toplevel.title !== "System Monitor" && toplevel.title !== modalTitle)
|
||||
continue;
|
||||
if (toplevel.activated) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
toplevel.activate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
show();
|
||||
}
|
||||
|
||||
objectName: "processListModal"
|
||||
title: I18n.tr("System Monitor", "sysmon window title")
|
||||
minimumSize: Qt.size(650, 400)
|
||||
|
||||
@@ -73,6 +73,10 @@ DankModal {
|
||||
borderWidth: 1
|
||||
enableShadow: true
|
||||
keepContentLoaded: true
|
||||
animationScaleCollapsed: 0.96
|
||||
animationDuration: Theme.expressiveDurations.expressiveDefaultSpatial
|
||||
animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
|
||||
animationExitCurve: Theme.expressiveCurves.emphasized
|
||||
onVisibleChanged: () => {
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user