Fix Brightness & Tray
This commit is contained in:
parent
8e562e0701
commit
12092ca6f6
5 changed files with 23 additions and 13 deletions
|
|
@ -47,6 +47,7 @@ Singleton {
|
||||||
// -----------
|
// -----------
|
||||||
function applyOpacity(color, opacity) {
|
function applyOpacity(color, opacity) {
|
||||||
// Convert color to string and apply opacity
|
// Convert color to string and apply opacity
|
||||||
|
if (!color) return "transparent"
|
||||||
return color.toString().replace("#", "#" + opacity)
|
return color.toString().replace("#", "#" + opacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,13 +137,16 @@ Variants {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`Attempting to load widget: ${widgetName}.qml`)
|
||||||
|
|
||||||
// Try to load the widget directly from file
|
// Try to load the widget directly from file
|
||||||
const component = Qt.createComponent(`../Bar/Widgets/${widgetName}.qml`)
|
const component = Qt.createComponent(`../Bar/Widgets/${widgetName}.qml`)
|
||||||
if (component.status === Component.Ready) {
|
if (component.status === Component.Ready) {
|
||||||
|
console.log(`Successfully created component for: ${widgetName}.qml`)
|
||||||
return component
|
return component
|
||||||
}
|
}
|
||||||
|
|
||||||
console.warn(`Failed to load widget: ${widgetName}.qml`)
|
console.warn(`Failed to load widget: ${widgetName}.qml, status:`, component.status, "error:", component.errorString())
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Item {
|
||||||
|
|
||||||
width: pill.width
|
width: pill.width
|
||||||
height: pill.height
|
height: pill.height
|
||||||
visible: firstBrightnessReceived && getMonitor() !== null
|
visible: getMonitor() !== null
|
||||||
|
|
||||||
// Used to avoid opening the pill on Quickshell startup
|
// Used to avoid opening the pill on Quickshell startup
|
||||||
property bool firstBrightnessReceived: false
|
property bool firstBrightnessReceived: false
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,14 @@ import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
readonly property real itemSize: 24 * scaling
|
readonly property real itemSize: 24 * scaling
|
||||||
|
|
||||||
visible: Settings.data.bar.showTray && (SystemTray.items.values.length > 0)
|
visible: Settings.data.bar.showTray && (SystemTray.items.values.length > 0)
|
||||||
|
|
||||||
|
|
||||||
width: tray.width + Style.marginM * scaling * 2
|
width: tray.width + Style.marginM * scaling * 2
|
||||||
|
|
||||||
height: Math.round(Style.capsuleHeight * scaling)
|
height: Math.round(Style.capsuleHeight * scaling)
|
||||||
|
|
@ -95,14 +99,14 @@ Rectangle {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelData.hasMenu && modelData.menu && trayMenu) {
|
if (modelData.hasMenu && modelData.menu && trayMenu.item) {
|
||||||
trayPanel.open()
|
trayPanel.open()
|
||||||
|
|
||||||
// Anchor the menu to the tray icon item (parent) and position it below the icon
|
// Anchor the menu to the tray icon item (parent) and position it below the icon
|
||||||
const menuX = (width / 2) - (trayMenu.width / 2)
|
const menuX = (width / 2) - (trayMenu.item.width / 2)
|
||||||
const menuY = (Style.barHeight * scaling)
|
const menuY = (Style.barHeight * scaling)
|
||||||
trayMenu.menu = modelData.menu
|
trayMenu.item.menu = modelData.menu
|
||||||
trayMenu.showAt(parent, menuX, menuY)
|
trayMenu.item.showAt(parent, menuX, menuY)
|
||||||
} else {
|
} else {
|
||||||
Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set")
|
Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set")
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +146,7 @@ Rectangle {
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
visible = false
|
visible = false
|
||||||
trayMenu.hideMenu()
|
trayMenu.item.hideMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clicking outside of the rectangle to close
|
// Clicking outside of the rectangle to close
|
||||||
|
|
@ -151,8 +155,9 @@ Rectangle {
|
||||||
onClicked: trayPanel.close()
|
onClicked: trayPanel.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
TrayMenu {
|
Loader {
|
||||||
id: trayMenu
|
id: trayMenu
|
||||||
|
source: "TrayMenu.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ ColumnLayout {
|
||||||
height: 32 * scaling
|
height: 32 * scaling
|
||||||
radius: width * 0.5
|
radius: width * 0.5
|
||||||
color: Color.mPrimary
|
color: Color.mPrimary
|
||||||
border.color: Color.mPrimaryContainer
|
border.color: Color.mPrimary
|
||||||
border.width: 2 * scaling
|
border.width: 2 * scaling
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
|
|
@ -336,7 +336,7 @@ ColumnLayout {
|
||||||
height: 32 * scaling
|
height: 32 * scaling
|
||||||
radius: width * 0.5
|
radius: width * 0.5
|
||||||
color: Color.mPrimary
|
color: Color.mPrimary
|
||||||
border.color: Color.mPrimaryContainer
|
border.color: Color.mPrimary
|
||||||
border.width: 2 * scaling
|
border.width: 2 * scaling
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
|
|
@ -473,7 +473,7 @@ ColumnLayout {
|
||||||
height: 32 * scaling
|
height: 32 * scaling
|
||||||
radius: width * 0.5
|
radius: width * 0.5
|
||||||
color: Color.mPrimary
|
color: Color.mPrimary
|
||||||
border.color: Color.mPrimaryContainer
|
border.color: Color.mPrimary
|
||||||
border.width: 2 * scaling
|
border.width: 2 * scaling
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
|
|
@ -612,8 +612,9 @@ ColumnLayout {
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
Layout.fillWidth: true
|
||||||
anchors.margins: Style.marginL * scaling
|
Layout.fillHeight: true
|
||||||
|
Layout.margins: Style.marginL * scaling
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue