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

@@ -140,8 +140,8 @@ $mod = SUPER
bind = $mod, T, exec, {{TERMINAL_COMMAND}} bind = $mod, T, exec, {{TERMINAL_COMMAND}}
bind = $mod, space, exec, dms ipc call spotlight toggle bind = $mod, space, exec, dms ipc call spotlight toggle
bind = $mod, V, exec, dms ipc call clipboard toggle bind = $mod, V, exec, dms ipc call clipboard toggle
bind = $mod, M, exec, dms ipc call processlist toggle bind = $mod, M, exec, dms ipc call processlist focusOrToggle
bind = $mod, comma, exec, dms ipc call settings toggle bind = $mod, comma, exec, dms ipc call settings focusOrToggle
bind = $mod, N, exec, dms ipc call notifications toggle bind = $mod, N, exec, dms ipc call notifications toggle
bind = $mod SHIFT, N, exec, dms ipc call notepad toggle bind = $mod SHIFT, N, exec, dms ipc call notepad toggle
bind = $mod, Y, exec, dms ipc call dankdash wallpaper bind = $mod, Y, exec, dms ipc call dankdash wallpaper
@@ -153,7 +153,7 @@ bind = $mod SHIFT, Slash, exec, dms ipc call keybinds toggle hyprland
# === Security === # === Security ===
bind = $mod ALT, L, exec, dms ipc call lock lock bind = $mod ALT, L, exec, dms ipc call lock lock
bind = $mod SHIFT, E, exit bind = $mod SHIFT, E, exit
bind = CTRL ALT, Delete, exec, dms ipc call processlist toggle bind = CTRL ALT, Delete, exec, dms ipc call processlist focusOrToggle
# === Audio Controls === # === Audio Controls ===
bindel = , XF86AudioRaiseVolume, exec, dms ipc call audio increment 3 bindel = , XF86AudioRaiseVolume, exec, dms ipc call audio increment 3

View File

@@ -238,10 +238,10 @@ binds {
spawn "dms" "ipc" "call" "clipboard" "toggle"; spawn "dms" "ipc" "call" "clipboard" "toggle";
} }
Mod+M hotkey-overlay-title="Task Manager" { Mod+M hotkey-overlay-title="Task Manager" {
spawn "dms" "ipc" "call" "processlist" "toggle"; spawn "dms" "ipc" "call" "processlist" "focusOrToggle";
} }
Mod+Comma hotkey-overlay-title="Settings" { Mod+Comma hotkey-overlay-title="Settings" {
spawn "dms" "ipc" "call" "settings" "toggle"; spawn "dms" "ipc" "call" "settings" "focusOrToggle";
} }
Mod+Y hotkey-overlay-title="Browse Wallpapers" { Mod+Y hotkey-overlay-title="Browse Wallpapers" {
spawn "dms" "ipc" "call" "dankdash" "wallpaper"; spawn "dms" "ipc" "call" "dankdash" "wallpaper";
@@ -255,7 +255,7 @@ binds {
} }
Mod+Shift+E { quit; } Mod+Shift+E { quit; }
Ctrl+Alt+Delete hotkey-overlay-title="Task Manager" { Ctrl+Alt+Delete hotkey-overlay-title="Task Manager" {
spawn "dms" "ipc" "call" "processlist" "toggle"; spawn "dms" "ipc" "call" "processlist" "focusOrToggle";
} }
// === Audio Controls === // === Audio Controls ===

View File

@@ -79,6 +79,14 @@ Item {
return "PROCESSLIST_TOGGLE_SUCCESS"; return "PROCESSLIST_TOGGLE_SUCCESS";
} }
function focusOrToggle(): string {
root.processListModalLoader.active = true;
if (root.processListModalLoader.item)
root.processListModalLoader.item.focusOrToggle();
return "PROCESSLIST_FOCUS_OR_TOGGLE_SUCCESS";
}
target: "processlist" target: "processlist"
} }
@@ -598,6 +606,11 @@ Item {
return "SETTINGS_TOGGLE_SUCCESS"; return "SETTINGS_TOGGLE_SUCCESS";
} }
function focusOrToggle(): string {
PopoutService.focusOrToggleSettings();
return "SETTINGS_FOCUS_OR_TOGGLE_SUCCESS";
}
function get(key: string): string { function get(key: string): string {
return JSON.stringify(SettingsData?.[key]) return JSON.stringify(SettingsData?.[key])
} }

View File

@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Wayland
import qs.Common import qs.Common
import qs.Modules.ProcessList import qs.Modules.ProcessList
import qs.Services import qs.Services
@@ -39,6 +40,27 @@ FloatingWindow {
visible = !visible; 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" objectName: "processListModal"
title: I18n.tr("System Monitor", "sysmon window title") title: I18n.tr("System Monitor", "sysmon window title")
minimumSize: Qt.size(650, 400) minimumSize: Qt.size(650, 400)

View File

@@ -73,6 +73,10 @@ DankModal {
borderWidth: 1 borderWidth: 1
enableShadow: true enableShadow: true
keepContentLoaded: true keepContentLoaded: true
animationScaleCollapsed: 0.96
animationDuration: Theme.expressiveDurations.expressiveDefaultSpatial
animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
animationExitCurve: Theme.expressiveCurves.emphasized
onVisibleChanged: () => { onVisibleChanged: () => {
if (!visible) if (!visible)
return; return;

View File

@@ -99,7 +99,7 @@ Rectangle {
backgroundColor: "transparent" backgroundColor: "transparent"
onClicked: { onClicked: {
root.settingsButtonClicked(); root.settingsButtonClicked();
PopoutService.openSettings(); PopoutService.focusOrToggleSettings();
} }
} }

View File

@@ -301,7 +301,7 @@ DankPopout {
let settingsIndex = SettingsData.weatherEnabled ? 4 : 3; let settingsIndex = SettingsData.weatherEnabled ? 4 : 3;
if (index === settingsIndex) { if (index === settingsIndex) {
dashVisible = false; dashVisible = false;
PopoutService.openSettings(); PopoutService.focusOrToggleSettings();
} }
} }
} }

View File

@@ -2,6 +2,8 @@ pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland
import qs.Common
Singleton { Singleton {
id: root 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() { function unloadSettings() {
if (settingsModalLoader) { if (settingsModalLoader) {
settingsModal = null; settingsModal = null;