mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-28 22:12:10 -04:00
feat(popouts): hover & settings cleanup
This commit is contained in:
@@ -98,6 +98,7 @@ DankPopout {
|
||||
property bool anyModalOpen: credentialsPromptOpen || wifiPasswordModalOpen || polkitModalOpen || powerMenuOpen
|
||||
|
||||
backgroundInteractive: !anyModalOpen
|
||||
hoverDismissSuspended: editMode || anyModalOpen
|
||||
|
||||
onCredentialsPromptOpenChanged: {
|
||||
if (credentialsPromptOpen && shouldBeVisible)
|
||||
|
||||
@@ -95,6 +95,14 @@ Item {
|
||||
enableFrameInsetAnimation.schedule();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: topBarContent._hasBarWindow ? topBarContent.barWindow.axis : null
|
||||
|
||||
function onEdgeChanged() {
|
||||
topBarContent.resetHoverForBarGeometryChange();
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on anchors.leftMargin {
|
||||
enabled: _animateFrameInsets && _usesFrameBarChrome
|
||||
NumberAnimation {
|
||||
@@ -401,6 +409,19 @@ Item {
|
||||
property var _pendingHoverHit: null
|
||||
property string _pendingHoverTrigger: ""
|
||||
|
||||
function resetHoverForBarGeometryChange() {
|
||||
_cancelPendingHover();
|
||||
_hoverCloseTimer.stop();
|
||||
_pendingPopoutOpenSpec = null;
|
||||
|
||||
const activePopout = PopoutManager.getActivePopout(barWindow?.screen);
|
||||
const hasTransientSurface = activeHoverTrigger !== "" || activePopout?.hoverDismissEnabled === true;
|
||||
if (hasTransientSurface && !PopoutManager.isActivePopoutPinned(barWindow?.screen))
|
||||
closeHoverSurfaces();
|
||||
else
|
||||
activeHoverTrigger = "";
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _hoverIntentTimer
|
||||
interval: topBarContent.hoverPopoutDelay
|
||||
@@ -525,6 +546,9 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof popout.prepareForTrigger === "function")
|
||||
popout.prepareForTrigger(spec.triggerSource, mode);
|
||||
|
||||
if (spec.prepare)
|
||||
spec.prepare(popout);
|
||||
|
||||
@@ -859,6 +883,10 @@ Item {
|
||||
const inst = _notepadWidgetForScreen()?.notepadInstance;
|
||||
return inst?.isVisible ?? false;
|
||||
}
|
||||
if (activeHoverTrigger.startsWith("tray-")) {
|
||||
const screenName = barWindow.screen?.name;
|
||||
return !!(screenName && TrayMenuManager.activeTrayMenus[screenName]);
|
||||
}
|
||||
const popout = PopoutManager.getActivePopout(barWindow?.screen);
|
||||
if (!popout)
|
||||
return false;
|
||||
@@ -1116,12 +1144,19 @@ Item {
|
||||
if (!PopoutManager.cursorOverBar(_lastHoverGlobalX, _lastHoverGlobalY))
|
||||
return;
|
||||
|
||||
const activePopout = PopoutManager.getActivePopout(barWindow?.screen);
|
||||
const targetLoader = _loaderForWidgetId(hit.widgetId);
|
||||
const targetPopout = _resolvePopoutFromLoader(targetLoader);
|
||||
const managerOwnsTransition = !!(activePopout && targetPopout);
|
||||
|
||||
// A different trigger backed by the same already-open popout swaps tab/position
|
||||
// in place (requestHoverPopout handles it) — don't close+reopen the same surface.
|
||||
// in place. PopoutManager also owns handoff between loaded popouts, so only
|
||||
// pre-close special/unmanaged surfaces here.
|
||||
if (triggerKey !== activeHoverTrigger && activeHoverTrigger !== "" && !_hitTargetsActivePopout(hit)) {
|
||||
// Mark popout as superseded to fade in-place before closing.
|
||||
_beginSupersededCloseForActive();
|
||||
closeHoverSurfaces();
|
||||
if (!managerOwnsTransition) {
|
||||
_beginSupersededCloseForActive();
|
||||
closeHoverSurfaces();
|
||||
}
|
||||
}
|
||||
|
||||
if (!openHoverPopoutForHit(hit)) {
|
||||
|
||||
@@ -26,6 +26,19 @@ DankPopout {
|
||||
open();
|
||||
}
|
||||
|
||||
function prepareForTrigger(triggerSource) {
|
||||
switch (triggerSource) {
|
||||
case "memory":
|
||||
DgopService.setSortBy("memory");
|
||||
break;
|
||||
case "cpu":
|
||||
case "cpu_temp":
|
||||
case "gpu_temp":
|
||||
DgopService.setSortBy("cpu");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
popupWidth: Math.round(Theme.fontSizeMedium * 46)
|
||||
popupHeight: Math.round(Theme.fontSizeMedium * 39)
|
||||
triggerWidth: 55
|
||||
|
||||
@@ -1256,6 +1256,50 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleCard {
|
||||
iconName: "touch_app"
|
||||
title: I18n.tr("Hover Popouts")
|
||||
description: I18n.tr("Open widget popouts by hovering over the bar. Moving to another widget switches the popout.")
|
||||
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
||||
enabled: !(selectedBarConfig?.clickThrough ?? false)
|
||||
opacity: (selectedBarConfig?.clickThrough ?? false) ? 0.5 : 1.0
|
||||
checked: selectedBarConfig?.hoverPopouts ?? false
|
||||
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
|
||||
hoverPopouts: checked
|
||||
})
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
visible: selectedBarConfig?.hoverPopouts ?? false
|
||||
leftPadding: Theme.spacingM
|
||||
|
||||
SettingsSliderRow {
|
||||
id: hoverDelaySlider
|
||||
width: parent.width - parent.leftPadding
|
||||
text: I18n.tr("Open Delay")
|
||||
description: I18n.tr("Time to rest on a widget before its popout opens")
|
||||
value: selectedBarConfig?.hoverPopoutDelay ?? 150
|
||||
minimum: 0
|
||||
maximum: 1000
|
||||
unit: "ms"
|
||||
defaultValue: 150
|
||||
onSliderValueChanged: newValue => {
|
||||
SettingsData.updateBarConfig(selectedBarId, {
|
||||
hoverPopoutDelay: newValue
|
||||
});
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: hoverDelaySlider
|
||||
property: "value"
|
||||
value: selectedBarConfig?.hoverPopoutDelay ?? 150
|
||||
restoreMode: Binding.RestoreBinding
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleCard {
|
||||
iconName: "fit_screen"
|
||||
title: I18n.tr("Maximize Detection")
|
||||
@@ -1800,50 +1844,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleCard {
|
||||
iconName: "touch_app"
|
||||
title: I18n.tr("Hover Popouts")
|
||||
description: I18n.tr("Open widget popouts by hovering over the bar. Moving to another widget switches the popout.")
|
||||
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
||||
enabled: !(selectedBarConfig?.clickThrough ?? false)
|
||||
opacity: (selectedBarConfig?.clickThrough ?? false) ? 0.5 : 1.0
|
||||
checked: selectedBarConfig?.hoverPopouts ?? false
|
||||
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
|
||||
hoverPopouts: checked
|
||||
})
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
visible: selectedBarConfig?.hoverPopouts ?? false
|
||||
leftPadding: Theme.spacingM
|
||||
|
||||
SettingsSliderRow {
|
||||
id: hoverDelaySlider
|
||||
width: parent.width - parent.leftPadding
|
||||
text: I18n.tr("Open Delay")
|
||||
description: I18n.tr("Time to rest on a widget before its popout opens")
|
||||
value: selectedBarConfig?.hoverPopoutDelay ?? 150
|
||||
minimum: 0
|
||||
maximum: 1000
|
||||
unit: "ms"
|
||||
defaultValue: 150
|
||||
onSliderValueChanged: newValue => {
|
||||
SettingsData.updateBarConfig(selectedBarId, {
|
||||
hoverPopoutDelay: newValue
|
||||
});
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: hoverDelaySlider
|
||||
property: "value"
|
||||
value: selectedBarConfig?.hoverPopoutDelay ?? 150
|
||||
restoreMode: Binding.RestoreBinding
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleCard {
|
||||
iconName: "mouse"
|
||||
title: I18n.tr("Scroll Wheel")
|
||||
|
||||
@@ -359,7 +359,7 @@ Item {
|
||||
tags: ["background", "color", "fill", "fit", "custom"]
|
||||
settingKey: "wallpaperBackgroundColorMode"
|
||||
text: I18n.tr("Background Color")
|
||||
description: I18n.tr("Color shown for areas not covered by wallpaper (e.g. Fit or Pad modes)")
|
||||
description: I18n.tr("Color shown for areas not covered by wallpaper")
|
||||
visible: root.currentWallpaper !== "" && !root.currentWallpaper.startsWith("#")
|
||||
dropdownWidth: 220
|
||||
options: [
|
||||
|
||||
Reference in New Issue
Block a user