mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 05:55:37 -05:00
fix some topbar issues
This commit is contained in:
@@ -374,16 +374,14 @@ Item {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!SettingsData.topBarLeftWidgets
|
||||
|| SettingsData.topBarLeftWidgets.length === 0)
|
||||
// Only set defaults if widgets have never been configured (null/undefined, not empty array)
|
||||
if (!SettingsData.topBarLeftWidgets)
|
||||
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets)
|
||||
|
||||
if (!SettingsData.topBarCenterWidgets
|
||||
|| SettingsData.topBarCenterWidgets.length === 0)
|
||||
if (!SettingsData.topBarCenterWidgets)
|
||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
||||
|
||||
if (!SettingsData.topBarRightWidgets
|
||||
|| SettingsData.topBarRightWidgets.length === 0)
|
||||
if (!SettingsData.topBarRightWidgets)
|
||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
||||
|
||||
["left", "center", "right"].forEach(sectionId => {
|
||||
|
||||
@@ -3,50 +3,28 @@ import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property bool isActive: false
|
||||
property string section: "left" // Which section this button is in
|
||||
property var popupTarget: null // Reference to the popup to position
|
||||
property var parentScreen: null // The screen this button is on
|
||||
property string section: "left"
|
||||
property var popupTarget: null
|
||||
property var parentScreen: null
|
||||
|
||||
signal clicked
|
||||
|
||||
width: 40
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
const baseColor = launcherArea.containsMouse
|
||||
|| isActive ? Theme.surfaceTextPressed : Theme.surfaceTextHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
SystemLogo {
|
||||
visible: SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
width: Theme.iconSize - 3
|
||||
height: Theme.iconSize - 3
|
||||
colorOverride: SettingsData.osLogoColorOverride
|
||||
brightnessOverride: SettingsData.osLogoBrightness
|
||||
contrastOverride: SettingsData.osLogoContrast
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
name: "apps"
|
||||
size: Theme.iconSize - 6
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: launcherArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
z: 1000
|
||||
preventStealing: true
|
||||
propagateComposedEvents: false
|
||||
|
||||
onClicked: {
|
||||
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||
var globalPos = mapToGlobal(0, 0)
|
||||
@@ -61,10 +39,39 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
const baseColor = launcherArea.containsMouse
|
||||
|| isActive ? Theme.surfaceTextPressed : Theme.surfaceTextHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
SystemLogo {
|
||||
visible: SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
width: Theme.iconSize - 3
|
||||
height: Theme.iconSize - 3
|
||||
colorOverride: SettingsData.osLogoColorOverride
|
||||
brightnessOverride: SettingsData.osLogoBrightness
|
||||
contrastOverride: SettingsData.osLogoContrast
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
name: "apps"
|
||||
size: Theme.iconSize - 6
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,8 +184,9 @@ Rectangle {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: root.playerAvailable && root.opacity > 0 && root.width > 0 && textContainer.visible
|
||||
hoverEnabled: enabled
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
||||
var globalPos = mapToGlobal(0, 0)
|
||||
@@ -226,8 +227,9 @@ Rectangle {
|
||||
id: prevArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: root.playerAvailable && root.width > 0
|
||||
hoverEnabled: enabled
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (activePlayer)
|
||||
activePlayer.previous()
|
||||
@@ -256,8 +258,9 @@ Rectangle {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: root.playerAvailable && root.width > 0
|
||||
hoverEnabled: enabled
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (activePlayer)
|
||||
activePlayer.togglePlaying()
|
||||
@@ -285,8 +288,9 @@ Rectangle {
|
||||
id: nextArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: root.playerAvailable && root.width > 0
|
||||
hoverEnabled: enabled
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (activePlayer)
|
||||
activePlayer.next()
|
||||
|
||||
@@ -82,6 +82,19 @@ PanelWindow {
|
||||
root.updateGpuTempConfig()
|
||||
}
|
||||
|
||||
function onWidgetDataChanged() {
|
||||
Qt.callLater(() => {
|
||||
leftSection.visible = false
|
||||
centerSection.visible = false
|
||||
rightSection.visible = false
|
||||
Qt.callLater(() => {
|
||||
leftSection.visible = true
|
||||
centerSection.visible = true
|
||||
rightSection.visible = true
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
target: SettingsData
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Singleton {
|
||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,29 @@ Singleton {
|
||||
root.focusedAppId = ""
|
||||
root.focusedAppName = ""
|
||||
root.focusedWindowTitle = ""
|
||||
root.focusedWindowId = -1
|
||||
}
|
||||
|
||||
function setWorkspaceFallback() {
|
||||
if (NiriService.focusedWorkspaceIndex >= 0 && NiriService.allWorkspaces.length > 0) {
|
||||
const workspace = NiriService.allWorkspaces[NiriService.focusedWorkspaceIndex]
|
||||
if (workspace) {
|
||||
root.focusedAppId = "niri"
|
||||
root.focusedAppName = "niri"
|
||||
if (workspace.name && workspace.name.length > 0) {
|
||||
root.focusedWindowTitle = workspace.name
|
||||
} else {
|
||||
root.focusedWindowTitle = "Workspace " + (workspace.idx + 1)
|
||||
}
|
||||
root.focusedWindowId = -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
}
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
}
|
||||
}
|
||||
|
||||
// Convert app_id to a more user-friendly display name
|
||||
function getDisplayName(appId) {
|
||||
if (!appId)
|
||||
return ""
|
||||
@@ -62,7 +82,7 @@ Singleton {
|
||||
function onFocusedWindowIdChanged() {
|
||||
const focusedWindowId = NiriService.focusedWindowId
|
||||
if (!focusedWindowId) {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -74,7 +94,7 @@ Singleton {
|
||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||
} else {
|
||||
clearFocusedWindow()
|
||||
setWorkspaceFallback()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user