mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Merge branch 'main' into system_monitor_high_pressure_highlight
This commit is contained in:
@@ -122,6 +122,16 @@ PopupWindow {
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
radius: Style.radiusM
|
||||
|
||||
// Fade-in animation
|
||||
opacity: root.visible ? 1.0 : 0.0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationNormal
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
@@ -131,6 +141,16 @@ PopupWindow {
|
||||
contentHeight: columnLayout.implicitHeight
|
||||
interactive: true
|
||||
|
||||
// Fade-in animation
|
||||
opacity: root.visible ? 1.0 : 0.0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationNormal
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
// Use a ColumnLayout to handle menu item arrangement
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
|
||||
@@ -50,6 +50,9 @@ Item {
|
||||
// Ignore the first volume change
|
||||
firstInputVolumeReceived = true
|
||||
} else {
|
||||
// If a tooltip is visible while we show the pill
|
||||
// hide it so it doesn't overlap the volume slider.
|
||||
TooltipService.hide()
|
||||
pill.show()
|
||||
externalHideTimer.restart()
|
||||
}
|
||||
@@ -65,6 +68,7 @@ Item {
|
||||
// Ignore the first mute change
|
||||
firstInputVolumeReceived = true
|
||||
} else {
|
||||
TooltipService.hide()
|
||||
pill.show()
|
||||
externalHideTimer.restart()
|
||||
}
|
||||
@@ -96,6 +100,9 @@ Item {
|
||||
})
|
||||
|
||||
onWheel: function (delta) {
|
||||
// As soon as we start scrolling to adjust volume, hide the tooltip
|
||||
TooltipService.hide()
|
||||
|
||||
wheelAccumulator += delta
|
||||
if (wheelAccumulator >= 120) {
|
||||
wheelAccumulator = 0
|
||||
|
||||
@@ -50,6 +50,8 @@ Item {
|
||||
// Ignore the first volume change
|
||||
firstVolumeReceived = true
|
||||
} else {
|
||||
// Hide any tooltip while the pill is visible / being updated
|
||||
TooltipService.hide()
|
||||
pill.show()
|
||||
externalHideTimer.restart()
|
||||
}
|
||||
@@ -81,6 +83,9 @@ Item {
|
||||
})
|
||||
|
||||
onWheel: function (delta) {
|
||||
// Hide tooltip as soon as the user starts scrolling to adjust volume
|
||||
TooltipService.hide()
|
||||
|
||||
wheelAccumulator += delta
|
||||
if (wheelAccumulator >= 120) {
|
||||
wheelAccumulator = 0
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pam
|
||||
import qs.Commons
|
||||
import qs.Services.System
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
@@ -40,7 +41,7 @@ Scope {
|
||||
PamContext {
|
||||
id: pam
|
||||
config: "login"
|
||||
user: Quickshell.env("USER")
|
||||
user: HostService.displayName
|
||||
|
||||
onPamMessage: {
|
||||
Logger.i("LockContext", "PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired)
|
||||
|
||||
@@ -15,6 +15,7 @@ import qs.Services.Location
|
||||
import qs.Services.Media
|
||||
import qs.Services.Compositor
|
||||
import qs.Services.UI
|
||||
import qs.Services.System
|
||||
import qs.Widgets
|
||||
import qs.Widgets.AudioSpectrum
|
||||
|
||||
@@ -336,7 +337,7 @@ Loader {
|
||||
|
||||
// Welcome back + Username on one line
|
||||
NText {
|
||||
text: I18n.tr("lock-screen.welcome-back") + " " + (Quickshell.env("USER").charAt(0).toUpperCase() + Quickshell.env("USER").slice(1)) + "!"
|
||||
text: I18n.tr("lock-screen.welcome-back") + " " + HostService.displayName + "!"
|
||||
pointSize: Style.fontSizeXXL
|
||||
font.weight: Font.Medium
|
||||
color: Color.mOnSurface
|
||||
|
||||
@@ -56,6 +56,48 @@ Item {
|
||||
// Expose panelBackground as panelItem for AllBackgrounds
|
||||
readonly property var panelItem: panelBackground
|
||||
|
||||
// Primary anchor edge for window positioning
|
||||
readonly property string primaryAnchorEdge: {
|
||||
if (effectivePanelAnchorTop)
|
||||
return "top"
|
||||
if (effectivePanelAnchorBottom)
|
||||
return "bottom"
|
||||
if (effectivePanelAnchorLeft)
|
||||
return "left"
|
||||
if (effectivePanelAnchorRight)
|
||||
return "right"
|
||||
return "top"
|
||||
// default
|
||||
}
|
||||
|
||||
// Calculate window margins for content-sized panel windows
|
||||
function getWindowMargins() {
|
||||
if (!root.width || !root.height)
|
||||
return {
|
||||
"top": 0,
|
||||
"bottom": 0,
|
||||
"left": 0,
|
||||
"right": 0
|
||||
}
|
||||
|
||||
// Determine which edges are anchored (matching SmartPanelWindow logic)
|
||||
var isPrimaryVertical = primaryAnchorEdge === "top" || primaryAnchorEdge === "bottom"
|
||||
var isPrimaryHorizontal = primaryAnchorEdge === "left" || primaryAnchorEdge === "right"
|
||||
|
||||
// Anchor the primary edge + opposite edges of the other axis
|
||||
var useTop = effectivePanelAnchorTop || primaryAnchorEdge === "top" || isPrimaryHorizontal
|
||||
var useBottom = effectivePanelAnchorBottom || primaryAnchorEdge === "bottom" || isPrimaryHorizontal
|
||||
var useLeft = effectivePanelAnchorLeft || primaryAnchorEdge === "left" || isPrimaryVertical
|
||||
var useRight = effectivePanelAnchorRight || primaryAnchorEdge === "right" || isPrimaryVertical
|
||||
|
||||
return {
|
||||
"top": useTop ? panelBackground.targetY : 0,
|
||||
"bottom": useBottom ? (root.height - panelBackground.targetY - panelBackground.targetHeight) : 0,
|
||||
"left": useLeft ? panelBackground.targetX : 0,
|
||||
"right": useRight ? (root.width - panelBackground.targetX - panelBackground.targetWidth) : 0
|
||||
}
|
||||
}
|
||||
|
||||
// Bar configuration
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
|
||||
|
||||
@@ -43,8 +43,8 @@ Item {
|
||||
// Support close with escape
|
||||
property bool closeWithEscape: true
|
||||
|
||||
// Track if window has been created (for lazy loading)
|
||||
property bool windowCreated: false
|
||||
// Track if window should be active (for lazy loading and cleanup)
|
||||
property bool windowActive: false
|
||||
|
||||
// Expose panel state (from content window)
|
||||
readonly property bool isPanelOpen: windowLoader.item ? windowLoader.item.isPanelOpen : false
|
||||
@@ -77,8 +77,8 @@ Item {
|
||||
// Public control functions
|
||||
function toggle(buttonItem, buttonName) {
|
||||
// Ensure window is created before toggling
|
||||
if (!windowCreated) {
|
||||
windowCreated = true
|
||||
if (!root.windowActive) {
|
||||
root.windowActive = true
|
||||
Qt.callLater(function () {
|
||||
if (windowLoader.item) {
|
||||
windowLoader.item.toggle(buttonItem, buttonName)
|
||||
@@ -91,8 +91,8 @@ Item {
|
||||
|
||||
function open(buttonItem, buttonName) {
|
||||
// Ensure window is created before opening
|
||||
if (!windowCreated) {
|
||||
windowCreated = true
|
||||
if (!root.windowActive) {
|
||||
root.windowActive = true
|
||||
Qt.callLater(function () {
|
||||
if (windowLoader.item) {
|
||||
windowLoader.item.open(buttonItem, buttonName)
|
||||
@@ -143,10 +143,10 @@ Item {
|
||||
parent: root.parent
|
||||
}
|
||||
|
||||
// Lazy-load the content window (only created on first open)
|
||||
// Lazy-load the content window (only created when open, destroyed when closed)
|
||||
Loader {
|
||||
id: windowLoader
|
||||
active: root.windowCreated
|
||||
active: root.windowActive
|
||||
sourceComponent: SmartPanelWindow {
|
||||
placeholder: panelPlaceholder
|
||||
panelContent: root.panelContent
|
||||
@@ -156,7 +156,13 @@ Item {
|
||||
|
||||
// Forward signals
|
||||
onPanelOpened: root.opened()
|
||||
onPanelClosed: root.closed()
|
||||
onPanelClosed: {
|
||||
root.closed()
|
||||
// Destroy the window after close animation completes
|
||||
Qt.callLater(function () {
|
||||
root.windowActive = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ PanelWindow {
|
||||
property bool closeWatchdogActive: false
|
||||
property bool openWatchdogActive: false
|
||||
|
||||
// Cached window size (only update when content size changes, not during animation)
|
||||
property real cachedWindowWidth: 0
|
||||
property real cachedWindowHeight: 0
|
||||
|
||||
// Signals
|
||||
signal panelOpened
|
||||
signal panelClosed
|
||||
@@ -57,18 +61,44 @@ PanelWindow {
|
||||
mask: null // No mask - content window is rectangular
|
||||
visible: isPanelOpen
|
||||
|
||||
// Wayland layer shell configuration - fullscreen window
|
||||
// Wayland layer shell configuration - content-sized window
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.namespace: "noctalia-panel-content-" + placeholder.panelName + "-" + (placeholder.screen?.name || "unknown")
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: !root.isPanelOpen ? WlrKeyboardFocus.None : (exclusiveKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.OnDemand)
|
||||
|
||||
// Anchor to all edges to make fullscreen
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
// Dynamic anchoring based on panel position
|
||||
// For correct positioning with Wayland layer shell:
|
||||
// - Anchor the primary edge (top/bottom/left/right)
|
||||
// - Also anchor the opposite edge of the OTHER axis (both horizontal edges if panel is vertical, both vertical edges if panel is horizontal)
|
||||
// This prevents unwanted centering and allows margins to position the panel correctly
|
||||
readonly property bool isPrimaryVertical: placeholder.primaryAnchorEdge === "top" || placeholder.primaryAnchorEdge === "bottom"
|
||||
readonly property bool isPrimaryHorizontal: placeholder.primaryAnchorEdge === "left" || placeholder.primaryAnchorEdge === "right"
|
||||
|
||||
anchors.top: placeholder.effectivePanelAnchorTop || placeholder.primaryAnchorEdge === "top" || isPrimaryHorizontal
|
||||
anchors.bottom: placeholder.effectivePanelAnchorBottom || placeholder.primaryAnchorEdge === "bottom" || isPrimaryHorizontal
|
||||
anchors.left: placeholder.effectivePanelAnchorLeft || placeholder.primaryAnchorEdge === "left" || isPrimaryVertical
|
||||
anchors.right: placeholder.effectivePanelAnchorRight || placeholder.primaryAnchorEdge === "right" || isPrimaryVertical
|
||||
|
||||
// Size to content (cached to avoid resizing during animations)
|
||||
implicitWidth: cachedWindowWidth
|
||||
implicitHeight: cachedWindowHeight
|
||||
|
||||
// Position via margins (calculated from target position, not animated position)
|
||||
readonly property var windowMargins: placeholder.getWindowMargins()
|
||||
margins.top: windowMargins.top
|
||||
margins.bottom: windowMargins.bottom
|
||||
margins.left: windowMargins.left
|
||||
margins.right: windowMargins.right
|
||||
|
||||
// Debug logging for positioning
|
||||
Component.onCompleted: {
|
||||
Logger.d("SmartPanelWindow", "Panel positioning:", placeholder.panelName)
|
||||
Logger.d("SmartPanelWindow", " primaryAnchorEdge:", placeholder.primaryAnchorEdge)
|
||||
Logger.d("SmartPanelWindow", " isPrimaryVertical:", isPrimaryVertical, "isPrimaryHorizontal:", isPrimaryHorizontal)
|
||||
Logger.d("SmartPanelWindow", " anchors:", anchors.top, anchors.bottom, anchors.left, anchors.right)
|
||||
Logger.d("SmartPanelWindow", " margins (TLBR):", windowMargins.top, windowMargins.left, windowMargins.bottom, windowMargins.right)
|
||||
Logger.d("SmartPanelWindow", " size:", cachedWindowWidth, "x", cachedWindowHeight)
|
||||
}
|
||||
|
||||
// Sync state to placeholder
|
||||
@@ -82,6 +112,19 @@ PanelWindow {
|
||||
placeholder.opacityFadeComplete = opacityFadeComplete
|
||||
}
|
||||
|
||||
// Update cached window size (only when target size changes)
|
||||
function updateWindowSize() {
|
||||
var targetWidth = placeholder.panelItem.targetWidth
|
||||
var targetHeight = placeholder.panelItem.targetHeight
|
||||
|
||||
// Only update if size actually changed
|
||||
if (cachedWindowWidth !== targetWidth || cachedWindowHeight !== targetHeight) {
|
||||
cachedWindowWidth = targetWidth
|
||||
cachedWindowHeight = targetHeight
|
||||
Logger.d("SmartPanelWindow", "Window size updated:", targetWidth, "x", targetHeight, placeholder.panelName)
|
||||
}
|
||||
}
|
||||
|
||||
// Panel control functions
|
||||
function toggle(buttonItem, buttonName) {
|
||||
if (!isPanelOpen) {
|
||||
@@ -110,6 +153,9 @@ PanelWindow {
|
||||
placeholder.useButtonPosition = false
|
||||
}
|
||||
|
||||
// Initialize cached window size
|
||||
updateWindowSize()
|
||||
|
||||
// Set isPanelOpen to trigger content loading
|
||||
isPanelOpen = true
|
||||
|
||||
@@ -164,12 +210,13 @@ PanelWindow {
|
||||
Logger.d("SmartPanelWindow", "Panel close finalized", placeholder.panelName)
|
||||
}
|
||||
|
||||
// Fullscreen container for click-to-close and content
|
||||
// Content wrapper with opacity animation (fills content-sized window)
|
||||
Item {
|
||||
id: contentWrapper
|
||||
anchors.fill: parent
|
||||
focus: true // Enable keyboard event handling
|
||||
focus: true
|
||||
|
||||
// Handle keyboard events directly via Keys handler
|
||||
// Keyboard event handling
|
||||
Keys.onPressed: event => {
|
||||
Logger.d("SmartPanelWindow", "Key pressed:", event.key, "for panel:", placeholder.panelName)
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
@@ -228,143 +275,120 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Background MouseArea for click-to-close (behind content)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: root.isPanelOpen && !root.isClosing
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: mouse => {
|
||||
root.close()
|
||||
mouse.accepted = true
|
||||
}
|
||||
z: 0
|
||||
// Opacity animation
|
||||
opacity: {
|
||||
if (isClosing)
|
||||
return 0.0
|
||||
if (isPanelVisible && sizeAnimationComplete)
|
||||
return 1.0
|
||||
return 0.0
|
||||
}
|
||||
|
||||
// Content wrapper with opacity animation
|
||||
Item {
|
||||
id: contentWrapper
|
||||
// Position at placeholder location within fullscreen window
|
||||
x: placeholder.panelItem.x
|
||||
y: placeholder.panelItem.y
|
||||
width: placeholder.panelItem.width
|
||||
height: placeholder.panelItem.height
|
||||
z: 1 // Above click-to-close MouseArea
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
id: opacityAnimation
|
||||
duration: root.isClosing ? Style.animationFaster : Style.animationFast
|
||||
easing.type: Easing.OutQuad
|
||||
|
||||
// Opacity animation
|
||||
opacity: {
|
||||
if (isClosing)
|
||||
return 0.0
|
||||
if (isPanelVisible && sizeAnimationComplete)
|
||||
return 1.0
|
||||
return 0.0
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
id: opacityAnimation
|
||||
duration: root.isClosing ? Style.animationFaster : Style.animationFast
|
||||
easing.type: Easing.OutQuad
|
||||
|
||||
onRunningChanged: {
|
||||
// Safety: Zero-duration animation handling
|
||||
if (!running && duration === 0) {
|
||||
if (root.isClosing && contentWrapper.opacity === 0.0) {
|
||||
root.opacityFadeComplete = true
|
||||
var shouldFinalizeNow = placeholder.panelItem && !placeholder.panelItem.shouldAnimateWidth && !placeholder.panelItem.shouldAnimateHeight
|
||||
if (shouldFinalizeNow) {
|
||||
Logger.d("SmartPanelWindow", "Zero-duration opacity + no size animation - finalizing", placeholder.panelName)
|
||||
Qt.callLater(root.finalizeClose)
|
||||
}
|
||||
} else if (root.isPanelVisible && contentWrapper.opacity === 1.0) {
|
||||
root.openWatchdogActive = false
|
||||
openWatchdogTimer.stop()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// When opacity fade completes during close, trigger size animation
|
||||
if (!running && root.isClosing && contentWrapper.opacity === 0.0) {
|
||||
onRunningChanged: {
|
||||
// Safety: Zero-duration animation handling
|
||||
if (!running && duration === 0) {
|
||||
if (root.isClosing && contentWrapper.opacity === 0.0) {
|
||||
root.opacityFadeComplete = true
|
||||
var shouldFinalizeNow = placeholder.panelItem && !placeholder.panelItem.shouldAnimateWidth && !placeholder.panelItem.shouldAnimateHeight
|
||||
if (shouldFinalizeNow) {
|
||||
Logger.d("SmartPanelWindow", "No animation - finalizing immediately", placeholder.panelName)
|
||||
Logger.d("SmartPanelWindow", "Zero-duration opacity + no size animation - finalizing", placeholder.panelName)
|
||||
Qt.callLater(root.finalizeClose)
|
||||
} else {
|
||||
Logger.d("SmartPanelWindow", "Animation will run - waiting for size animation", placeholder.panelName)
|
||||
}
|
||||
} // When opacity fade completes during open, stop watchdog
|
||||
else if (!running && root.isPanelVisible && contentWrapper.opacity === 1.0) {
|
||||
} else if (root.isPanelVisible && contentWrapper.opacity === 1.0) {
|
||||
root.openWatchdogActive = false
|
||||
openWatchdogTimer.stop()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Panel content loader
|
||||
Loader {
|
||||
id: contentLoader
|
||||
active: isPanelOpen
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.panelContent
|
||||
|
||||
// When content finishes loading, trigger positioning and visibility
|
||||
onLoaded: {
|
||||
// Capture initial content-driven size if available
|
||||
if (contentLoader.item) {
|
||||
var hasWidthProp = contentLoader.item.hasOwnProperty('contentPreferredWidth')
|
||||
var hasHeightProp = contentLoader.item.hasOwnProperty('contentPreferredHeight')
|
||||
|
||||
if (hasWidthProp || hasHeightProp) {
|
||||
var initialWidth = hasWidthProp ? contentLoader.item.contentPreferredWidth : 0
|
||||
var initialHeight = hasHeightProp ? contentLoader.item.contentPreferredHeight : 0
|
||||
placeholder.updateContentSize(initialWidth, initialHeight)
|
||||
Logger.d("SmartPanelWindow", "Initial content size:", initialWidth, "x", initialHeight, placeholder.panelName)
|
||||
// When opacity fade completes during close, trigger size animation
|
||||
if (!running && root.isClosing && contentWrapper.opacity === 0.0) {
|
||||
root.opacityFadeComplete = true
|
||||
var shouldFinalizeNow = placeholder.panelItem && !placeholder.panelItem.shouldAnimateWidth && !placeholder.panelItem.shouldAnimateHeight
|
||||
if (shouldFinalizeNow) {
|
||||
Logger.d("SmartPanelWindow", "No animation - finalizing immediately", placeholder.panelName)
|
||||
Qt.callLater(root.finalizeClose)
|
||||
} else {
|
||||
Logger.d("SmartPanelWindow", "Animation will run - waiting for size animation", placeholder.panelName)
|
||||
}
|
||||
} // When opacity fade completes during open, stop watchdog
|
||||
else if (!running && root.isPanelVisible && contentWrapper.opacity === 1.0) {
|
||||
root.openWatchdogActive = false
|
||||
openWatchdogTimer.stop()
|
||||
}
|
||||
|
||||
// Calculate position in placeholder
|
||||
placeholder.setPosition()
|
||||
|
||||
// Make panel visible on the next frame
|
||||
Qt.callLater(function () {
|
||||
root.isPanelVisible = true
|
||||
opacityTrigger.start()
|
||||
|
||||
// Start open watchdog timer
|
||||
root.openWatchdogActive = true
|
||||
openWatchdogTimer.start()
|
||||
|
||||
panelOpened()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea to prevent clicks on panel content from closing it
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: mouse => {
|
||||
mouse.accepted = true // Eat the click to prevent propagation to background
|
||||
}
|
||||
z: -1 // Behind content but above background click-to-close
|
||||
}
|
||||
// Panel content loader
|
||||
Loader {
|
||||
id: contentLoader
|
||||
active: isPanelOpen
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.panelContent
|
||||
|
||||
// Watch for changes in content-driven sizes
|
||||
Connections {
|
||||
target: contentLoader.item
|
||||
ignoreUnknownSignals: true
|
||||
// When content finishes loading, trigger positioning and visibility
|
||||
onLoaded: {
|
||||
// Capture initial content-driven size if available
|
||||
if (contentLoader.item) {
|
||||
var hasWidthProp = contentLoader.item.hasOwnProperty('contentPreferredWidth')
|
||||
var hasHeightProp = contentLoader.item.hasOwnProperty('contentPreferredHeight')
|
||||
|
||||
function onContentPreferredWidthChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(contentLoader.item.contentPreferredWidth, placeholder.contentPreferredHeight)
|
||||
if (hasWidthProp || hasHeightProp) {
|
||||
var initialWidth = hasWidthProp ? contentLoader.item.contentPreferredWidth : 0
|
||||
var initialHeight = hasHeightProp ? contentLoader.item.contentPreferredHeight : 0
|
||||
placeholder.updateContentSize(initialWidth, initialHeight)
|
||||
Logger.d("SmartPanelWindow", "Initial content size:", initialWidth, "x", initialHeight, placeholder.panelName)
|
||||
}
|
||||
}
|
||||
|
||||
function onContentPreferredHeightChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(placeholder.contentPreferredWidth, contentLoader.item.contentPreferredHeight)
|
||||
}
|
||||
// Calculate position in placeholder
|
||||
placeholder.setPosition()
|
||||
|
||||
// Make panel visible on the next frame
|
||||
Qt.callLater(function () {
|
||||
root.isPanelVisible = true
|
||||
opacityTrigger.start()
|
||||
|
||||
// Start open watchdog timer
|
||||
root.openWatchdogActive = true
|
||||
openWatchdogTimer.start()
|
||||
|
||||
panelOpened()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea to prevent clicks on panel content from closing it
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: mouse => {
|
||||
mouse.accepted = true // Eat the click to prevent propagation to background
|
||||
}
|
||||
z: -1 // Behind content but above background click-to-close
|
||||
}
|
||||
|
||||
// Watch for changes in content-driven sizes
|
||||
Connections {
|
||||
target: contentLoader.item
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
function onContentPreferredWidthChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(contentLoader.item.contentPreferredWidth, placeholder.contentPreferredHeight)
|
||||
}
|
||||
}
|
||||
|
||||
function onContentPreferredHeightChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(placeholder.contentPreferredWidth, contentLoader.item.contentPreferredHeight)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,6 +440,16 @@ PanelWindow {
|
||||
Connections {
|
||||
target: placeholder.panelItem
|
||||
|
||||
function onTargetWidthChanged() {
|
||||
// Update cached window size when target changes (not during animation)
|
||||
root.updateWindowSize()
|
||||
}
|
||||
|
||||
function onTargetHeightChanged() {
|
||||
// Update cached window size when target changes (not during animation)
|
||||
root.updateWindowSize()
|
||||
}
|
||||
|
||||
function onWidthChanged() {
|
||||
// When width shrinks to 0 during close and we're animating width, finalize
|
||||
if (root.isClosing && placeholder.panelItem.width === 0 && placeholder.panelItem.shouldAnimateWidth) {
|
||||
|
||||
+54
-11
@@ -34,11 +34,13 @@ Variants {
|
||||
readonly property bool isMuted: AudioService.muted
|
||||
property bool volumeInitialized: false
|
||||
property bool muteInitialized: false
|
||||
property real lastKnownVolume: -1 // Track last known volume to detect actual changes
|
||||
|
||||
// Input volume properties
|
||||
readonly property real currentInputVolume: AudioService.inputVolume
|
||||
readonly property bool isInputMuted: AudioService.inputMuted
|
||||
property bool inputAudioInitialized: false
|
||||
property real lastKnownInputVolume: -1 // Track last known volume to detect actual changes
|
||||
|
||||
// Brightness properties
|
||||
property real lastUpdatedBrightness: 0
|
||||
@@ -497,32 +499,66 @@ Variants {
|
||||
target: AudioService
|
||||
|
||||
function onVolumeChanged() {
|
||||
if (volumeInitialized) {
|
||||
// If not initialized yet, capture initial volume silently (fallback if timer hasn't fired)
|
||||
if (lastKnownVolume < 0) {
|
||||
lastKnownVolume = AudioService.volume
|
||||
volumeInitialized = true
|
||||
return
|
||||
}
|
||||
if (!volumeInitialized) {
|
||||
return
|
||||
}
|
||||
// Only show OSD if volume actually changed from last known value
|
||||
if (Math.abs(AudioService.volume - lastKnownVolume) > 0.001) {
|
||||
lastKnownVolume = AudioService.volume
|
||||
showOSD("volume")
|
||||
}
|
||||
}
|
||||
|
||||
function onMutedChanged() {
|
||||
if (muteInitialized) {
|
||||
showOSD("volume")
|
||||
// If not initialized yet, capture initial state silently (fallback if timer hasn't fired)
|
||||
if (lastKnownVolume < 0) {
|
||||
lastKnownVolume = AudioService.volume
|
||||
muteInitialized = true
|
||||
return
|
||||
}
|
||||
if (!muteInitialized) {
|
||||
return
|
||||
}
|
||||
showOSD("volume")
|
||||
}
|
||||
|
||||
function onInputVolumeChanged() {
|
||||
if (!inputAudioInitialized) {
|
||||
return
|
||||
}
|
||||
if (!AudioService.hasInput) {
|
||||
return
|
||||
}
|
||||
showOSD("inputVolume")
|
||||
// If not initialized yet, capture initial volume silently (fallback if timer hasn't fired)
|
||||
if (lastKnownInputVolume < 0) {
|
||||
lastKnownInputVolume = AudioService.inputVolume
|
||||
inputAudioInitialized = true
|
||||
return
|
||||
}
|
||||
if (!inputAudioInitialized) {
|
||||
return
|
||||
}
|
||||
// Only show OSD if volume actually changed from last known value
|
||||
if (Math.abs(AudioService.inputVolume - lastKnownInputVolume) > 0.001) {
|
||||
lastKnownInputVolume = AudioService.inputVolume
|
||||
showOSD("inputVolume")
|
||||
}
|
||||
}
|
||||
|
||||
function onInputMutedChanged() {
|
||||
if (!inputAudioInitialized) {
|
||||
if (!AudioService.hasInput) {
|
||||
return
|
||||
}
|
||||
if (!AudioService.hasInput) {
|
||||
// If not initialized yet, capture initial state silently (fallback if timer hasn't fired)
|
||||
if (lastKnownInputVolume < 0) {
|
||||
lastKnownInputVolume = AudioService.inputVolume
|
||||
inputAudioInitialized = true
|
||||
return
|
||||
}
|
||||
if (!inputAudioInitialized) {
|
||||
return
|
||||
}
|
||||
showOSD("inputVolume")
|
||||
@@ -535,9 +571,16 @@ Variants {
|
||||
interval: 500
|
||||
running: true
|
||||
onTriggered: {
|
||||
volumeInitialized = true
|
||||
// Capture initial volume values to avoid showing OSD on startup
|
||||
if (lastKnownVolume < 0 && AudioService.volume !== undefined) {
|
||||
lastKnownVolume = AudioService.volume
|
||||
volumeInitialized = true
|
||||
}
|
||||
if (lastKnownInputVolume < 0 && AudioService.hasInput && AudioService.inputVolume !== undefined) {
|
||||
lastKnownInputVolume = AudioService.inputVolume
|
||||
inputAudioInitialized = true
|
||||
}
|
||||
muteInitialized = true
|
||||
inputAudioInitialized = true
|
||||
// Brightness initializes on first change to avoid showing OSD on startup
|
||||
connectBrightnessMonitors()
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import Quickshell.Widgets
|
||||
import qs.Commons
|
||||
import qs.Modules.Panels.ControlCenter.Cards
|
||||
import qs.Modules.Panels.Settings
|
||||
import qs.Services.System
|
||||
import qs.Services.UI
|
||||
import qs.Widgets
|
||||
|
||||
@@ -37,7 +38,7 @@ NBox {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
NText {
|
||||
text: Quickshell.env("USER") || "user"
|
||||
text: HostService.displayName
|
||||
font.weight: Style.fontWeightBold
|
||||
font.capitalization: Font.Capitalize
|
||||
}
|
||||
|
||||
@@ -259,11 +259,6 @@ SmartPanel {
|
||||
"label": "settings.screen-recorder.title",
|
||||
"icon": "settings-screen-recorder",
|
||||
"source": screenRecorderTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.SessionMenu,
|
||||
"label": "settings.session-menu.title",
|
||||
"icon": "settings-session-menu",
|
||||
"source": sessionMenuTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.SystemMonitor,
|
||||
"label": "settings.system-monitor.title",
|
||||
|
||||
@@ -677,6 +677,8 @@ ColumnLayout {
|
||||
enabled: ProgramCheckerService.availableDiscordClients.length > 0
|
||||
opacity: ProgramCheckerService.availableDiscordClients.length > 0 ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
// Set unified discord property
|
||||
Settings.data.templates.discord = checked
|
||||
// Enable/disable all detected Discord clients
|
||||
for (var i = 0; i < ProgramCheckerService.availableDiscordClients.length; i++) {
|
||||
var client = ProgramCheckerService.availableDiscordClients[i]
|
||||
@@ -740,19 +742,50 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// Code clients - single toggle with dynamic description
|
||||
NCheckbox {
|
||||
id: codeToggle
|
||||
label: "Code"
|
||||
description: ProgramCheckerService.codeAvailable ? I18n.tr("settings.color-scheme.templates.programs.code.description", {
|
||||
"filepath": "~/.vscode/extensions/hyprluna.hyprluna-theme-1.0.2/themes/hyprluna.json"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.code.description-missing", {
|
||||
"app": "code"
|
||||
})
|
||||
checked: Settings.data.templates.code
|
||||
enabled: ProgramCheckerService.codeAvailable
|
||||
opacity: ProgramCheckerService.codeAvailable ? 1.0 : 0.6
|
||||
description: {
|
||||
if (ProgramCheckerService.availableCodeClients.length === 0) {
|
||||
return I18n.tr("settings.color-scheme.templates.programs.code.description-missing")
|
||||
} else {
|
||||
// Show detected clients
|
||||
var clientInfo = []
|
||||
for (var i = 0; i < ProgramCheckerService.availableCodeClients.length; i++) {
|
||||
var client = ProgramCheckerService.availableCodeClients[i]
|
||||
// Capitalize first letter and format nicely
|
||||
var clientName = client.name === "code" ? "VSCode" : "VSCodium"
|
||||
clientInfo.push(clientName)
|
||||
}
|
||||
return "Detected: " + clientInfo.join(", ")
|
||||
}
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: -1
|
||||
checked: {
|
||||
// Check if any Code client template is enabled
|
||||
var anyEnabled = false
|
||||
for (var i = 0; i < ProgramCheckerService.availableCodeClients.length; i++) {
|
||||
var client = ProgramCheckerService.availableCodeClients[i]
|
||||
if (Settings.data.templates["code_" + client.name]) {
|
||||
anyEnabled = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return anyEnabled
|
||||
}
|
||||
enabled: ProgramCheckerService.availableCodeClients.length > 0
|
||||
opacity: ProgramCheckerService.availableCodeClients.length > 0 ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
if (ProgramCheckerService.codeAvailable) {
|
||||
Settings.data.templates.code = checked
|
||||
// Set unified code property
|
||||
Settings.data.templates.code = checked
|
||||
// Enable/disable all detected Code clients
|
||||
for (var i = 0; i < ProgramCheckerService.availableCodeClients.length; i++) {
|
||||
var client = ProgramCheckerService.availableCodeClients[i]
|
||||
Settings.data.templates["code_" + client.name] = checked
|
||||
}
|
||||
if (ProgramCheckerService.availableCodeClients.length > 0) {
|
||||
AppThemeService.generate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ ColumnLayout {
|
||||
|
||||
NTextInputButton {
|
||||
label: I18n.tr("settings.general.profile.picture.label", {
|
||||
"user": Quickshell.env("USER" || "User")
|
||||
"user": HostService.displayName
|
||||
})
|
||||
description: I18n.tr("settings.general.profile.picture.description")
|
||||
text: Settings.data.general.avatarImage
|
||||
|
||||
Reference in New Issue
Block a user