mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
power profile: put OSD in a lazyloader
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals
|
import qs.Modals
|
||||||
import qs.Modals.Clipboard
|
import qs.Modals.Clipboard
|
||||||
@@ -19,11 +18,9 @@ import qs.Widgets
|
|||||||
import qs.Modules.Notifications.Popup
|
import qs.Modules.Notifications.Popup
|
||||||
import qs.Modules.OSD
|
import qs.Modules.OSD
|
||||||
import qs.Modules.ProcessList
|
import qs.Modules.ProcessList
|
||||||
import qs.Modules.Settings
|
|
||||||
import qs.Modules.DankBar
|
import qs.Modules.DankBar
|
||||||
import qs.Modules.DankBar.Popouts
|
import qs.Modules.DankBar.Popouts
|
||||||
import qs.Modules.WorkspaceOverlays
|
import qs.Modules.WorkspaceOverlays
|
||||||
import qs.Modules.Plugins
|
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -41,12 +38,12 @@ Item {
|
|||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (item) {
|
if (item) {
|
||||||
item.pluginService = PluginService
|
item.pluginService = PluginService;
|
||||||
if (item.popoutService !== undefined) {
|
if (item.popoutService !== undefined) {
|
||||||
item.popoutService = PopoutService
|
item.popoutService = PopoutService;
|
||||||
}
|
}
|
||||||
item.pluginId = pluginId
|
item.pluginId = pluginId;
|
||||||
console.info("Daemon plugin loaded:", pluginId)
|
console.info("Daemon plugin loaded:", pluginId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,9 +82,9 @@ Item {
|
|||||||
|
|
||||||
onColorPickerRequested: {
|
onColorPickerRequested: {
|
||||||
if (colorPickerModal.shouldBeVisible) {
|
if (colorPickerModal.shouldBeVisible) {
|
||||||
colorPickerModal.close()
|
colorPickerModal.close();
|
||||||
} else {
|
} else {
|
||||||
colorPickerModal.show()
|
colorPickerModal.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,21 +105,20 @@ Item {
|
|||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (item) {
|
if (item) {
|
||||||
dockContextMenuLoader.active = true
|
dockContextMenuLoader.active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
initialized = true
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentPositionChanged: {
|
onCurrentPositionChanged: {
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
return
|
return;
|
||||||
|
const comp = sourceComponent;
|
||||||
const comp = sourceComponent
|
sourceComponent = null;
|
||||||
sourceComponent = null
|
sourceComponent = comp;
|
||||||
sourceComponent = comp
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +133,7 @@ Item {
|
|||||||
id: dankDashPopout
|
id: dankDashPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.dankDashPopout = dankDashPopout
|
PopoutService.dankDashPopout = dankDashPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +158,7 @@ Item {
|
|||||||
id: notificationCenter
|
id: notificationCenter
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.notificationCenterPopout = notificationCenter
|
PopoutService.notificationCenterPopout = notificationCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,11 +185,11 @@ Item {
|
|||||||
powerMenuModalLoader: controlCenterLoader.powerModalLoaderRef
|
powerMenuModalLoader: controlCenterLoader.powerModalLoaderRef
|
||||||
|
|
||||||
onLockRequested: {
|
onLockRequested: {
|
||||||
lock.activate()
|
lock.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.controlCenterPopout = controlCenterPopout
|
PopoutService.controlCenterPopout = controlCenterPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,7 +198,7 @@ Item {
|
|||||||
id: wifiPasswordModal
|
id: wifiPasswordModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.wifiPasswordModal = wifiPasswordModal
|
PopoutService.wifiPasswordModal = wifiPasswordModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +210,7 @@ Item {
|
|||||||
id: bluetoothPairingModal
|
id: bluetoothPairingModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.bluetoothPairingModal = bluetoothPairingModal
|
PopoutService.bluetoothPairingModal = bluetoothPairingModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,20 +221,20 @@ Item {
|
|||||||
target: NetworkService
|
target: NetworkService
|
||||||
|
|
||||||
function onCredentialsNeeded(token, ssid, setting, fields, hints, reason, connType, connName, vpnService) {
|
function onCredentialsNeeded(token, ssid, setting, fields, hints, reason, connType, connName, vpnService) {
|
||||||
const now = Date.now()
|
const now = Date.now();
|
||||||
const timeSinceLastPrompt = now - lastCredentialsTime
|
const timeSinceLastPrompt = now - lastCredentialsTime;
|
||||||
|
|
||||||
if (wifiPasswordModal.shouldBeVisible && timeSinceLastPrompt < 1000) {
|
if (wifiPasswordModal.shouldBeVisible && timeSinceLastPrompt < 1000) {
|
||||||
NetworkService.cancelCredentials(lastCredentialsToken)
|
NetworkService.cancelCredentials(lastCredentialsToken);
|
||||||
lastCredentialsToken = token
|
lastCredentialsToken = token;
|
||||||
lastCredentialsTime = now
|
lastCredentialsTime = now;
|
||||||
wifiPasswordModal.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService)
|
wifiPasswordModal.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastCredentialsToken = token
|
lastCredentialsToken = token;
|
||||||
lastCredentialsTime = now
|
lastCredentialsTime = now;
|
||||||
wifiPasswordModal.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService)
|
wifiPasswordModal.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +247,7 @@ Item {
|
|||||||
id: networkInfoModal
|
id: networkInfoModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.networkInfoModal = networkInfoModal
|
PopoutService.networkInfoModal = networkInfoModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,7 +261,7 @@ Item {
|
|||||||
id: batteryPopout
|
id: batteryPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.batteryPopout = batteryPopout
|
PopoutService.batteryPopout = batteryPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,7 +275,7 @@ Item {
|
|||||||
id: layoutPopout
|
id: layoutPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.layoutPopout = layoutPopout
|
PopoutService.layoutPopout = layoutPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +289,7 @@ Item {
|
|||||||
id: vpnPopout
|
id: vpnPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.vpnPopout = vpnPopout
|
PopoutService.vpnPopout = vpnPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,7 +313,7 @@ Item {
|
|||||||
id: processListPopout
|
id: processListPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.processListPopout = processListPopout
|
PopoutService.processListPopout = processListPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,7 +322,7 @@ Item {
|
|||||||
id: settingsModal
|
id: settingsModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.settingsModal = settingsModal
|
PopoutService.settingsModal = settingsModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +335,7 @@ Item {
|
|||||||
id: appDrawerPopout
|
id: appDrawerPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.appDrawerPopout = appDrawerPopout
|
PopoutService.appDrawerPopout = appDrawerPopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +344,7 @@ Item {
|
|||||||
id: spotlightModal
|
id: spotlightModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.spotlightModal = spotlightModal
|
PopoutService.spotlightModal = spotlightModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +352,7 @@ Item {
|
|||||||
id: clipboardHistoryModalPopup
|
id: clipboardHistoryModalPopup
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.clipboardHistoryModal = clipboardHistoryModalPopup
|
PopoutService.clipboardHistoryModal = clipboardHistoryModalPopup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +360,7 @@ Item {
|
|||||||
id: notificationModal
|
id: notificationModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.notificationModal = notificationModal
|
PopoutService.notificationModal = notificationModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +368,7 @@ Item {
|
|||||||
id: colorPickerModal
|
id: colorPickerModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.colorPickerModal = colorPickerModal
|
PopoutService.colorPickerModal = colorPickerModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +381,7 @@ Item {
|
|||||||
id: processListModal
|
id: processListModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.processListModal = processListModal
|
PopoutService.processListModal = processListModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +395,7 @@ Item {
|
|||||||
id: systemUpdatePopout
|
id: systemUpdatePopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.systemUpdatePopout = systemUpdatePopout
|
PopoutService.systemUpdatePopout = systemUpdatePopout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,16 +416,16 @@ Item {
|
|||||||
content: Component {
|
content: Component {
|
||||||
Notepad {
|
Notepad {
|
||||||
onHideRequested: {
|
onHideRequested: {
|
||||||
notepadSlideout.hide()
|
notepadSlideout.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
hide()
|
hide();
|
||||||
} else {
|
} else {
|
||||||
show()
|
show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,43 +440,43 @@ Item {
|
|||||||
id: powerMenuModal
|
id: powerMenuModal
|
||||||
|
|
||||||
onPowerActionRequested: (action, title, message) => {
|
onPowerActionRequested: (action, title, message) => {
|
||||||
if (SettingsData.powerActionConfirm) {
|
if (SettingsData.powerActionConfirm) {
|
||||||
powerConfirmModalLoader.active = true
|
powerConfirmModalLoader.active = true;
|
||||||
if (powerConfirmModalLoader.item) {
|
if (powerConfirmModalLoader.item) {
|
||||||
powerConfirmModalLoader.item.confirmButtonColor = action === "poweroff" ? Theme.error : action === "reboot" ? Theme.warning : Theme.primary
|
powerConfirmModalLoader.item.confirmButtonColor = action === "poweroff" ? Theme.error : action === "reboot" ? Theme.warning : Theme.primary;
|
||||||
powerConfirmModalLoader.item.show(title, message, () => actionApply(action), function () {})
|
powerConfirmModalLoader.item.show(title, message, () => actionApply(action), function () {});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
actionApply(action)
|
actionApply(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onLockRequested: {
|
onLockRequested: {
|
||||||
lock.activate()
|
lock.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function actionApply(action) {
|
function actionApply(action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "logout":
|
case "logout":
|
||||||
SessionService.logout()
|
SessionService.logout();
|
||||||
break
|
break;
|
||||||
case "suspend":
|
case "suspend":
|
||||||
SessionService.suspend()
|
SessionService.suspend();
|
||||||
break
|
break;
|
||||||
case "hibernate":
|
case "hibernate":
|
||||||
SessionService.hibernate()
|
SessionService.hibernate();
|
||||||
break
|
break;
|
||||||
case "reboot":
|
case "reboot":
|
||||||
SessionService.reboot()
|
SessionService.reboot();
|
||||||
break
|
break;
|
||||||
case "poweroff":
|
case "poweroff":
|
||||||
SessionService.poweroff()
|
SessionService.poweroff();
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.powerMenuModal = powerMenuModal
|
PopoutService.powerMenuModal = powerMenuModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,7 +490,7 @@ Item {
|
|||||||
id: keybindsModal
|
id: keybindsModal
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PopoutService.hyprKeybindsModal = keybindsModal
|
PopoutService.hyprKeybindsModal = keybindsModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,11 +556,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Variants {
|
LazyLoader {
|
||||||
model: SettingsData.getFilteredScreens("osd")
|
id: powerProfileOSDLoader
|
||||||
|
active: SettingsData.osdPowerProfileEnabled
|
||||||
|
|
||||||
delegate: PowerProfileOSD {
|
Variants {
|
||||||
modelData: item
|
model: SettingsData.getFilteredScreens("osd")
|
||||||
|
|
||||||
|
delegate: PowerProfileOSD {
|
||||||
|
modelData: item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user