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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user