mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 22:12:50 -05: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)
|
||||
|
||||
Reference in New Issue
Block a user