mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Switched to qmlformat.
This commit is contained in:
@@ -3,8 +3,8 @@ import Quickshell
|
||||
import Quickshell.Wayland
|
||||
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
import qs.Modules.MainScreen
|
||||
import qs.Services.UI
|
||||
|
||||
// ------------------------------
|
||||
// MainScreen for each screen (manages bar + all panels)
|
||||
@@ -16,10 +16,10 @@ Variants {
|
||||
|
||||
property bool shouldBeActive: {
|
||||
if (!modelData || !modelData.name) {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
Logger.d("Shell", "MainScreen activated for", modelData?.name)
|
||||
return true
|
||||
Logger.d("Shell", "MainScreen activated for", modelData?.name);
|
||||
return true;
|
||||
}
|
||||
|
||||
property bool windowLoaded: false
|
||||
@@ -33,7 +33,7 @@ Variants {
|
||||
|
||||
onLoaded: {
|
||||
// Signal that window is loaded so exclusion zone can be created
|
||||
parent.windowLoaded = true
|
||||
parent.windowLoaded = true;
|
||||
}
|
||||
|
||||
sourceComponent: MainScreen {
|
||||
@@ -45,11 +45,11 @@ Variants {
|
||||
Loader {
|
||||
active: {
|
||||
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
|
||||
return false
|
||||
return false;
|
||||
|
||||
// Check if bar is configured for this screen
|
||||
var monitors = Settings.data.bar.monitors || []
|
||||
return monitors.length === 0 || monitors.includes(modelData?.name)
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
return monitors.length === 0 || monitors.includes(modelData?.name);
|
||||
}
|
||||
asynchronous: false
|
||||
|
||||
@@ -58,7 +58,7 @@ Variants {
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
Logger.d("Shell", "BarContentWindow created for", modelData?.name)
|
||||
Logger.d("Shell", "BarContentWindow created for", modelData?.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ Variants {
|
||||
Loader {
|
||||
active: {
|
||||
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
|
||||
return false
|
||||
return false;
|
||||
|
||||
// Check if bar is configured for this screen
|
||||
var monitors = Settings.data.bar.monitors || []
|
||||
return monitors.length === 0 || monitors.includes(modelData?.name)
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
return monitors.length === 0 || monitors.includes(modelData?.name);
|
||||
}
|
||||
asynchronous: false
|
||||
|
||||
@@ -80,7 +80,7 @@ Variants {
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
Logger.d("Shell", "BarExclusionZone created for", modelData?.name)
|
||||
Logger.d("Shell", "BarExclusionZone created for", modelData?.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ Variants {
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
Logger.d("Shell", "TrayMenuWindow created for", modelData?.name)
|
||||
Logger.d("Shell", "TrayMenuWindow created for", modelData?.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,16 @@ import QtQuick.Shapes
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
|
||||
|
||||
/**
|
||||
* AllBackgrounds - Unified Shape container for all bar and panel backgrounds
|
||||
*
|
||||
* Unified shadow system. This component contains a single Shape
|
||||
* with multiple ShapePath children (one for bar, one for each panel type).
|
||||
*
|
||||
* Benefits:
|
||||
* - Single GPU-accelerated rendering pass for all backgrounds
|
||||
* - Unified shadow system (one MultiEffect for everything)
|
||||
*/
|
||||
* AllBackgrounds - Unified Shape container for all bar and panel backgrounds
|
||||
*
|
||||
* Unified shadow system. This component contains a single Shape
|
||||
* with multiple ShapePath children (one for bar, one for each panel type).
|
||||
*
|
||||
* Benefits:
|
||||
* - Single GPU-accelerated rendering pass for all backgrounds
|
||||
* - Unified shadow system (one MultiEffect for everything)
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
@@ -46,15 +45,14 @@ Item {
|
||||
enabled: false // Disable mouse input on the Shape itself
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("AllBackgrounds", "AllBackgrounds initialized")
|
||||
Logger.d("AllBackgrounds", " bar:", root.bar)
|
||||
Logger.d("AllBackgrounds", " windowRoot:", root.windowRoot)
|
||||
Logger.d("AllBackgrounds", "AllBackgrounds initialized");
|
||||
Logger.d("AllBackgrounds", " bar:", root.bar);
|
||||
Logger.d("AllBackgrounds", " windowRoot:", root.windowRoot);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bar
|
||||
*/
|
||||
* Bar
|
||||
*/
|
||||
BarBackground {
|
||||
bar: root.bar
|
||||
shapeContainer: backgroundsShape
|
||||
@@ -62,10 +60,9 @@ Item {
|
||||
backgroundColor: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Panels
|
||||
*/
|
||||
* Panels
|
||||
*/
|
||||
|
||||
// Audio
|
||||
PanelBackground {
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
import qs.Modules.MainScreen.Backgrounds
|
||||
|
||||
import qs.Services.UI
|
||||
|
||||
/**
|
||||
* BarBackground - ShapePath component for rendering the bar background
|
||||
*
|
||||
* Unified shadow system. This component is a ShapePath that will be
|
||||
* a child of the unified AllBackgrounds Shape container.
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*/
|
||||
* BarBackground - ShapePath component for rendering the bar background
|
||||
*
|
||||
* Unified shadow system. This component is a ShapePath that will be
|
||||
* a child of the unified AllBackgrounds Shape container.
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*/
|
||||
ShapePath {
|
||||
id: root
|
||||
|
||||
@@ -35,15 +34,15 @@ ShapePath {
|
||||
readonly property bool shouldShow: {
|
||||
// Check global bar visibility
|
||||
if (!BarService.isVisible)
|
||||
return false
|
||||
return false;
|
||||
|
||||
// Check screen-specific configuration
|
||||
var monitors = Settings.data.bar.monitors || []
|
||||
var screenName = windowRoot?.screen?.name || ""
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
var screenName = windowRoot?.screen?.name || "";
|
||||
|
||||
// If no monitors specified, show on all screens
|
||||
// If monitors specified, only show if this screen is in the list
|
||||
return monitors.length === 0 || monitors.includes(screenName)
|
||||
return monitors.length === 0 || monitors.includes(screenName);
|
||||
}
|
||||
|
||||
// Corner radius (from Style)
|
||||
@@ -65,9 +64,9 @@ ShapePath {
|
||||
function getCornerRadius(cornerState) {
|
||||
// State -1 = no radius (flat corner)
|
||||
if (cornerState === -1)
|
||||
return 0
|
||||
return 0;
|
||||
// All other states use effectiveRadius
|
||||
return effectiveRadius
|
||||
return effectiveRadius;
|
||||
}
|
||||
|
||||
// Per-corner multipliers and radii based on bar's corner states (handle null bar)
|
||||
|
||||
@@ -3,22 +3,21 @@ import QtQuick.Shapes
|
||||
import qs.Commons
|
||||
import qs.Modules.MainScreen.Backgrounds
|
||||
|
||||
|
||||
/**
|
||||
* PanelBackground - ShapePath component for rendering a single background
|
||||
*
|
||||
* Unified shadow system. This component is a ShapePath that will
|
||||
* be a child of the unified AllBackgrounds Shape container.
|
||||
*
|
||||
* Reads positioning and geometry from PanelPlaceholder (via panel.panelItem).
|
||||
* The actual panel content lives in a separate SmartPanelWindow.
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*/
|
||||
* PanelBackground - ShapePath component for rendering a single background
|
||||
*
|
||||
* Unified shadow system. This component is a ShapePath that will
|
||||
* be a child of the unified AllBackgrounds Shape container.
|
||||
*
|
||||
* Reads positioning and geometry from PanelPlaceholder (via panel.panelItem).
|
||||
* The actual panel content lives in a separate SmartPanelWindow.
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*/
|
||||
ShapePath {
|
||||
id: root
|
||||
|
||||
@@ -51,9 +50,9 @@ ShapePath {
|
||||
function getCornerRadius(cornerState) {
|
||||
// State -1 = no radius (flat corner)
|
||||
if (cornerState === -1)
|
||||
return 0
|
||||
return 0;
|
||||
// All other states use effectiveRadius
|
||||
return effectiveRadius
|
||||
return effectiveRadius;
|
||||
}
|
||||
|
||||
// Per-corner multipliers and radii based on panelBg's corner states
|
||||
|
||||
@@ -4,78 +4,71 @@ import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import Quickshell
|
||||
|
||||
|
||||
/**
|
||||
* ShapeCornerHelper - Utility singleton for shape corner calculations
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*
|
||||
* The key technique: Using PathArc direction control (Clockwise vs Counterclockwise)
|
||||
* combined with multipliers to create both inner and outer corner curves.
|
||||
*/
|
||||
* ShapeCornerHelper - Utility singleton for shape corner calculations
|
||||
*
|
||||
* Uses 4-state per-corner system for flexible corner rendering:
|
||||
* - State -1: No radius (flat/square corner)
|
||||
* - State 0: Normal (inner curve)
|
||||
* - State 1: Horizontal inversion (outer curve on X-axis)
|
||||
* - State 2: Vertical inversion (outer curve on Y-axis)
|
||||
*
|
||||
* The key technique: Using PathArc direction control (Clockwise vs Counterclockwise)
|
||||
* combined with multipliers to create both inner and outer corner curves.
|
||||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
|
||||
/**
|
||||
* Get X-axis multiplier for a corner state
|
||||
* State 1 (horizontal invert) returns -1, others return 1
|
||||
*/
|
||||
* Get X-axis multiplier for a corner state
|
||||
* State 1 (horizontal invert) returns -1, others return 1
|
||||
*/
|
||||
function getMultX(cornerState) {
|
||||
return cornerState === 1 ? -1 : 1
|
||||
return cornerState === 1 ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Y-axis multiplier for a corner state
|
||||
* State 2 (vertical invert) returns -1, others return 1
|
||||
*/
|
||||
* Get Y-axis multiplier for a corner state
|
||||
* State 2 (vertical invert) returns -1, others return 1
|
||||
*/
|
||||
function getMultY(cornerState) {
|
||||
return cornerState === 2 ? -1 : 1
|
||||
return cornerState === 2 ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get PathArc direction for a corner based on its multipliers
|
||||
* Uses XOR logic: if X inverted differs from Y inverted, use Counterclockwise
|
||||
* This creates the outer curve effect for inverted corners
|
||||
*/
|
||||
* Get PathArc direction for a corner based on its multipliers
|
||||
* Uses XOR logic: if X inverted differs from Y inverted, use Counterclockwise
|
||||
* This creates the outer curve effect for inverted corners
|
||||
*/
|
||||
function getArcDirection(multX, multY) {
|
||||
return ((multX < 0) !== (multY < 0)) ? PathArc.Counterclockwise : PathArc.Clockwise
|
||||
return ((multX < 0) !== (multY < 0)) ? PathArc.Counterclockwise : PathArc.Clockwise;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience function to get arc direction directly from corner state
|
||||
*/
|
||||
* Convenience function to get arc direction directly from corner state
|
||||
*/
|
||||
function getArcDirectionFromState(cornerState) {
|
||||
const multX = getMultX(cornerState)
|
||||
const multY = getMultY(cornerState)
|
||||
return getArcDirection(multX, multY)
|
||||
const multX = getMultX(cornerState);
|
||||
const multY = getMultY(cornerState);
|
||||
return getArcDirection(multX, multY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the "flattening" radius when shape dimensions are too small
|
||||
* Prevents visual artifacts when radius exceeds dimensions
|
||||
*/
|
||||
* Get the "flattening" radius when shape dimensions are too small
|
||||
* Prevents visual artifacts when radius exceeds dimensions
|
||||
*/
|
||||
function getFlattenedRadius(dimension, requestedRadius) {
|
||||
if (dimension < requestedRadius * 2) {
|
||||
return dimension / 2
|
||||
return dimension / 2;
|
||||
}
|
||||
return requestedRadius
|
||||
return requestedRadius;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a shape should use flattened corners
|
||||
* Returns true if width or height is too small for the requested radius
|
||||
*/
|
||||
* Check if a shape should use flattened corners
|
||||
* Returns true if width or height is too small for the requested radius
|
||||
*/
|
||||
function shouldFlatten(width, height, radius) {
|
||||
return width < radius * 2 || height < radius * 2
|
||||
return width < radius * 2 || height < radius * 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,18 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
import qs.Modules.Bar
|
||||
|
||||
import qs.Services.UI
|
||||
|
||||
/**
|
||||
* BarContentWindow - Separate transparent PanelWindow for bar content
|
||||
*
|
||||
* This window contains only the bar widgets (content), while the background
|
||||
* is rendered in MainScreen's unified Shape system. This separation prevents
|
||||
* fullscreen redraws when bar widgets redraw.
|
||||
*
|
||||
* This component should be instantiated once per screen by AllScreens.qml
|
||||
*/
|
||||
* BarContentWindow - Separate transparent PanelWindow for bar content
|
||||
*
|
||||
* This window contains only the bar widgets (content), while the background
|
||||
* is rendered in MainScreen's unified Shape system. This separation prevents
|
||||
* fullscreen redraws when bar widgets redraw.
|
||||
*
|
||||
* This component should be instantiated once per screen by AllScreens.qml
|
||||
*/
|
||||
PanelWindow {
|
||||
id: barWindow
|
||||
|
||||
@@ -22,7 +21,7 @@ PanelWindow {
|
||||
color: Color.transparent // Transparent - background is in MainScreen below
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("BarContentWindow", "Bar content window created for screen:", barWindow.screen?.name)
|
||||
Logger.d("BarContentWindow", "Bar content window created for screen:", barWindow.screen?.name);
|
||||
}
|
||||
|
||||
// Wayland layer configuration
|
||||
|
||||
@@ -3,13 +3,12 @@ import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
|
||||
|
||||
/**
|
||||
* BarExclusionZone - Invisible PanelWindow that reserves exclusive space for the bar
|
||||
*
|
||||
* This is a minimal window that works with the compositor to reserve space,
|
||||
* while the actual bar UI is rendered in MainScreen.
|
||||
*/
|
||||
* BarExclusionZone - Invisible PanelWindow that reserves exclusive space for the bar
|
||||
*
|
||||
* This is a minimal window that works with the compositor to reserve space,
|
||||
* while the actual bar UI is rendered in MainScreen.
|
||||
*/
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
@@ -46,11 +45,11 @@ PanelWindow {
|
||||
// Vertical bar: reserve bar height + margin on the anchored edge only
|
||||
if (barFloating) {
|
||||
// For left bar, reserve left margin; for right bar, reserve right margin
|
||||
return Style.barHeight + barMarginH
|
||||
return Style.barHeight + barMarginH;
|
||||
}
|
||||
return Style.barHeight
|
||||
return Style.barHeight;
|
||||
}
|
||||
return 0 // Auto-width when left/right anchors are true
|
||||
return 0; // Auto-width when left/right anchors are true
|
||||
}
|
||||
|
||||
implicitHeight: {
|
||||
@@ -58,17 +57,17 @@ PanelWindow {
|
||||
// Horizontal bar: reserve bar height + margin on the anchored edge only
|
||||
if (barFloating) {
|
||||
// For top bar, reserve top margin; for bottom bar, reserve bottom margin
|
||||
return Style.barHeight + barMarginV
|
||||
return Style.barHeight + barMarginV;
|
||||
}
|
||||
return Style.barHeight
|
||||
return Style.barHeight;
|
||||
}
|
||||
return 0 // Auto-height when top/bottom anchors are true
|
||||
return 0; // Auto-height when top/bottom anchors are true
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("BarExclusionZone", "Created for screen:", screen?.name)
|
||||
Logger.d("BarExclusionZone", " Position:", barPosition, "Exclusive:", exclusive, "Floating:", barFloating)
|
||||
Logger.d("BarExclusionZone", " Anchors - top:", anchors.top, "bottom:", anchors.bottom, "left:", anchors.left, "right:", anchors.right)
|
||||
Logger.d("BarExclusionZone", " Size:", width, "x", height, "implicitWidth:", implicitWidth, "implicitHeight:", implicitHeight)
|
||||
Logger.d("BarExclusionZone", "Created for screen:", screen?.name);
|
||||
Logger.d("BarExclusionZone", " Position:", barPosition, "Exclusive:", exclusive, "Floating:", barFloating);
|
||||
Logger.d("BarExclusionZone", " Anchors - top:", anchors.top, "bottom:", anchors.bottom, "left:", anchors.left, "right:", anchors.right);
|
||||
Logger.d("BarExclusionZone", " Size:", width, "x", height, "implicitWidth:", implicitWidth, "implicitHeight:", implicitHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import "Backgrounds" as Backgrounds
|
||||
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
import "Backgrounds" as Backgrounds
|
||||
|
||||
// All panels
|
||||
import qs.Modules.Bar
|
||||
@@ -23,11 +22,11 @@ import qs.Modules.Panels.SetupWizard
|
||||
import qs.Modules.Panels.Tray
|
||||
import qs.Modules.Panels.Wallpaper
|
||||
import qs.Modules.Panels.WiFi
|
||||
|
||||
import qs.Services.UI
|
||||
|
||||
/**
|
||||
* MainScreen - Single PanelWindow per screen that manages all panels and the bar
|
||||
*/
|
||||
* MainScreen - Single PanelWindow per screen that manages all panels and the bar
|
||||
*/
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
@@ -62,7 +61,7 @@ PanelWindow {
|
||||
readonly property var wifiPanelPlaceholder: wifiPanel.panelPlaceholder
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("MainScreen", "Initialized for screen:", screen?.name, "- Dimensions:", screen?.width, "x", screen?.height, "- Position:", screen?.x, ",", screen?.y)
|
||||
Logger.d("MainScreen", "Initialized for screen:", screen?.name, "- Dimensions:", screen?.width, "x", screen?.height, "- Position:", screen?.x, ",", screen?.y);
|
||||
}
|
||||
|
||||
// Wayland
|
||||
@@ -85,9 +84,9 @@ PanelWindow {
|
||||
|
||||
color: {
|
||||
if (dimmerOpacity > 0 && isPanelOpen && !isPanelClosing) {
|
||||
return Qt.alpha(Color.mShadow, dimmerOpacity)
|
||||
return Qt.alpha(Color.mShadow, dimmerOpacity);
|
||||
}
|
||||
return Color.transparent
|
||||
return Color.transparent;
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
@@ -101,15 +100,15 @@ PanelWindow {
|
||||
readonly property bool barShouldShow: {
|
||||
// Check global bar visibility
|
||||
if (!BarService.isVisible)
|
||||
return false
|
||||
return false;
|
||||
|
||||
// Check screen-specific configuration
|
||||
var monitors = Settings.data.bar.monitors || []
|
||||
var screenName = screen?.name || ""
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
var screenName = screen?.name || "";
|
||||
|
||||
// If no monitors specified, show on all screens
|
||||
// If monitors specified, only show if this screen is in the list
|
||||
return monitors.length === 0 || monitors.includes(screenName)
|
||||
return monitors.length === 0 || monitors.includes(screenName);
|
||||
}
|
||||
|
||||
// Make everything click-through except bar
|
||||
@@ -166,8 +165,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "audioPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(audioPanel)
|
||||
objectName = "audioPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(audioPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,8 +176,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "batteryPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(batteryPanel)
|
||||
objectName = "batteryPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(batteryPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,8 +187,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "bluetoothPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(bluetoothPanel)
|
||||
objectName = "bluetoothPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(bluetoothPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,8 +198,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "controlCenterPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(controlCenterPanel)
|
||||
objectName = "controlCenterPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(controlCenterPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,8 +209,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "calendarPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(calendarPanel)
|
||||
objectName = "calendarPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(calendarPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,8 +220,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "launcherPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(launcherPanel)
|
||||
objectName = "launcherPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(launcherPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,8 +231,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "notificationHistoryPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(notificationHistoryPanel)
|
||||
objectName = "notificationHistoryPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(notificationHistoryPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,8 +242,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "sessionMenuPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(sessionMenuPanel)
|
||||
objectName = "sessionMenuPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(sessionMenuPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,8 +253,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "settingsPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(settingsPanel)
|
||||
objectName = "settingsPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(settingsPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,8 +264,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "setupWizardPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(setupWizardPanel)
|
||||
objectName = "setupWizardPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(setupWizardPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,8 +275,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "trayDrawerPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(trayDrawerPanel)
|
||||
objectName = "trayDrawerPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(trayDrawerPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,8 +286,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "wallpaperPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(wallpaperPanel)
|
||||
objectName = "wallpaperPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(wallpaperPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,8 +297,8 @@ PanelWindow {
|
||||
z: 50
|
||||
|
||||
Component.onCompleted: {
|
||||
objectName = "wifiPanel-" + (screen?.name || "unknown")
|
||||
PanelService.registerPanel(wifiPanel)
|
||||
objectName = "wifiPanel-" + (screen?.name || "unknown");
|
||||
PanelService.registerPanel(wifiPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,94 +325,93 @@ PanelWindow {
|
||||
// Use screen dimensions directly
|
||||
x: {
|
||||
if (barPosition === "right")
|
||||
return screen.width - Style.barHeight - barMarginH - attachmentOverlap // Extend left towards panels
|
||||
return barMarginH
|
||||
return screen.width - Style.barHeight - barMarginH - attachmentOverlap; // Extend left towards panels
|
||||
return barMarginH;
|
||||
}
|
||||
y: {
|
||||
if (barPosition === "bottom")
|
||||
return screen.height - Style.barHeight - barMarginV - attachmentOverlap
|
||||
return barMarginV
|
||||
return screen.height - Style.barHeight - barMarginV - attachmentOverlap;
|
||||
return barMarginV;
|
||||
}
|
||||
width: {
|
||||
if (barIsVertical) {
|
||||
return Style.barHeight + attachmentOverlap
|
||||
return Style.barHeight + attachmentOverlap;
|
||||
}
|
||||
return screen.width - barMarginH * 2
|
||||
return screen.width - barMarginH * 2;
|
||||
}
|
||||
height: {
|
||||
if (barIsVertical) {
|
||||
return screen.height - barMarginV * 2
|
||||
return screen.height - barMarginV * 2;
|
||||
}
|
||||
return Style.barHeight + attachmentOverlap
|
||||
return Style.barHeight + attachmentOverlap;
|
||||
}
|
||||
|
||||
// Corner states (same as Bar.qml)
|
||||
readonly property int topLeftCornerState: {
|
||||
if (barFloating)
|
||||
return 0
|
||||
return 0;
|
||||
if (barPosition === "top")
|
||||
return -1
|
||||
return -1;
|
||||
if (barPosition === "left")
|
||||
return -1
|
||||
return -1;
|
||||
if (Settings.data.bar.outerCorners && (barPosition === "bottom" || barPosition === "right")) {
|
||||
return barIsVertical ? 1 : 2
|
||||
return barIsVertical ? 1 : 2;
|
||||
}
|
||||
return -1
|
||||
return -1;
|
||||
}
|
||||
|
||||
readonly property int topRightCornerState: {
|
||||
if (barFloating)
|
||||
return 0
|
||||
return 0;
|
||||
if (barPosition === "top")
|
||||
return -1
|
||||
return -1;
|
||||
if (barPosition === "right")
|
||||
return -1
|
||||
return -1;
|
||||
if (Settings.data.bar.outerCorners && (barPosition === "bottom" || barPosition === "left")) {
|
||||
return barIsVertical ? 1 : 2
|
||||
return barIsVertical ? 1 : 2;
|
||||
}
|
||||
return -1
|
||||
return -1;
|
||||
}
|
||||
|
||||
readonly property int bottomLeftCornerState: {
|
||||
if (barFloating)
|
||||
return 0
|
||||
return 0;
|
||||
if (barPosition === "bottom")
|
||||
return -1
|
||||
return -1;
|
||||
if (barPosition === "left")
|
||||
return -1
|
||||
return -1;
|
||||
if (Settings.data.bar.outerCorners && (barPosition === "top" || barPosition === "right")) {
|
||||
return barIsVertical ? 1 : 2
|
||||
return barIsVertical ? 1 : 2;
|
||||
}
|
||||
return -1
|
||||
return -1;
|
||||
}
|
||||
|
||||
readonly property int bottomRightCornerState: {
|
||||
if (barFloating)
|
||||
return 0
|
||||
return 0;
|
||||
if (barPosition === "bottom")
|
||||
return -1
|
||||
return -1;
|
||||
if (barPosition === "right")
|
||||
return -1
|
||||
return -1;
|
||||
if (Settings.data.bar.outerCorners && (barPosition === "top" || barPosition === "left")) {
|
||||
return barIsVertical ? 1 : 2
|
||||
return barIsVertical ? 1 : 2;
|
||||
}
|
||||
return -1
|
||||
return -1;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("MainScreen", "===== Bar placeholder loaded =====")
|
||||
Logger.d("MainScreen", " Screen:", screen?.name, "Size:", screen?.width, "x", screen?.height)
|
||||
Logger.d("MainScreen", " Bar position:", barPosition, "| isVertical:", barIsVertical)
|
||||
Logger.d("MainScreen", " Bar dimensions: x=" + x, "y=" + y, "width=" + width, "height=" + height)
|
||||
Logger.d("MainScreen", " Style.barHeight =", Style.barHeight)
|
||||
Logger.d("MainScreen", " Margins: H=" + barMarginH, "V=" + barMarginV, "| Floating:", barFloating)
|
||||
Logger.d("MainScreen", "===== Bar placeholder loaded =====");
|
||||
Logger.d("MainScreen", " Screen:", screen?.name, "Size:", screen?.width, "x", screen?.height);
|
||||
Logger.d("MainScreen", " Bar position:", barPosition, "| isVertical:", barIsVertical);
|
||||
Logger.d("MainScreen", " Bar dimensions: x=" + x, "y=" + y, "width=" + width, "height=" + height);
|
||||
Logger.d("MainScreen", " Style.barHeight =", Style.barHeight);
|
||||
Logger.d("MainScreen", " Margins: H=" + barMarginH, "V=" + barMarginV, "| Floating:", barFloating);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Screen Corners
|
||||
*/
|
||||
* Screen Corners
|
||||
*/
|
||||
ScreenCorners {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@ import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
|
||||
|
||||
/**
|
||||
* PanelPlaceholder - Lightweight positioning logic for panel backgrounds
|
||||
*
|
||||
* This component stays in MainScreen and provides geometry for PanelBackground rendering.
|
||||
* It contains only positioning calculations and animations, no visual content.
|
||||
* The actual panel content lives in a separate SmartPanelWindow.
|
||||
*/
|
||||
* PanelPlaceholder - Lightweight positioning logic for panel backgrounds
|
||||
*
|
||||
* This component stays in MainScreen and provides geometry for PanelBackground rendering.
|
||||
* It contains only positioning calculations and animations, no visual content.
|
||||
* The actual panel content lives in a separate SmartPanelWindow.
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
@@ -71,13 +70,13 @@ Item {
|
||||
readonly property bool allowAttach: Settings.data.ui.panelsAttachedToBar || root.forceAttachToBar
|
||||
readonly property bool allowAttachToBar: {
|
||||
if (!(Settings.data.ui.panelsAttachedToBar || root.forceAttachToBar) || Settings.data.bar.backgroundOpacity < 1.0) {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
// A panel can only be attached to a bar if there is a bar on that screen
|
||||
var monitors = Settings.data.bar.monitors || []
|
||||
var result = monitors.length === 0 || monitors.includes(root.screen?.name || "")
|
||||
return result
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
var result = monitors.length === 0 || monitors.includes(root.screen?.name || "");
|
||||
return result;
|
||||
}
|
||||
|
||||
// Effective anchor properties (depend on allowAttach)
|
||||
@@ -97,17 +96,17 @@ Item {
|
||||
|
||||
function onUiScaleRatioChanged() {
|
||||
if (root.isPanelVisible) {
|
||||
root.setPosition()
|
||||
root.setPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Public function to update content size from SmartPanelWindow
|
||||
function updateContentSize(w, h) {
|
||||
contentPreferredWidth = w
|
||||
contentPreferredHeight = h
|
||||
contentPreferredWidth = w;
|
||||
contentPreferredHeight = h;
|
||||
if (isPanelVisible) {
|
||||
setPosition()
|
||||
setPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,45 +114,45 @@ Item {
|
||||
function setPosition() {
|
||||
// Don't calculate position if parent dimensions aren't available yet
|
||||
if (!root.width || !root.height) {
|
||||
Logger.d("PanelPlaceholder", "Skipping setPosition - dimensions not ready:", root.width, "x", root.height, panelName)
|
||||
Qt.callLater(setPosition)
|
||||
return
|
||||
Logger.d("PanelPlaceholder", "Skipping setPosition - dimensions not ready:", root.width, "x", root.height, panelName);
|
||||
Qt.callLater(setPosition);
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate panel dimensions first (needed for positioning)
|
||||
var w
|
||||
var w;
|
||||
// Priority 1: Content-driven size (dynamic)
|
||||
if (contentPreferredWidth > 0) {
|
||||
w = contentPreferredWidth
|
||||
w = contentPreferredWidth;
|
||||
} // Priority 2: Ratio-based size
|
||||
else if (root.preferredWidthRatio !== undefined) {
|
||||
w = Math.round(Math.max(root.width * root.preferredWidthRatio, root.preferredWidth))
|
||||
w = Math.round(Math.max(root.width * root.preferredWidthRatio, root.preferredWidth));
|
||||
} // Priority 3: Static preferred width
|
||||
else {
|
||||
w = root.preferredWidth
|
||||
w = root.preferredWidth;
|
||||
}
|
||||
var panelWidth = Math.min(w, root.width - Style.marginL * 2)
|
||||
var panelWidth = Math.min(w, root.width - Style.marginL * 2);
|
||||
|
||||
var h
|
||||
var h;
|
||||
// Priority 1: Content-driven size (dynamic)
|
||||
if (contentPreferredHeight > 0) {
|
||||
h = contentPreferredHeight
|
||||
h = contentPreferredHeight;
|
||||
} // Priority 2: Ratio-based size
|
||||
else if (root.preferredHeightRatio !== undefined) {
|
||||
h = Math.round(Math.max(root.height * root.preferredHeightRatio, root.preferredHeight))
|
||||
h = Math.round(Math.max(root.height * root.preferredHeightRatio, root.preferredHeight));
|
||||
} // Priority 3: Static preferred height
|
||||
else {
|
||||
h = root.preferredHeight
|
||||
h = root.preferredHeight;
|
||||
}
|
||||
var panelHeight = Math.min(h, root.height - Style.barHeight - Style.marginL * 2)
|
||||
var panelHeight = Math.min(h, root.height - Style.barHeight - Style.marginL * 2);
|
||||
|
||||
// Update panelBackground target size (will be animated)
|
||||
panelBackground.targetWidth = panelWidth
|
||||
panelBackground.targetHeight = panelHeight
|
||||
panelBackground.targetWidth = panelWidth;
|
||||
panelBackground.targetHeight = panelHeight;
|
||||
|
||||
// Calculate position
|
||||
var calculatedX
|
||||
var calculatedY
|
||||
var calculatedX;
|
||||
var calculatedY;
|
||||
|
||||
// ===== X POSITIONING =====
|
||||
if (root.useButtonPosition && root.width > 0 && panelWidth > 0) {
|
||||
@@ -162,111 +161,111 @@ Item {
|
||||
if (allowAttach) {
|
||||
// Attached panels: align with bar edge (left or right side)
|
||||
if (root.barPosition === "left") {
|
||||
var leftBarEdge = root.barMarginH + Style.barHeight
|
||||
calculatedX = leftBarEdge
|
||||
var leftBarEdge = root.barMarginH + Style.barHeight;
|
||||
calculatedX = leftBarEdge;
|
||||
} else {
|
||||
// right
|
||||
var rightBarEdge = root.width - root.barMarginH - Style.barHeight
|
||||
calculatedX = rightBarEdge - panelWidth
|
||||
var rightBarEdge = root.width - root.barMarginH - Style.barHeight;
|
||||
calculatedX = rightBarEdge - panelWidth;
|
||||
}
|
||||
} else {
|
||||
// Detached panels: center on button X position
|
||||
var panelX = root.buttonPosition.x + root.buttonWidth / 2 - panelWidth / 2
|
||||
var minX = Style.marginL
|
||||
var maxX = root.width - panelWidth - Style.marginL
|
||||
var panelX = root.buttonPosition.x + root.buttonWidth / 2 - panelWidth / 2;
|
||||
var minX = Style.marginL;
|
||||
var maxX = root.width - panelWidth - Style.marginL;
|
||||
|
||||
// Account for vertical bar taking up space
|
||||
if (root.barPosition === "left") {
|
||||
minX = root.barMarginH + Style.barHeight + Style.marginL
|
||||
minX = root.barMarginH + Style.barHeight + Style.marginL;
|
||||
} else if (root.barPosition === "right") {
|
||||
maxX = root.width - root.barMarginH - Style.barHeight - panelWidth - Style.marginL
|
||||
maxX = root.width - root.barMarginH - Style.barHeight - panelWidth - Style.marginL;
|
||||
}
|
||||
|
||||
panelX = Math.max(minX, Math.min(panelX, maxX))
|
||||
calculatedX = panelX
|
||||
panelX = Math.max(minX, Math.min(panelX, maxX));
|
||||
calculatedX = panelX;
|
||||
}
|
||||
} else {
|
||||
// For horizontal bars, center panel on button X position
|
||||
var panelX = root.buttonPosition.x + root.buttonWidth / 2 - panelWidth / 2
|
||||
var panelX = root.buttonPosition.x + root.buttonWidth / 2 - panelWidth / 2;
|
||||
if (allowAttach) {
|
||||
var cornerInset = root.barFloating ? Style.radiusL * 2 : 0
|
||||
var barLeftEdge = root.barMarginH + cornerInset
|
||||
var barRightEdge = root.width - root.barMarginH - cornerInset
|
||||
panelX = Math.max(barLeftEdge, Math.min(panelX, barRightEdge - panelWidth))
|
||||
var cornerInset = root.barFloating ? Style.radiusL * 2 : 0;
|
||||
var barLeftEdge = root.barMarginH + cornerInset;
|
||||
var barRightEdge = root.width - root.barMarginH - cornerInset;
|
||||
panelX = Math.max(barLeftEdge, Math.min(panelX, barRightEdge - panelWidth));
|
||||
} else {
|
||||
panelX = Math.max(Style.marginL, Math.min(panelX, root.width - panelWidth - Style.marginL))
|
||||
panelX = Math.max(Style.marginL, Math.min(panelX, root.width - panelWidth - Style.marginL));
|
||||
}
|
||||
calculatedX = panelX
|
||||
calculatedX = panelX;
|
||||
}
|
||||
} else {
|
||||
// Standard anchor positioning
|
||||
if (root.panelAnchorHorizontalCenter) {
|
||||
if (root.barIsVertical) {
|
||||
if (root.barPosition === "left") {
|
||||
var availableStart = root.barMarginH + Style.barHeight
|
||||
var availableWidth = root.width - availableStart
|
||||
calculatedX = availableStart + (availableWidth - panelWidth) / 2
|
||||
var availableStart = root.barMarginH + Style.barHeight;
|
||||
var availableWidth = root.width - availableStart;
|
||||
calculatedX = availableStart + (availableWidth - panelWidth) / 2;
|
||||
} else if (root.barPosition === "right") {
|
||||
var availableWidth = root.width - root.barMarginH - Style.barHeight
|
||||
calculatedX = (availableWidth - panelWidth) / 2
|
||||
var availableWidth = root.width - root.barMarginH - Style.barHeight;
|
||||
calculatedX = (availableWidth - panelWidth) / 2;
|
||||
} else {
|
||||
calculatedX = (root.width - panelWidth) / 2
|
||||
calculatedX = (root.width - panelWidth) / 2;
|
||||
}
|
||||
} else {
|
||||
calculatedX = (root.width - panelWidth) / 2
|
||||
calculatedX = (root.width - panelWidth) / 2;
|
||||
}
|
||||
} else if (root.effectivePanelAnchorRight) {
|
||||
if (allowAttach && root.barIsVertical && root.barPosition === "right") {
|
||||
var rightBarEdge = root.width - root.barMarginH - Style.barHeight
|
||||
calculatedX = rightBarEdge - panelWidth
|
||||
var rightBarEdge = root.width - root.barMarginH - Style.barHeight;
|
||||
calculatedX = rightBarEdge - panelWidth;
|
||||
} else if (allowAttach) {
|
||||
// Account for corner inset when bar is floating, horizontal, AND panel is on same edge as bar
|
||||
var panelOnSameEdgeAsBar = (root.barPosition === "top" && root.effectivePanelAnchorTop) || (root.barPosition === "bottom" && root.effectivePanelAnchorBottom)
|
||||
var panelOnSameEdgeAsBar = (root.barPosition === "top" && root.effectivePanelAnchorTop) || (root.barPosition === "bottom" && root.effectivePanelAnchorBottom);
|
||||
if (!root.barIsVertical && root.barFloating && panelOnSameEdgeAsBar) {
|
||||
var rightCornerInset = Style.radiusL * 2
|
||||
calculatedX = root.width - root.barMarginH - rightCornerInset - panelWidth
|
||||
var rightCornerInset = Style.radiusL * 2;
|
||||
calculatedX = root.width - root.barMarginH - rightCornerInset - panelWidth;
|
||||
} else {
|
||||
calculatedX = root.width - panelWidth
|
||||
calculatedX = root.width - panelWidth;
|
||||
}
|
||||
} else {
|
||||
calculatedX = root.width - panelWidth - Style.marginL
|
||||
calculatedX = root.width - panelWidth - Style.marginL;
|
||||
}
|
||||
} else if (root.effectivePanelAnchorLeft) {
|
||||
if (allowAttach && root.barIsVertical && root.barPosition === "left") {
|
||||
var leftBarEdge = root.barMarginH + Style.barHeight
|
||||
calculatedX = leftBarEdge
|
||||
var leftBarEdge = root.barMarginH + Style.barHeight;
|
||||
calculatedX = leftBarEdge;
|
||||
} else if (allowAttach) {
|
||||
// Account for corner inset when bar is floating, horizontal, AND panel is on same edge as bar
|
||||
var panelOnSameEdgeAsBar = (root.barPosition === "top" && root.effectivePanelAnchorTop) || (root.barPosition === "bottom" && root.effectivePanelAnchorBottom)
|
||||
var panelOnSameEdgeAsBar = (root.barPosition === "top" && root.effectivePanelAnchorTop) || (root.barPosition === "bottom" && root.effectivePanelAnchorBottom);
|
||||
if (!root.barIsVertical && root.barFloating && panelOnSameEdgeAsBar) {
|
||||
var leftCornerInset = Style.radiusL * 2
|
||||
calculatedX = root.barMarginH + leftCornerInset
|
||||
var leftCornerInset = Style.radiusL * 2;
|
||||
calculatedX = root.barMarginH + leftCornerInset;
|
||||
} else {
|
||||
calculatedX = 0
|
||||
calculatedX = 0;
|
||||
}
|
||||
} else {
|
||||
calculatedX = Style.marginL
|
||||
calculatedX = Style.marginL;
|
||||
}
|
||||
} else {
|
||||
// No explicit anchor: default to centering on bar
|
||||
if (root.barIsVertical) {
|
||||
if (root.barPosition === "left") {
|
||||
var availableStart = root.barMarginH + Style.barHeight
|
||||
var availableWidth = root.width - availableStart - Style.marginL
|
||||
calculatedX = availableStart + (availableWidth - panelWidth) / 2
|
||||
var availableStart = root.barMarginH + Style.barHeight;
|
||||
var availableWidth = root.width - availableStart - Style.marginL;
|
||||
calculatedX = availableStart + (availableWidth - panelWidth) / 2;
|
||||
} else {
|
||||
var availableWidth = root.width - root.barMarginH - Style.barHeight - Style.marginL
|
||||
calculatedX = Style.marginL + (availableWidth - panelWidth) / 2
|
||||
var availableWidth = root.width - root.barMarginH - Style.barHeight - Style.marginL;
|
||||
calculatedX = Style.marginL + (availableWidth - panelWidth) / 2;
|
||||
}
|
||||
} else {
|
||||
if (allowAttach) {
|
||||
var cornerInset = Style.radiusL + (root.barFloating ? Style.radiusL : 0)
|
||||
var barLeftEdge = root.barMarginH + cornerInset
|
||||
var barRightEdge = root.width - root.barMarginH - cornerInset
|
||||
var centeredX = (root.width - panelWidth) / 2
|
||||
calculatedX = Math.max(barLeftEdge, Math.min(centeredX, barRightEdge - panelWidth))
|
||||
var cornerInset = Style.radiusL + (root.barFloating ? Style.radiusL : 0);
|
||||
var barLeftEdge = root.barMarginH + cornerInset;
|
||||
var barRightEdge = root.width - root.barMarginH - cornerInset;
|
||||
var centeredX = (root.width - panelWidth) / 2;
|
||||
calculatedX = Math.max(barLeftEdge, Math.min(centeredX, barRightEdge - panelWidth));
|
||||
} else {
|
||||
calculatedX = (root.width - panelWidth) / 2
|
||||
calculatedX = (root.width - panelWidth) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,76 +273,76 @@ Item {
|
||||
|
||||
// Edge snapping for X
|
||||
if (allowAttach && !root.barFloating && root.width > 0 && panelWidth > 0) {
|
||||
var leftEdgePos = root.barMarginH
|
||||
var leftEdgePos = root.barMarginH;
|
||||
if (root.barPosition === "left") {
|
||||
leftEdgePos = root.barMarginH + Style.barHeight
|
||||
leftEdgePos = root.barMarginH + Style.barHeight;
|
||||
}
|
||||
|
||||
var rightEdgePos = root.width - root.barMarginH - panelWidth
|
||||
var rightEdgePos = root.width - root.barMarginH - panelWidth;
|
||||
if (root.barPosition === "right") {
|
||||
rightEdgePos = root.width - root.barMarginH - Style.barHeight - panelWidth
|
||||
rightEdgePos = root.width - root.barMarginH - Style.barHeight - panelWidth;
|
||||
}
|
||||
|
||||
// Only snap to left edge if panel is actually meant to be at left
|
||||
var shouldSnapToLeft = root.effectivePanelAnchorLeft || (!root.hasExplicitHorizontalAnchor && root.barPosition === "left")
|
||||
var shouldSnapToLeft = root.effectivePanelAnchorLeft || (!root.hasExplicitHorizontalAnchor && root.barPosition === "left");
|
||||
// Only snap to right edge if panel is actually meant to be at right
|
||||
var shouldSnapToRight = root.effectivePanelAnchorRight || (!root.hasExplicitHorizontalAnchor && root.barPosition === "right")
|
||||
var shouldSnapToRight = root.effectivePanelAnchorRight || (!root.hasExplicitHorizontalAnchor && root.barPosition === "right");
|
||||
|
||||
if (shouldSnapToLeft && Math.abs(calculatedX - leftEdgePos) <= root.edgeSnapDistance) {
|
||||
calculatedX = leftEdgePos
|
||||
calculatedX = leftEdgePos;
|
||||
} else if (shouldSnapToRight && Math.abs(calculatedX - rightEdgePos) <= root.edgeSnapDistance) {
|
||||
calculatedX = rightEdgePos
|
||||
calculatedX = rightEdgePos;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Y POSITIONING =====
|
||||
if (root.useButtonPosition && root.height > 0 && panelHeight > 0) {
|
||||
if (root.barPosition === "top") {
|
||||
var topBarEdge = root.barMarginV + Style.barHeight
|
||||
var topBarEdge = root.barMarginV + Style.barHeight;
|
||||
if (allowAttach) {
|
||||
calculatedY = topBarEdge
|
||||
calculatedY = topBarEdge;
|
||||
} else {
|
||||
calculatedY = topBarEdge + Style.marginM
|
||||
calculatedY = topBarEdge + Style.marginM;
|
||||
}
|
||||
} else if (root.barPosition === "bottom") {
|
||||
var bottomBarEdge = root.height - root.barMarginV - Style.barHeight
|
||||
var bottomBarEdge = root.height - root.barMarginV - Style.barHeight;
|
||||
if (allowAttach) {
|
||||
calculatedY = bottomBarEdge - panelHeight
|
||||
calculatedY = bottomBarEdge - panelHeight;
|
||||
} else {
|
||||
calculatedY = bottomBarEdge - panelHeight - Style.marginM
|
||||
calculatedY = bottomBarEdge - panelHeight - Style.marginM;
|
||||
}
|
||||
} else if (root.barIsVertical) {
|
||||
var panelY = root.buttonPosition.y + root.buttonHeight / 2 - panelHeight / 2
|
||||
var extraPadding = (allowAttach && root.barFloating) ? Style.radiusL : 0
|
||||
var panelY = root.buttonPosition.y + root.buttonHeight / 2 - panelHeight / 2;
|
||||
var extraPadding = (allowAttach && root.barFloating) ? Style.radiusL : 0;
|
||||
if (allowAttach) {
|
||||
var cornerInset = extraPadding + (root.barFloating ? Style.radiusL : 0)
|
||||
var barTopEdge = root.barMarginV + cornerInset
|
||||
var barBottomEdge = root.height - root.barMarginV - cornerInset
|
||||
panelY = Math.max(barTopEdge, Math.min(panelY, barBottomEdge - panelHeight))
|
||||
var cornerInset = extraPadding + (root.barFloating ? Style.radiusL : 0);
|
||||
var barTopEdge = root.barMarginV + cornerInset;
|
||||
var barBottomEdge = root.height - root.barMarginV - cornerInset;
|
||||
panelY = Math.max(barTopEdge, Math.min(panelY, barBottomEdge - panelHeight));
|
||||
} else {
|
||||
panelY = Math.max(Style.marginL + extraPadding, Math.min(panelY, root.height - panelHeight - Style.marginL - extraPadding))
|
||||
panelY = Math.max(Style.marginL + extraPadding, Math.min(panelY, root.height - panelHeight - Style.marginL - extraPadding));
|
||||
}
|
||||
calculatedY = panelY
|
||||
calculatedY = panelY;
|
||||
}
|
||||
} else {
|
||||
// Standard anchor positioning
|
||||
var barOffset = 0
|
||||
var barOffset = 0;
|
||||
if (!allowAttach) {
|
||||
if (root.barPosition === "top") {
|
||||
barOffset = root.barMarginV + Style.barHeight + Style.marginM
|
||||
barOffset = root.barMarginV + Style.barHeight + Style.marginM;
|
||||
} else if (root.barPosition === "bottom") {
|
||||
barOffset = root.barMarginV + Style.barHeight + Style.marginM
|
||||
barOffset = root.barMarginV + Style.barHeight + Style.marginM;
|
||||
}
|
||||
} else {
|
||||
if (root.effectivePanelAnchorTop && root.barPosition === "top") {
|
||||
calculatedY = root.barMarginV + Style.barHeight
|
||||
calculatedY = root.barMarginV + Style.barHeight;
|
||||
} else if (root.effectivePanelAnchorBottom && root.barPosition === "bottom") {
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight;
|
||||
} else if (!root.hasExplicitVerticalAnchor) {
|
||||
if (root.barPosition === "top") {
|
||||
calculatedY = root.barMarginV + Style.barHeight
|
||||
calculatedY = root.barMarginV + Style.barHeight;
|
||||
} else if (root.barPosition === "bottom") {
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,57 +351,57 @@ Item {
|
||||
if (root.panelAnchorVerticalCenter) {
|
||||
if (!root.barIsVertical) {
|
||||
if (root.barPosition === "top") {
|
||||
var availableStart = root.barMarginV + Style.barHeight
|
||||
var availableHeight = root.height - availableStart
|
||||
calculatedY = availableStart + (availableHeight - panelHeight) / 2
|
||||
var availableStart = root.barMarginV + Style.barHeight;
|
||||
var availableHeight = root.height - availableStart;
|
||||
calculatedY = availableStart + (availableHeight - panelHeight) / 2;
|
||||
} else if (root.barPosition === "bottom") {
|
||||
var availableHeight = root.height - root.barMarginV - Style.barHeight
|
||||
calculatedY = (availableHeight - panelHeight) / 2
|
||||
var availableHeight = root.height - root.barMarginV - Style.barHeight;
|
||||
calculatedY = (availableHeight - panelHeight) / 2;
|
||||
} else {
|
||||
calculatedY = (root.height - panelHeight) / 2
|
||||
calculatedY = (root.height - panelHeight) / 2;
|
||||
}
|
||||
} else {
|
||||
calculatedY = (root.height - panelHeight) / 2
|
||||
calculatedY = (root.height - panelHeight) / 2;
|
||||
}
|
||||
} else if (root.effectivePanelAnchorTop) {
|
||||
if (allowAttach) {
|
||||
calculatedY = 0
|
||||
calculatedY = 0;
|
||||
} else {
|
||||
var topBarOffset = (root.barPosition === "top") ? barOffset : 0
|
||||
calculatedY = topBarOffset + Style.marginL
|
||||
var topBarOffset = (root.barPosition === "top") ? barOffset : 0;
|
||||
calculatedY = topBarOffset + Style.marginL;
|
||||
}
|
||||
} else if (root.effectivePanelAnchorBottom) {
|
||||
if (allowAttach) {
|
||||
calculatedY = root.height - panelHeight
|
||||
calculatedY = root.height - panelHeight;
|
||||
} else {
|
||||
var bottomBarOffset = (root.barPosition === "bottom") ? barOffset : 0
|
||||
calculatedY = root.height - panelHeight - bottomBarOffset - Style.marginL
|
||||
var bottomBarOffset = (root.barPosition === "bottom") ? barOffset : 0;
|
||||
calculatedY = root.height - panelHeight - bottomBarOffset - Style.marginL;
|
||||
}
|
||||
} else {
|
||||
if (root.barIsVertical) {
|
||||
if (allowAttach) {
|
||||
var cornerInset = root.barFloating ? Style.radiusL * 2 : 0
|
||||
var barTopEdge = root.barMarginV + cornerInset
|
||||
var barBottomEdge = root.height - root.barMarginV - cornerInset
|
||||
var centeredY = (root.height - panelHeight) / 2
|
||||
calculatedY = Math.max(barTopEdge, Math.min(centeredY, barBottomEdge - panelHeight))
|
||||
var cornerInset = root.barFloating ? Style.radiusL * 2 : 0;
|
||||
var barTopEdge = root.barMarginV + cornerInset;
|
||||
var barBottomEdge = root.height - root.barMarginV - cornerInset;
|
||||
var centeredY = (root.height - panelHeight) / 2;
|
||||
calculatedY = Math.max(barTopEdge, Math.min(centeredY, barBottomEdge - panelHeight));
|
||||
} else {
|
||||
calculatedY = (root.height - panelHeight) / 2
|
||||
calculatedY = (root.height - panelHeight) / 2;
|
||||
}
|
||||
} else {
|
||||
if (allowAttach && !root.barIsVertical) {
|
||||
if (root.barPosition === "top") {
|
||||
calculatedY = root.barMarginV + Style.barHeight
|
||||
calculatedY = root.barMarginV + Style.barHeight;
|
||||
} else if (root.barPosition === "bottom") {
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight
|
||||
calculatedY = root.height - root.barMarginV - Style.barHeight - panelHeight;
|
||||
}
|
||||
} else {
|
||||
if (root.barPosition === "top") {
|
||||
calculatedY = barOffset + Style.marginL
|
||||
calculatedY = barOffset + Style.marginL;
|
||||
} else if (root.barPosition === "bottom") {
|
||||
calculatedY = Style.marginL
|
||||
calculatedY = Style.marginL;
|
||||
} else {
|
||||
calculatedY = Style.marginL
|
||||
calculatedY = Style.marginL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,34 +411,34 @@ Item {
|
||||
|
||||
// Edge snapping for Y
|
||||
if (allowAttach && !root.barFloating && root.height > 0 && panelHeight > 0) {
|
||||
var topEdgePos = root.barMarginV
|
||||
var topEdgePos = root.barMarginV;
|
||||
if (root.barPosition === "top") {
|
||||
topEdgePos = root.barMarginV + Style.barHeight
|
||||
topEdgePos = root.barMarginV + Style.barHeight;
|
||||
}
|
||||
|
||||
var bottomEdgePos = root.height - root.barMarginV - panelHeight
|
||||
var bottomEdgePos = root.height - root.barMarginV - panelHeight;
|
||||
if (root.barPosition === "bottom") {
|
||||
bottomEdgePos = root.height - root.barMarginV - Style.barHeight - panelHeight
|
||||
bottomEdgePos = root.height - root.barMarginV - Style.barHeight - panelHeight;
|
||||
}
|
||||
|
||||
// Only snap to top edge if panel is actually meant to be at top
|
||||
var shouldSnapToTop = root.effectivePanelAnchorTop || (!root.hasExplicitVerticalAnchor && root.barPosition === "top")
|
||||
var shouldSnapToTop = root.effectivePanelAnchorTop || (!root.hasExplicitVerticalAnchor && root.barPosition === "top");
|
||||
// Only snap to bottom edge if panel is actually meant to be at bottom
|
||||
var shouldSnapToBottom = root.effectivePanelAnchorBottom || (!root.hasExplicitVerticalAnchor && root.barPosition === "bottom")
|
||||
var shouldSnapToBottom = root.effectivePanelAnchorBottom || (!root.hasExplicitVerticalAnchor && root.barPosition === "bottom");
|
||||
|
||||
if (shouldSnapToTop && Math.abs(calculatedY - topEdgePos) <= root.edgeSnapDistance) {
|
||||
calculatedY = topEdgePos
|
||||
calculatedY = topEdgePos;
|
||||
} else if (shouldSnapToBottom && Math.abs(calculatedY - bottomEdgePos) <= root.edgeSnapDistance) {
|
||||
calculatedY = bottomEdgePos
|
||||
calculatedY = bottomEdgePos;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply calculated positions (set targets for animation)
|
||||
panelBackground.targetX = calculatedX
|
||||
panelBackground.targetY = calculatedY
|
||||
panelBackground.targetX = calculatedX;
|
||||
panelBackground.targetY = calculatedY;
|
||||
|
||||
Logger.d("PanelPlaceholder", "Position calculated:", calculatedX, calculatedY, panelName)
|
||||
Logger.d("PanelPlaceholder", " Panel size:", panelWidth, "x", panelHeight)
|
||||
Logger.d("PanelPlaceholder", "Position calculated:", calculatedX, calculatedY, panelName);
|
||||
Logger.d("PanelPlaceholder", " Panel size:", panelWidth, "x", panelHeight);
|
||||
}
|
||||
|
||||
// The panel background geometry item
|
||||
@@ -469,35 +468,35 @@ Item {
|
||||
// Animation direction determination (using target position to avoid binding loops)
|
||||
readonly property bool willTouchTopBar: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (!allowAttachToBar || root.barPosition !== "top" || root.barIsVertical)
|
||||
return false
|
||||
var targetTopBarY = root.barMarginV + Style.barHeight
|
||||
return Math.abs(panelBackground.targetY - targetTopBarY) <= 1
|
||||
return false;
|
||||
var targetTopBarY = root.barMarginV + Style.barHeight;
|
||||
return Math.abs(panelBackground.targetY - targetTopBarY) <= 1;
|
||||
}
|
||||
readonly property bool willTouchBottomBar: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (!allowAttachToBar || root.barPosition !== "bottom" || root.barIsVertical)
|
||||
return false
|
||||
var targetBottomBarY = root.height - root.barMarginV - Style.barHeight - panelBackground.targetHeight
|
||||
return Math.abs(panelBackground.targetY - targetBottomBarY) <= 1
|
||||
return false;
|
||||
var targetBottomBarY = root.height - root.barMarginV - Style.barHeight - panelBackground.targetHeight;
|
||||
return Math.abs(panelBackground.targetY - targetBottomBarY) <= 1;
|
||||
}
|
||||
readonly property bool willTouchLeftBar: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (!allowAttachToBar || root.barPosition !== "left" || !root.barIsVertical)
|
||||
return false
|
||||
var targetLeftBarX = root.barMarginH + Style.barHeight
|
||||
return Math.abs(panelBackground.targetX - targetLeftBarX) <= 1
|
||||
return false;
|
||||
var targetLeftBarX = root.barMarginH + Style.barHeight;
|
||||
return Math.abs(panelBackground.targetX - targetLeftBarX) <= 1;
|
||||
}
|
||||
readonly property bool willTouchRightBar: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (!allowAttachToBar || root.barPosition !== "right" || !root.barIsVertical)
|
||||
return false
|
||||
var targetRightBarX = root.width - root.barMarginH - Style.barHeight - panelBackground.targetWidth
|
||||
return Math.abs(panelBackground.targetX - targetRightBarX) <= 1
|
||||
return false;
|
||||
var targetRightBarX = root.width - root.barMarginH - Style.barHeight - panelBackground.targetWidth;
|
||||
return Math.abs(panelBackground.targetX - targetRightBarX) <= 1;
|
||||
}
|
||||
readonly property bool willTouchTopEdge: isPanelVisible && allowAttach && panelBackground.targetY <= 1
|
||||
readonly property bool willTouchBottomEdge: isPanelVisible && allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1)
|
||||
@@ -506,59 +505,59 @@ Item {
|
||||
|
||||
readonly property bool isActuallyAttachedToAnyEdge: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return willTouchTopBar || willTouchBottomBar || willTouchLeftBar || willTouchRightBar || willTouchTopEdge || willTouchBottomEdge || willTouchLeftEdge || willTouchRightEdge
|
||||
return false;
|
||||
return willTouchTopBar || willTouchBottomBar || willTouchLeftBar || willTouchRightBar || willTouchTopEdge || willTouchBottomEdge || willTouchLeftEdge || willTouchRightEdge;
|
||||
}
|
||||
|
||||
readonly property bool animateFromTop: {
|
||||
if (!isPanelVisible)
|
||||
return true
|
||||
return true;
|
||||
if (willTouchTopBar)
|
||||
return true
|
||||
return true;
|
||||
if (willTouchTopEdge && !willTouchTopBar && !willTouchBottomBar && !willTouchLeftBar && !willTouchRightBar)
|
||||
return true
|
||||
return true;
|
||||
if (!isActuallyAttachedToAnyEdge)
|
||||
return true
|
||||
return false
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
readonly property bool animateFromBottom: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchBottomBar)
|
||||
return true
|
||||
return true;
|
||||
if (willTouchBottomEdge && !willTouchTopBar && !willTouchBottomBar && !willTouchLeftBar && !willTouchRightBar)
|
||||
return true
|
||||
return false
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
readonly property bool animateFromLeft: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchTopBar || willTouchBottomBar)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchLeftBar)
|
||||
return true
|
||||
var touchingTopEdge = isPanelVisible && allowAttach && panelBackground.targetY <= 1
|
||||
var touchingBottomEdge = isPanelVisible && allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1)
|
||||
return true;
|
||||
var touchingTopEdge = isPanelVisible && allowAttach && panelBackground.targetY <= 1;
|
||||
var touchingBottomEdge = isPanelVisible && allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1);
|
||||
if (touchingTopEdge || touchingBottomEdge)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchLeftEdge && !willTouchLeftBar && !willTouchTopBar && !willTouchBottomBar && !willTouchRightBar)
|
||||
return true
|
||||
return false
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
readonly property bool animateFromRight: {
|
||||
if (!isPanelVisible)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchTopBar || willTouchBottomBar)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchRightBar)
|
||||
return true
|
||||
var touchingTopEdge = isPanelVisible && allowAttach && panelBackground.targetY <= 1
|
||||
var touchingBottomEdge = isPanelVisible && allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1)
|
||||
return true;
|
||||
var touchingTopEdge = isPanelVisible && allowAttach && panelBackground.targetY <= 1;
|
||||
var touchingBottomEdge = isPanelVisible && allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1);
|
||||
if (touchingTopEdge || touchingBottomEdge)
|
||||
return false
|
||||
return false;
|
||||
if (willTouchRightEdge && !willTouchLeftBar && !willTouchTopBar && !willTouchBottomBar && !willTouchRightBar)
|
||||
return true
|
||||
return false
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
readonly property bool shouldAnimateWidth: !shouldAnimateHeight && (animateFromLeft || animateFromRight)
|
||||
@@ -567,17 +566,17 @@ Item {
|
||||
// Current animated width/height
|
||||
readonly property real currentWidth: {
|
||||
if (isClosing && opacityFadeComplete && shouldAnimateWidth)
|
||||
return 0
|
||||
return 0;
|
||||
if (isClosing || isPanelVisible)
|
||||
return targetWidth
|
||||
return 0
|
||||
return targetWidth;
|
||||
return 0;
|
||||
}
|
||||
readonly property real currentHeight: {
|
||||
if (isClosing && opacityFadeComplete && shouldAnimateHeight)
|
||||
return 0
|
||||
return 0;
|
||||
if (isClosing || isPanelVisible)
|
||||
return targetHeight
|
||||
return 0
|
||||
return targetHeight;
|
||||
return 0;
|
||||
}
|
||||
|
||||
width: currentWidth
|
||||
@@ -586,28 +585,28 @@ Item {
|
||||
x: {
|
||||
if (animateFromRight) {
|
||||
if (isPanelVisible || isClosing) {
|
||||
var targetRightEdge = targetX + targetWidth
|
||||
return targetRightEdge - width
|
||||
var targetRightEdge = targetX + targetWidth;
|
||||
return targetRightEdge - width;
|
||||
}
|
||||
}
|
||||
return targetX
|
||||
return targetX;
|
||||
}
|
||||
y: {
|
||||
if (animateFromBottom) {
|
||||
if (isPanelVisible || isClosing) {
|
||||
var targetBottomEdge = targetY + targetHeight
|
||||
return targetBottomEdge - height
|
||||
var targetBottomEdge = targetY + targetHeight;
|
||||
return targetBottomEdge - height;
|
||||
}
|
||||
}
|
||||
return targetY
|
||||
return targetY;
|
||||
}
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
duration: {
|
||||
if (!panelBackground.shouldAnimateWidth)
|
||||
return 0
|
||||
return root.isClosing ? Style.animationFast : Style.animationNormal
|
||||
return 0;
|
||||
return root.isClosing ? Style.animationFast : Style.animationNormal;
|
||||
}
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: panelBackground.bezierCurve
|
||||
@@ -618,8 +617,8 @@ Item {
|
||||
NumberAnimation {
|
||||
duration: {
|
||||
if (!panelBackground.shouldAnimateHeight)
|
||||
return 0
|
||||
return root.isClosing ? Style.animationFast : Style.animationNormal
|
||||
return 0;
|
||||
return root.isClosing ? Style.animationFast : Style.animationNormal;
|
||||
}
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: panelBackground.bezierCurve
|
||||
@@ -628,75 +627,75 @@ Item {
|
||||
|
||||
// Corner states for PanelBackground to read
|
||||
property int topLeftCornerState: {
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "top" && !root.barIsVertical && root.effectivePanelAnchorTop) || (root.barPosition === "left" && root.barIsVertical && root.effectivePanelAnchorLeft))
|
||||
var barTouchInverted = touchingTopBar || touchingLeftBar
|
||||
var edgeInverted = allowAttach && (touchingLeftEdge || touchingTopEdge)
|
||||
var oppositeEdgeInverted = allowAttach && (touchingTopEdge && !root.barIsVertical && root.barPosition !== "top")
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "top" && !root.barIsVertical && root.effectivePanelAnchorTop) || (root.barPosition === "left" && root.barIsVertical && root.effectivePanelAnchorLeft));
|
||||
var barTouchInverted = touchingTopBar || touchingLeftBar;
|
||||
var edgeInverted = allowAttach && (touchingLeftEdge || touchingTopEdge);
|
||||
var oppositeEdgeInverted = allowAttach && (touchingTopEdge && !root.barIsVertical && root.barPosition !== "top");
|
||||
|
||||
if (barInverted || barTouchInverted || edgeInverted || oppositeEdgeInverted) {
|
||||
if (touchingLeftEdge && touchingTopEdge)
|
||||
return 0
|
||||
return 0;
|
||||
if (touchingLeftEdge)
|
||||
return 2
|
||||
return 2;
|
||||
if (touchingTopEdge)
|
||||
return 1
|
||||
return root.barIsVertical ? 2 : 1
|
||||
return 1;
|
||||
return root.barIsVertical ? 2 : 1;
|
||||
}
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
property int topRightCornerState: {
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "top" && !root.barIsVertical && root.effectivePanelAnchorTop) || (root.barPosition === "right" && root.barIsVertical && root.effectivePanelAnchorRight))
|
||||
var barTouchInverted = touchingTopBar || touchingRightBar
|
||||
var edgeInverted = allowAttach && (touchingRightEdge || touchingTopEdge)
|
||||
var oppositeEdgeInverted = allowAttach && (touchingTopEdge && !root.barIsVertical && root.barPosition !== "top")
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "top" && !root.barIsVertical && root.effectivePanelAnchorTop) || (root.barPosition === "right" && root.barIsVertical && root.effectivePanelAnchorRight));
|
||||
var barTouchInverted = touchingTopBar || touchingRightBar;
|
||||
var edgeInverted = allowAttach && (touchingRightEdge || touchingTopEdge);
|
||||
var oppositeEdgeInverted = allowAttach && (touchingTopEdge && !root.barIsVertical && root.barPosition !== "top");
|
||||
|
||||
if (barInverted || barTouchInverted || edgeInverted || oppositeEdgeInverted) {
|
||||
if (touchingRightEdge && touchingTopEdge)
|
||||
return 0
|
||||
return 0;
|
||||
if (touchingRightEdge)
|
||||
return 2
|
||||
return 2;
|
||||
if (touchingTopEdge)
|
||||
return 1
|
||||
return root.barIsVertical ? 2 : 1
|
||||
return 1;
|
||||
return root.barIsVertical ? 2 : 1;
|
||||
}
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
property int bottomLeftCornerState: {
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "bottom" && !root.barIsVertical && root.effectivePanelAnchorBottom) || (root.barPosition === "left" && root.barIsVertical && root.effectivePanelAnchorLeft))
|
||||
var barTouchInverted = touchingBottomBar || touchingLeftBar
|
||||
var edgeInverted = allowAttach && (touchingLeftEdge || touchingBottomEdge)
|
||||
var oppositeEdgeInverted = allowAttach && (touchingBottomEdge && !root.barIsVertical && root.barPosition !== "bottom")
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "bottom" && !root.barIsVertical && root.effectivePanelAnchorBottom) || (root.barPosition === "left" && root.barIsVertical && root.effectivePanelAnchorLeft));
|
||||
var barTouchInverted = touchingBottomBar || touchingLeftBar;
|
||||
var edgeInverted = allowAttach && (touchingLeftEdge || touchingBottomEdge);
|
||||
var oppositeEdgeInverted = allowAttach && (touchingBottomEdge && !root.barIsVertical && root.barPosition !== "bottom");
|
||||
|
||||
if (barInverted || barTouchInverted || edgeInverted || oppositeEdgeInverted) {
|
||||
if (touchingLeftEdge && touchingBottomEdge)
|
||||
return 0
|
||||
return 0;
|
||||
if (touchingLeftEdge)
|
||||
return 2
|
||||
return 2;
|
||||
if (touchingBottomEdge)
|
||||
return 1
|
||||
return root.barIsVertical ? 2 : 1
|
||||
return 1;
|
||||
return root.barIsVertical ? 2 : 1;
|
||||
}
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
property int bottomRightCornerState: {
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "bottom" && !root.barIsVertical && root.effectivePanelAnchorBottom) || (root.barPosition === "right" && root.barIsVertical && root.effectivePanelAnchorRight))
|
||||
var barTouchInverted = touchingBottomBar || touchingRightBar
|
||||
var edgeInverted = allowAttach && (touchingRightEdge || touchingBottomEdge)
|
||||
var oppositeEdgeInverted = allowAttach && (touchingBottomEdge && !root.barIsVertical && root.barPosition !== "bottom")
|
||||
var barInverted = allowAttachToBar && ((root.barPosition === "bottom" && !root.barIsVertical && root.effectivePanelAnchorBottom) || (root.barPosition === "right" && root.barIsVertical && root.effectivePanelAnchorRight));
|
||||
var barTouchInverted = touchingBottomBar || touchingRightBar;
|
||||
var edgeInverted = allowAttach && (touchingRightEdge || touchingBottomEdge);
|
||||
var oppositeEdgeInverted = allowAttach && (touchingBottomEdge && !root.barIsVertical && root.barPosition !== "bottom");
|
||||
|
||||
if (barInverted || barTouchInverted || edgeInverted || oppositeEdgeInverted) {
|
||||
if (touchingRightEdge && touchingBottomEdge)
|
||||
return 0
|
||||
return 0;
|
||||
if (touchingRightEdge)
|
||||
return 2
|
||||
return 2;
|
||||
if (touchingBottomEdge)
|
||||
return 1
|
||||
return root.barIsVertical ? 2 : 1
|
||||
return 1;
|
||||
return root.barIsVertical ? 2 : 1;
|
||||
}
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,12 @@ import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.Commons
|
||||
|
||||
|
||||
/**
|
||||
* ScreenCorners - Shape component for rendering screen corners
|
||||
*
|
||||
* Renders concave corners at the screen edges to create a rounded screen effect.
|
||||
* Self-contained Shape component (no shadows).
|
||||
*/
|
||||
* ScreenCorners - Shape component for rendering screen corners
|
||||
*
|
||||
* Renders concave corners at the screen edges to create a rounded screen effect.
|
||||
* Self-contained Shape component (no shadows).
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
||||
@@ -3,15 +3,14 @@ import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
|
||||
|
||||
/**
|
||||
* SmartPanel - Wrapper that creates placeholder + content window
|
||||
*
|
||||
* This component is a thin wrapper that maintains backward compatibility
|
||||
* while splitting panel rendering into:
|
||||
* 1. PanelPlaceholder (in MainScreen, for background rendering)
|
||||
* 2. SmartPanelWindow (separate window, for content)
|
||||
*/
|
||||
* SmartPanel - Wrapper that creates placeholder + content window
|
||||
*
|
||||
* This component is a thin wrapper that maintains backward compatibility
|
||||
* while splitting panel rendering into:
|
||||
* 1. PanelPlaceholder (in MainScreen, for background rendering)
|
||||
* 2. SmartPanelWindow (separate window, for content)
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
@@ -59,60 +58,74 @@ Item {
|
||||
|
||||
// Keyboard event handlers - these can be overridden by panel implementations
|
||||
// Note: SmartPanelWindow directly calls these functions via panelWrapper reference
|
||||
function onEscapePressed() {}
|
||||
function onTabPressed() {}
|
||||
function onBackTabPressed() {}
|
||||
function onUpPressed() {}
|
||||
function onDownPressed() {}
|
||||
function onLeftPressed() {}
|
||||
function onRightPressed() {}
|
||||
function onReturnPressed() {}
|
||||
function onHomePressed() {}
|
||||
function onEndPressed() {}
|
||||
function onPageUpPressed() {}
|
||||
function onPageDownPressed() {}
|
||||
function onCtrlJPressed() {}
|
||||
function onCtrlKPressed() {}
|
||||
function onEscapePressed() {
|
||||
}
|
||||
function onTabPressed() {
|
||||
}
|
||||
function onBackTabPressed() {
|
||||
}
|
||||
function onUpPressed() {
|
||||
}
|
||||
function onDownPressed() {
|
||||
}
|
||||
function onLeftPressed() {
|
||||
}
|
||||
function onRightPressed() {
|
||||
}
|
||||
function onReturnPressed() {
|
||||
}
|
||||
function onHomePressed() {
|
||||
}
|
||||
function onEndPressed() {
|
||||
}
|
||||
function onPageUpPressed() {
|
||||
}
|
||||
function onPageDownPressed() {
|
||||
}
|
||||
function onCtrlJPressed() {
|
||||
}
|
||||
function onCtrlKPressed() {
|
||||
}
|
||||
|
||||
// Public control functions
|
||||
function toggle(buttonItem, buttonName) {
|
||||
// Ensure window is created before toggling
|
||||
if (!root.windowActive) {
|
||||
root.windowActive = true
|
||||
root.windowActive = true;
|
||||
Qt.callLater(function () {
|
||||
if (windowLoader.item) {
|
||||
windowLoader.item.toggle(buttonItem, buttonName)
|
||||
windowLoader.item.toggle(buttonItem, buttonName);
|
||||
}
|
||||
})
|
||||
});
|
||||
} else if (windowLoader.item) {
|
||||
windowLoader.item.toggle(buttonItem, buttonName)
|
||||
windowLoader.item.toggle(buttonItem, buttonName);
|
||||
}
|
||||
}
|
||||
|
||||
function open(buttonItem, buttonName) {
|
||||
// Ensure window is created before opening
|
||||
if (!root.windowActive) {
|
||||
root.windowActive = true
|
||||
root.windowActive = true;
|
||||
Qt.callLater(function () {
|
||||
if (windowLoader.item) {
|
||||
windowLoader.item.open(buttonItem, buttonName)
|
||||
windowLoader.item.open(buttonItem, buttonName);
|
||||
}
|
||||
})
|
||||
});
|
||||
} else if (windowLoader.item) {
|
||||
windowLoader.item.open(buttonItem, buttonName)
|
||||
windowLoader.item.open(buttonItem, buttonName);
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
if (windowLoader.item) {
|
||||
windowLoader.item.close()
|
||||
windowLoader.item.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Expose setPosition for panels that need to recalculate on settings changes
|
||||
function setPosition() {
|
||||
if (panelPlaceholder) {
|
||||
panelPlaceholder.setPosition()
|
||||
panelPlaceholder.setPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,11 +170,11 @@ Item {
|
||||
// Forward signals
|
||||
onPanelOpened: root.opened()
|
||||
onPanelClosed: {
|
||||
root.closed()
|
||||
root.closed();
|
||||
// Destroy the window after close animation completes
|
||||
Qt.callLater(function () {
|
||||
root.windowActive = false
|
||||
})
|
||||
root.windowActive = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,9 +185,9 @@ Item {
|
||||
// Use Qt.callLater to ensure objectName is set by parent before registering
|
||||
Qt.callLater(function () {
|
||||
if (!objectName) {
|
||||
Logger.w("SmartPanel", "Panel created without objectName - PanelService registration may fail")
|
||||
Logger.w("SmartPanel", "Panel created without objectName - PanelService registration may fail");
|
||||
}
|
||||
PanelService.registerPanel(root)
|
||||
})
|
||||
PanelService.registerPanel(root);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,12 @@ import qs.Commons
|
||||
import qs.Services.Compositor
|
||||
import qs.Services.UI
|
||||
|
||||
|
||||
/**
|
||||
* SmartPanelWindow - Separate window for panel content
|
||||
*
|
||||
* This component runs in its own window, separate from MainScreen.
|
||||
* It follows the PanelPlaceholder for positioning and contains the actual panel content.
|
||||
*/
|
||||
* SmartPanelWindow - Separate window for panel content
|
||||
*
|
||||
* This component runs in its own window, separate from MainScreen.
|
||||
* It follows the PanelPlaceholder for positioning and contains the actual panel content.
|
||||
*/
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
@@ -63,13 +62,13 @@ PanelWindow {
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: {
|
||||
if (!root.isPanelOpen) {
|
||||
return WlrKeyboardFocus.None
|
||||
return WlrKeyboardFocus.None;
|
||||
}
|
||||
if (CompositorService.isHyprland) {
|
||||
// Exclusive focus on hyprland is too restrictive.
|
||||
return WlrKeyboardFocus.OnDemand
|
||||
return WlrKeyboardFocus.OnDemand;
|
||||
} else {
|
||||
return root.exclusiveKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.OnDemand
|
||||
return root.exclusiveKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.OnDemand;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,95 +90,95 @@ PanelWindow {
|
||||
|
||||
// Sync state to placeholder
|
||||
onIsPanelVisibleChanged: {
|
||||
placeholder.isPanelVisible = isPanelVisible
|
||||
placeholder.isPanelVisible = isPanelVisible;
|
||||
}
|
||||
onIsClosingChanged: {
|
||||
placeholder.isClosing = isClosing
|
||||
placeholder.isClosing = isClosing;
|
||||
}
|
||||
onOpacityFadeCompleteChanged: {
|
||||
placeholder.opacityFadeComplete = opacityFadeComplete
|
||||
placeholder.opacityFadeComplete = opacityFadeComplete;
|
||||
}
|
||||
|
||||
// Panel control functions
|
||||
function toggle(buttonItem, buttonName) {
|
||||
if (!isPanelOpen) {
|
||||
open(buttonItem, buttonName)
|
||||
open(buttonItem, buttonName);
|
||||
} else {
|
||||
close()
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function open(buttonItem, buttonName) {
|
||||
if (!buttonItem && buttonName) {
|
||||
buttonItem = BarService.lookupWidget(buttonName, placeholder.screen.name)
|
||||
buttonItem = BarService.lookupWidget(buttonName, placeholder.screen.name);
|
||||
}
|
||||
|
||||
if (buttonItem) {
|
||||
placeholder.buttonItem = buttonItem
|
||||
placeholder.buttonItem = buttonItem;
|
||||
// Map button position to screen coordinates
|
||||
var buttonPos = buttonItem.mapToItem(null, 0, 0)
|
||||
placeholder.buttonPosition = Qt.point(buttonPos.x, buttonPos.y)
|
||||
placeholder.buttonWidth = buttonItem.width
|
||||
placeholder.buttonHeight = buttonItem.height
|
||||
placeholder.useButtonPosition = true
|
||||
var buttonPos = buttonItem.mapToItem(null, 0, 0);
|
||||
placeholder.buttonPosition = Qt.point(buttonPos.x, buttonPos.y);
|
||||
placeholder.buttonWidth = buttonItem.width;
|
||||
placeholder.buttonHeight = buttonItem.height;
|
||||
placeholder.useButtonPosition = true;
|
||||
} else {
|
||||
// No button provided: reset button position mode
|
||||
placeholder.buttonItem = null
|
||||
placeholder.useButtonPosition = false
|
||||
placeholder.buttonItem = null;
|
||||
placeholder.useButtonPosition = false;
|
||||
}
|
||||
|
||||
// Set isPanelOpen to trigger content loading
|
||||
isPanelOpen = true
|
||||
isPanelOpen = true;
|
||||
|
||||
// Notify PanelService
|
||||
PanelService.willOpenPanel(root)
|
||||
PanelService.willOpenPanel(root);
|
||||
}
|
||||
|
||||
function close() {
|
||||
// Start close sequence: fade opacity first
|
||||
isClosing = true
|
||||
sizeAnimationComplete = false
|
||||
closeFinalized = false
|
||||
isClosing = true;
|
||||
sizeAnimationComplete = false;
|
||||
closeFinalized = false;
|
||||
|
||||
// Stop the open animation timer if it's still running
|
||||
opacityTrigger.stop()
|
||||
openWatchdogActive = false
|
||||
openWatchdogTimer.stop()
|
||||
opacityTrigger.stop();
|
||||
openWatchdogActive = false;
|
||||
openWatchdogTimer.stop();
|
||||
|
||||
// Start close watchdog timer
|
||||
closeWatchdogActive = true
|
||||
closeWatchdogTimer.restart()
|
||||
closeWatchdogActive = true;
|
||||
closeWatchdogTimer.restart();
|
||||
|
||||
// If opacity is already 0, skip directly to size animation
|
||||
if (contentWrapper.opacity === 0.0) {
|
||||
opacityFadeComplete = true
|
||||
opacityFadeComplete = true;
|
||||
} else {
|
||||
opacityFadeComplete = false
|
||||
opacityFadeComplete = false;
|
||||
}
|
||||
|
||||
Logger.d("SmartPanelWindow", "Closing panel", placeholder.panelName)
|
||||
Logger.d("SmartPanelWindow", "Closing panel", placeholder.panelName);
|
||||
}
|
||||
|
||||
function finalizeClose() {
|
||||
// Prevent double-finalization
|
||||
if (root.closeFinalized) {
|
||||
Logger.w("SmartPanelWindow", "finalizeClose called but already finalized - ignoring", placeholder.panelName)
|
||||
return
|
||||
Logger.w("SmartPanelWindow", "finalizeClose called but already finalized - ignoring", placeholder.panelName);
|
||||
return;
|
||||
}
|
||||
|
||||
// Complete the close sequence after animations finish
|
||||
root.closeFinalized = true
|
||||
root.closeWatchdogActive = false
|
||||
closeWatchdogTimer.stop()
|
||||
root.closeFinalized = true;
|
||||
root.closeWatchdogActive = false;
|
||||
closeWatchdogTimer.stop();
|
||||
|
||||
root.isPanelVisible = false
|
||||
root.isPanelOpen = false
|
||||
root.isClosing = false
|
||||
root.opacityFadeComplete = false
|
||||
PanelService.closedPanel(root)
|
||||
panelClosed()
|
||||
root.isPanelVisible = false;
|
||||
root.isPanelOpen = false;
|
||||
root.isClosing = false;
|
||||
root.opacityFadeComplete = false;
|
||||
PanelService.closedPanel(root);
|
||||
panelClosed();
|
||||
|
||||
Logger.d("SmartPanelWindow", "Panel close finalized", placeholder.panelName)
|
||||
Logger.d("SmartPanelWindow", "Panel close finalized", placeholder.panelName);
|
||||
}
|
||||
|
||||
// Fullscreen container for click-to-close and content
|
||||
@@ -189,59 +188,59 @@ PanelWindow {
|
||||
|
||||
// Handle keyboard events directly via Keys handler
|
||||
Keys.onPressed: event => {
|
||||
Logger.d("SmartPanelWindow", "Key pressed:", event.key, "for panel:", placeholder.panelName)
|
||||
Logger.d("SmartPanelWindow", "Key pressed:", event.key, "for panel:", placeholder.panelName);
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
panelWrapper.onEscapePressed()
|
||||
panelWrapper.onEscapePressed();
|
||||
if (closeWithEscape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
} else if (panelWrapper) {
|
||||
if (event.key === Qt.Key_Up && panelWrapper.onUpPressed) {
|
||||
panelWrapper.onUpPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onUpPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Down && panelWrapper.onDownPressed) {
|
||||
panelWrapper.onDownPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onDownPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Left && panelWrapper.onLeftPressed) {
|
||||
panelWrapper.onLeftPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onLeftPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Right && panelWrapper.onRightPressed) {
|
||||
panelWrapper.onRightPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onRightPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Tab && panelWrapper.onTabPressed) {
|
||||
panelWrapper.onTabPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onTabPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Backtab && panelWrapper.onBackTabPressed) {
|
||||
panelWrapper.onBackTabPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onBackTabPressed();
|
||||
event.accepted = true;
|
||||
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && panelWrapper.onReturnPressed) {
|
||||
panelWrapper.onReturnPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onReturnPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Home && panelWrapper.onHomePressed) {
|
||||
panelWrapper.onHomePressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onHomePressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_End && panelWrapper.onEndPressed) {
|
||||
panelWrapper.onEndPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onEndPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_PageUp && panelWrapper.onPageUpPressed) {
|
||||
panelWrapper.onPageUpPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onPageUpPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_PageDown && panelWrapper.onPageDownPressed) {
|
||||
panelWrapper.onPageDownPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onPageDownPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_J && (event.modifiers & Qt.ControlModifier) && panelWrapper.onCtrlJPressed) {
|
||||
panelWrapper.onCtrlJPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onCtrlJPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_K && (event.modifiers & Qt.ControlModifier) && panelWrapper.onCtrlKPressed) {
|
||||
panelWrapper.onCtrlKPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onCtrlKPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_N && (event.modifiers & Qt.ControlModifier) && panelWrapper.onCtrlNPressed) {
|
||||
panelWrapper.onCtrlNPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onCtrlNPressed();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_P && (event.modifiers & Qt.ControlModifier) && panelWrapper.onCtrlPPressed) {
|
||||
panelWrapper.onCtrlPPressed()
|
||||
event.accepted = true
|
||||
panelWrapper.onCtrlPPressed();
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,8 +251,8 @@ PanelWindow {
|
||||
enabled: root.isPanelOpen && !root.isClosing
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: mouse => {
|
||||
root.close()
|
||||
mouse.accepted = true
|
||||
root.close();
|
||||
mouse.accepted = true;
|
||||
}
|
||||
z: 0
|
||||
}
|
||||
@@ -271,10 +270,10 @@ PanelWindow {
|
||||
// Opacity animation
|
||||
opacity: {
|
||||
if (isClosing)
|
||||
return 0.0
|
||||
return 0.0;
|
||||
if (isPanelVisible && sizeAnimationComplete)
|
||||
return 1.0
|
||||
return 0.0
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
@@ -287,33 +286,33 @@ PanelWindow {
|
||||
// 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
|
||||
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)
|
||||
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()
|
||||
root.openWatchdogActive = false;
|
||||
openWatchdogTimer.stop();
|
||||
}
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
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)
|
||||
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()
|
||||
root.openWatchdogActive = false;
|
||||
openWatchdogTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,31 +329,31 @@ PanelWindow {
|
||||
onLoaded: {
|
||||
// Capture initial content-driven size if available
|
||||
if (contentLoader.item) {
|
||||
var hasWidthProp = contentLoader.item.hasOwnProperty('contentPreferredWidth')
|
||||
var hasHeightProp = contentLoader.item.hasOwnProperty('contentPreferredHeight')
|
||||
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)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate position in placeholder
|
||||
placeholder.setPosition()
|
||||
placeholder.setPosition();
|
||||
|
||||
// Make panel visible on the next frame
|
||||
Qt.callLater(function () {
|
||||
root.isPanelVisible = true
|
||||
opacityTrigger.start()
|
||||
root.isPanelVisible = true;
|
||||
opacityTrigger.start();
|
||||
|
||||
// Start open watchdog timer
|
||||
root.openWatchdogActive = true
|
||||
openWatchdogTimer.start()
|
||||
root.openWatchdogActive = true;
|
||||
openWatchdogTimer.start();
|
||||
|
||||
panelOpened()
|
||||
})
|
||||
panelOpened();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +362,7 @@ PanelWindow {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: mouse => {
|
||||
mouse.accepted = true // Eat the click to prevent propagation to background
|
||||
mouse.accepted = true; // Eat the click to prevent propagation to background
|
||||
}
|
||||
z: -1 // Behind content but above background click-to-close
|
||||
}
|
||||
@@ -375,13 +374,13 @@ PanelWindow {
|
||||
|
||||
function onContentPreferredWidthChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(contentLoader.item.contentPreferredWidth, placeholder.contentPreferredHeight)
|
||||
placeholder.updateContentSize(contentLoader.item.contentPreferredWidth, placeholder.contentPreferredHeight);
|
||||
}
|
||||
}
|
||||
|
||||
function onContentPreferredHeightChanged() {
|
||||
if (root.isPanelOpen && root.isPanelVisible && contentLoader.item) {
|
||||
placeholder.updateContentSize(placeholder.contentPreferredWidth, contentLoader.item.contentPreferredHeight)
|
||||
placeholder.updateContentSize(placeholder.contentPreferredWidth, contentLoader.item.contentPreferredHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,7 +394,7 @@ PanelWindow {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (root.isPanelVisible) {
|
||||
root.sizeAnimationComplete = true
|
||||
root.sizeAnimationComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,11 +406,11 @@ PanelWindow {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (root.openWatchdogActive) {
|
||||
Logger.w("SmartPanelWindow", "Open watchdog timeout - forcing panel visible state", placeholder.panelName)
|
||||
root.openWatchdogActive = false
|
||||
Logger.w("SmartPanelWindow", "Open watchdog timeout - forcing panel visible state", placeholder.panelName);
|
||||
root.openWatchdogActive = false;
|
||||
if (root.isPanelOpen && !root.isPanelVisible) {
|
||||
root.isPanelVisible = true
|
||||
root.sizeAnimationComplete = true
|
||||
root.isPanelVisible = true;
|
||||
root.sizeAnimationComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,8 +423,8 @@ PanelWindow {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (root.closeWatchdogActive && !root.closeFinalized) {
|
||||
Logger.w("SmartPanelWindow", "Close watchdog timeout - forcing panel close", placeholder.panelName)
|
||||
Qt.callLater(root.finalizeClose)
|
||||
Logger.w("SmartPanelWindow", "Close watchdog timeout - forcing panel close", placeholder.panelName);
|
||||
Qt.callLater(root.finalizeClose);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,14 +436,14 @@ PanelWindow {
|
||||
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) {
|
||||
Qt.callLater(root.finalizeClose)
|
||||
Qt.callLater(root.finalizeClose);
|
||||
}
|
||||
}
|
||||
|
||||
function onHeightChanged() {
|
||||
// When height shrinks to 0 during close and we're animating height, finalize
|
||||
if (root.isClosing && placeholder.panelItem.height === 0 && placeholder.panelItem.shouldAnimateHeight) {
|
||||
Qt.callLater(root.finalizeClose)
|
||||
Qt.callLater(root.finalizeClose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
import qs.Modules.Bar.Extras
|
||||
import qs.Services.UI
|
||||
|
||||
// Separate window for TrayMenu context menus
|
||||
// This is a top-level PanelWindow (sibling to MainScreen, not nested inside it)
|
||||
@@ -30,18 +30,18 @@ PanelWindow {
|
||||
|
||||
// Register with PanelService so panels can find this window
|
||||
Component.onCompleted: {
|
||||
objectName = "trayMenuWindow-" + (screen?.name || "unknown")
|
||||
PanelService.registerTrayMenuWindow(screen, root)
|
||||
objectName = "trayMenuWindow-" + (screen?.name || "unknown");
|
||||
PanelService.registerTrayMenuWindow(screen, root);
|
||||
}
|
||||
|
||||
function open() {
|
||||
visible = true
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
visible = false
|
||||
visible = false;
|
||||
if (trayMenu.item) {
|
||||
trayMenu.item.hideMenu()
|
||||
trayMenu.item.hideMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ PanelWindow {
|
||||
source: Quickshell.shellDir + "/Modules/Bar/Extras/TrayMenu.qml"
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
item.screen = root.screen
|
||||
item.screen = root.screen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user