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: {
|
Component.onCompleted: {
|
||||||
if (!SettingsData.topBarLeftWidgets
|
// Only set defaults if widgets have never been configured (null/undefined, not empty array)
|
||||||
|| SettingsData.topBarLeftWidgets.length === 0)
|
if (!SettingsData.topBarLeftWidgets)
|
||||||
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets)
|
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets)
|
||||||
|
|
||||||
if (!SettingsData.topBarCenterWidgets
|
if (!SettingsData.topBarCenterWidgets)
|
||||||
|| SettingsData.topBarCenterWidgets.length === 0)
|
|
||||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
||||||
|
|
||||||
if (!SettingsData.topBarRightWidgets
|
if (!SettingsData.topBarRightWidgets)
|
||||||
|| SettingsData.topBarRightWidgets.length === 0)
|
|
||||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
||||||
|
|
||||||
["left", "center", "right"].forEach(sectionId => {
|
["left", "center", "right"].forEach(sectionId => {
|
||||||
|
|||||||
@@ -3,50 +3,28 @@ import qs.Common
|
|||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
property string section: "left" // Which section this button is in
|
property string section: "left"
|
||||||
property var popupTarget: null // Reference to the popup to position
|
property var popupTarget: null
|
||||||
property var parentScreen: null // The screen this button is on
|
property var parentScreen: null
|
||||||
|
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
width: 40
|
width: 40
|
||||||
height: 30
|
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 {
|
MouseArea {
|
||||||
id: launcherArea
|
id: launcherArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
z: 1000
|
||||||
|
preventStealing: true
|
||||||
|
propagateComposedEvents: false
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (popupTarget && popupTarget.setTriggerPosition) {
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
var globalPos = mapToGlobal(0, 0)
|
var globalPos = mapToGlobal(0, 0)
|
||||||
@@ -61,10 +39,39 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Rectangle {
|
||||||
ColorAnimation {
|
anchors.fill: parent
|
||||||
duration: Theme.shortDuration
|
radius: Theme.cornerRadius
|
||||||
easing.type: Theme.standardEasing
|
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 {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.opacity > 0 && root.width > 0 && textContainer.visible
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
||||||
var globalPos = mapToGlobal(0, 0)
|
var globalPos = mapToGlobal(0, 0)
|
||||||
@@ -226,8 +227,9 @@ Rectangle {
|
|||||||
id: prevArea
|
id: prevArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.previous()
|
activePlayer.previous()
|
||||||
@@ -256,8 +258,9 @@ Rectangle {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.togglePlaying()
|
activePlayer.togglePlaying()
|
||||||
@@ -285,8 +288,9 @@ Rectangle {
|
|||||||
id: nextArea
|
id: nextArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.next()
|
activePlayer.next()
|
||||||
|
|||||||
@@ -82,6 +82,19 @@ PanelWindow {
|
|||||||
root.updateGpuTempConfig()
|
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
|
target: SettingsData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Singleton {
|
|||||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||||
} else {
|
} else {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,9 +37,29 @@ Singleton {
|
|||||||
root.focusedAppId = ""
|
root.focusedAppId = ""
|
||||||
root.focusedAppName = ""
|
root.focusedAppName = ""
|
||||||
root.focusedWindowTitle = ""
|
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) {
|
function getDisplayName(appId) {
|
||||||
if (!appId)
|
if (!appId)
|
||||||
return ""
|
return ""
|
||||||
@@ -62,7 +82,7 @@ Singleton {
|
|||||||
function onFocusedWindowIdChanged() {
|
function onFocusedWindowIdChanged() {
|
||||||
const focusedWindowId = NiriService.focusedWindowId
|
const focusedWindowId = NiriService.focusedWindowId
|
||||||
if (!focusedWindowId) {
|
if (!focusedWindowId) {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +94,7 @@ Singleton {
|
|||||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||||
} else {
|
} else {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user