mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Merge with noctalia main
This commit is contained in:
@@ -297,13 +297,7 @@
|
||||
"walker": false,
|
||||
"code": false,
|
||||
"spicetify": false,
|
||||
"enableUserTemplates": false,
|
||||
"discord_vesktop": false,
|
||||
"discord_webcord": false,
|
||||
"discord_armcord": false,
|
||||
"discord_equibop": false,
|
||||
"discord_lightcord": false,
|
||||
"discord_dorion": false
|
||||
"enableUserTemplates": false
|
||||
},
|
||||
"nightLight": {
|
||||
"enabled": false,
|
||||
|
||||
+24
-23
@@ -438,17 +438,6 @@ Singleton {
|
||||
property bool code: false
|
||||
property bool spicetify: false
|
||||
property bool enableUserTemplates: false
|
||||
|
||||
property bool code_code: false
|
||||
property bool code_codium: false
|
||||
|
||||
property bool discord_vesktop: false // To be deleted soon
|
||||
property bool discord_webcord: false // To be deleted soon
|
||||
property bool discord_armcord: false // To be deleted soon
|
||||
property bool discord_equibop: false // To be deleted soon
|
||||
property bool discord_lightcord: false // To be deleted soon
|
||||
property bool discord_dorion: false // To be deleted soon
|
||||
property bool discord_vencord: false // To be deleted soon
|
||||
}
|
||||
|
||||
// night light
|
||||
@@ -658,22 +647,34 @@ Singleton {
|
||||
// 5th. Migrate Discord templates (version 20 → 21)
|
||||
// Consolidate individual discord_* properties into unified discord property
|
||||
if (adapter.settingsVersion < 21) {
|
||||
var anyDiscordEnabled = false
|
||||
// Read raw JSON file to access properties not in adapter schema
|
||||
try {
|
||||
var rawJson = settingsFileView.text()
|
||||
|
||||
// Check if any Discord client was enabled
|
||||
const discordClients = ["discord_vesktop", "discord_webcord", "discord_armcord", "discord_equibop", "discord_lightcord", "discord_dorion", "discord_vencord"]
|
||||
if (rawJson) {
|
||||
var parsed = JSON.parse(rawJson)
|
||||
var anyDiscordEnabled = false
|
||||
|
||||
for (var i = 0; i < discordClients.length; i++) {
|
||||
if (adapter.templates[discordClients[i]]) {
|
||||
anyDiscordEnabled = true
|
||||
break
|
||||
// Check if any Discord client was enabled
|
||||
const discordClients = ["discord_vesktop", "discord_webcord", "discord_armcord", "discord_equibop", "discord_lightcord", "discord_dorion", "discord_vencord"]
|
||||
|
||||
if (parsed.templates) {
|
||||
for (var i = 0; i < discordClients.length; i++) {
|
||||
if (parsed.templates[discordClients[i]]) {
|
||||
anyDiscordEnabled = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set unified discord property
|
||||
adapter.templates.discord = anyDiscordEnabled
|
||||
|
||||
Logger.i("Settings", "Migrated Discord templates to unified 'discord' property (enabled:", anyDiscordEnabled + ")")
|
||||
}
|
||||
} catch (error) {
|
||||
Logger.w("Settings", "Failed to read raw JSON for Discord migration:", error)
|
||||
}
|
||||
|
||||
// Set unified discord property
|
||||
adapter.templates.discord = anyDiscordEnabled
|
||||
|
||||
Logger.i("Settings", "Migrated Discord templates to unified 'discord' property (enabled:", anyDiscordEnabled + ")")
|
||||
}
|
||||
|
||||
// -----------------
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ Singleton {
|
||||
var vol = source.audio.volume
|
||||
if (vol !== undefined && !isNaN(vol)) {
|
||||
root._inputVolume = vol
|
||||
} else {
|
||||
root._inputVolume = 0
|
||||
}
|
||||
// Don't reset to 0 if volume is undefined/NaN - preserve last known value
|
||||
root._inputMuted = !!source.audio.muted
|
||||
} else {
|
||||
root._inputVolume = 0
|
||||
// Don't reset volume to 0 when source is unavailable - preserve last known value
|
||||
// Only reset muted state
|
||||
root._inputMuted = true
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ Singleton {
|
||||
function onVolumeChanged() {
|
||||
var vol = source?.audio?.volume
|
||||
if (vol === undefined || isNaN(vol)) {
|
||||
root._inputVolume = 0
|
||||
// Don't reset to 0 if volume is undefined/NaN - preserve last known value
|
||||
return
|
||||
}
|
||||
// Only update if the value actually changed to prevent spurious signals
|
||||
|
||||
@@ -235,7 +235,7 @@ Singleton {
|
||||
const templatePath = `${Quickshell.shellDir}/Assets/MatugenTemplates/${codeApp.input}`
|
||||
const outputPath = client.path.replace("~", homeDir)
|
||||
const outputDir = outputPath.substring(0, outputPath.lastIndexOf('/'))
|
||||
|
||||
|
||||
// Extract base config directory for checking
|
||||
var baseConfigDir = ""
|
||||
if (client.name === "code") {
|
||||
|
||||
@@ -142,8 +142,7 @@ Singleton {
|
||||
"path": "~/.config/Vencord",
|
||||
"requiresThemesFolder": false
|
||||
}]
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "code",
|
||||
"name": "VSCode",
|
||||
"category": "applications",
|
||||
|
||||
Reference in New Issue
Block a user