1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

ipc/focus: add focusOrToggle to settings and processlist

This commit is contained in:
bbedward
2025-12-01 23:16:06 -05:00
parent 89aa146845
commit 344c4f9385
8 changed files with 66 additions and 8 deletions

View File

@@ -2,6 +2,8 @@ pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Wayland
import qs.Common
Singleton {
id: root
@@ -219,6 +221,23 @@ Singleton {
}
}
function focusOrToggleSettings() {
if (settingsModal?.visible) {
const settingsTitle = I18n.tr("Settings", "settings window title");
for (const toplevel of ToplevelManager.toplevels.values) {
if (toplevel.title !== "Settings" && toplevel.title !== settingsTitle)
continue;
if (toplevel.activated) {
settingsModal.hide();
return;
}
toplevel.activate();
return;
}
}
openSettings();
}
function unloadSettings() {
if (settingsModalLoader) {
settingsModal = null;