Reimplement the MediaMini and ActiveWindow fix
Revert ScreenCorner fix (didn't work at all)
This commit is contained in:
parent
58b93c9d22
commit
91ffa4a9fd
3 changed files with 61 additions and 117 deletions
|
|
@ -41,14 +41,15 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: fullTitleMetrics
|
id: fullTitleMetrics
|
||||||
visible: false
|
visible: false
|
||||||
text: titleText.text
|
text: getTitle()
|
||||||
font: titleText.font
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
|
font.weight: Style.fontWeightMedium
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
// Let the Rectangle size itself based on its content (the Row)
|
// Let the Rectangle size itself based on its content (the Row)
|
||||||
visible: root.visible
|
visible: root.visible
|
||||||
width: row.width + Style.marginM * scaling * 2
|
width: row.width + Style.marginS * scaling
|
||||||
height: Math.round(Style.capsuleHeight * scaling)
|
height: Math.round(Style.capsuleHeight * scaling)
|
||||||
radius: Math.round(Style.radiusM * scaling)
|
radius: Math.round(Style.radiusM * scaling)
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
|
|
@ -60,6 +61,7 @@ Row {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Style.marginS * scaling
|
anchors.leftMargin: Style.marginS * scaling
|
||||||
anchors.rightMargin: Style.marginS * scaling
|
anchors.rightMargin: Style.marginS * scaling
|
||||||
|
clip: true
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row
|
id: row
|
||||||
|
|
@ -86,9 +88,10 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: titleText
|
id: titleText
|
||||||
|
|
||||||
// Collapsed width when not hovered, expand on hover
|
// For short titles, show full. For long titles, truncate and expand on hover
|
||||||
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
|
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + 8,
|
||||||
400 * scaling) : (minWidth * scaling)
|
400 * scaling) : Math.min(fullTitleMetrics.contentWidth + 12,
|
||||||
|
200 * scaling)
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: getTitle()
|
text: getTitle()
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: fullTitleMetrics
|
id: fullTitleMetrics
|
||||||
visible: false
|
visible: false
|
||||||
text: titleText.text
|
text: getTitle()
|
||||||
font: titleText.font
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
|
font.weight: Style.fontWeightMedium
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
@ -49,6 +50,37 @@ Row {
|
||||||
width: 200 * scaling
|
width: 200 * scaling
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mouse area for hover detection - direct child of Rectangle
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (mouse.button === Qt.LeftButton) {
|
||||||
|
MediaService.playPause()
|
||||||
|
} else if (mouse.button == Qt.RightButton) {
|
||||||
|
MediaService.next()
|
||||||
|
// Need to hide the tooltip instantly
|
||||||
|
tooltip.visible = false
|
||||||
|
} else if (mouse.button == Qt.MiddleButton) {
|
||||||
|
MediaService.previous()
|
||||||
|
// Need to hide the tooltip instantly
|
||||||
|
tooltip.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
if (tooltip.text !== "") {
|
||||||
|
tooltip.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
tooltip.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: mainContainer
|
id: mainContainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -140,18 +172,18 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: titleText
|
id: titleText
|
||||||
|
|
||||||
// If hovered or just switched window, show up to 400 pixels
|
// If hovered, show up to 400 pixels, otherwise show up to 120 pixels
|
||||||
// If not hovered show up to 120 pixels
|
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
|
||||||
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth,
|
400 * scaling) : Math.min(
|
||||||
400 * scaling) : Math.min(fullTitleMetrics.contentWidth,
|
fullTitleMetrics.contentWidth + (Style.marginS * scaling), 120 * scaling)
|
||||||
120 * scaling)
|
|
||||||
text: getTitle()
|
text: getTitle()
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
font.weight: Style.fontWeightMedium
|
font.weight: Style.fontWeightMedium
|
||||||
elide: Text.ElideRight
|
elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: Color.mTertiary
|
color: Color.mTertiary
|
||||||
|
clip: true
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
@ -161,37 +193,6 @@ Row {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse area for hover detection
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
|
||||||
onClicked: mouse => {
|
|
||||||
if (mouse.button === Qt.LeftButton) {
|
|
||||||
MediaService.playPause()
|
|
||||||
} else if (mouse.button == Qt.RightButton) {
|
|
||||||
MediaService.next()
|
|
||||||
// Need to hide the tooltip instantly
|
|
||||||
tooltip.visible = false
|
|
||||||
} else if (mouse.button == Qt.MiddleButton) {
|
|
||||||
MediaService.previous()
|
|
||||||
// Need to hide the tooltip instantly
|
|
||||||
tooltip.visible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onEntered: {
|
|
||||||
if (tooltip.text !== "") {
|
|
||||||
tooltip.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: {
|
|
||||||
tooltip.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,21 +41,6 @@ Loader {
|
||||||
readonly property real barHeight: Style.barHeight * scaling
|
readonly property real barHeight: Style.barHeight * scaling
|
||||||
readonly property bool barAtBottom: Settings.data.bar.position === "bottom"
|
readonly property bool barAtBottom: Settings.data.bar.position === "bottom"
|
||||||
|
|
||||||
// Helper function to check if bar is enabled on this screen
|
|
||||||
function isBarEnabled(screen) {
|
|
||||||
if (!screen || !screen.name)
|
|
||||||
return false
|
|
||||||
return Settings.data.bar.monitors.includes(screen.name) || (Settings.data.bar.monitors.length === 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to get effective bar height (accounting for opacity)
|
|
||||||
function getEffectiveBarHeight(screen) {
|
|
||||||
if (!isBarEnabled(screen))
|
|
||||||
return 0
|
|
||||||
// If bar opacity is 0, treat it as if bar is not there for dimming purposes
|
|
||||||
return Settings.data.bar.backgroundOpacity > 0 ? barHeight : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
signal opened
|
signal opened
|
||||||
signal closed
|
signal closed
|
||||||
|
|
||||||
|
|
@ -147,19 +132,27 @@ Loader {
|
||||||
|
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
// Dim desktop if required - but exclude corners if screen corners are enabled
|
// Dim desktop if required
|
||||||
color: Color.transparent
|
color: (root.active && !root.isClosing && Settings.data.general.dimDesktop) ? Color.applyOpacity(
|
||||||
|
Color.mShadow,
|
||||||
|
"BB") : Color.transparent
|
||||||
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
WlrLayershell.namespace: "noctalia-panel"
|
WlrLayershell.namespace: "noctalia-panel"
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Style.animationNormal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
anchors.right: true
|
anchors.right: true
|
||||||
anchors.bottom: true
|
anchors.bottom: true
|
||||||
margins.top: !barAtBottom ? getEffectiveBarHeight(screen) : 0
|
margins.top: !barAtBottom ? barHeight : 0
|
||||||
margins.bottom: barAtBottom ? getEffectiveBarHeight(screen) : 0
|
margins.bottom: barAtBottom ? barHeight : 0
|
||||||
|
|
||||||
// Close any panel with Esc without requiring focus
|
// Close any panel with Esc without requiring focus
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
@ -175,59 +168,6 @@ Loader {
|
||||||
onClicked: root.close()
|
onClicked: root.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dim overlay that excludes corners when screen corners are enabled
|
|
||||||
Item {
|
|
||||||
id: dimOverlay
|
|
||||||
anchors.fill: parent
|
|
||||||
visible: root.active && !root.isClosing && Settings.data.general.dimDesktop
|
|
||||||
opacity: visible ? 1.0 : 0.0
|
|
||||||
|
|
||||||
// Helper function to check if screen corners are enabled
|
|
||||||
function isScreenCornersEnabled() {
|
|
||||||
return Settings.data.general.showScreenCorners
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to get corner radius
|
|
||||||
function getCornerRadius() {
|
|
||||||
return 20 // Same as ScreenCorners innerRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to get border width
|
|
||||||
function getBorderWidth() {
|
|
||||||
return Style.borderM
|
|
||||||
}
|
|
||||||
|
|
||||||
// Full screen dim when screen corners are disabled
|
|
||||||
Rectangle {
|
|
||||||
id: fullScreenDim
|
|
||||||
visible: dimOverlay.visible && !dimOverlay.isScreenCornersEnabled()
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Color.applyOpacity(Color.mShadow, "BB")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Masked dim when screen corners are enabled
|
|
||||||
Item {
|
|
||||||
id: maskedDim
|
|
||||||
visible: dimOverlay.visible && dimOverlay.isScreenCornersEnabled()
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
// Only dim the center area, leaving the entire border undimmed
|
|
||||||
Rectangle {
|
|
||||||
id: centerDim
|
|
||||||
anchors.margins: dimOverlay.getCornerRadius() + dimOverlay.getBorderWidth()
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Color.applyOpacity(Color.mShadow, "BB")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Behavior for dim overlay visibility
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Style.animationNormal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: panelBackground
|
id: panelBackground
|
||||||
color: panelBackgroundColor
|
color: panelBackgroundColor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue